Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move leeched NPCs over to the player's new team when they change team #721

Closed
15 changes: 15 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/pilot/_leeching.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ void function Leeching_Init()
RegisterSignal( "OnStopLeeched" )
RegisterSignal( "EnableLeeching" )

AddCallback_EntityChangedTeam( "player", PlayerChangedTeam )

// Spectre leech
LeechFuncInfo spectre
spectre.classname = "npc_spectre"
Expand Down Expand Up @@ -89,6 +91,19 @@ void function Leeching_Init()
file.leechFuncs[physbox.classname] <- physbox
}

// move all leeched npcs over to the new team
void function PlayerChangedTeam( entity player )
{
foreach( ent in GetLeechedEnts( player ) )
{
// skip non-npcs, not sure which cases this would be but yeah
if ( !ent.IsNPC() )
return

SetTeam( ent, player.GetTeam() )
}
}

void function EnableLeeching( entity self )
{
self.SetUsePrompts( "#DEFAULT_HACK_HOLD_PROMPT", "#DEFAULT_HACK_HOLD_PROMPT" )
Expand Down
Loading