diff --git a/Northstar.CustomServers/mod/scripts/vscripts/pilot/_leeching.gnut b/Northstar.CustomServers/mod/scripts/vscripts/pilot/_leeching.gnut index c9d1f9dda..254fb129d 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/pilot/_leeching.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/pilot/_leeching.gnut @@ -46,6 +46,8 @@ void function Leeching_Init() RegisterSignal( "OnStopLeeched" ) RegisterSignal( "EnableLeeching" ) + AddCallback_EntityChangedTeam( "player", PlayerChangedTeam ) + // Spectre leech LeechFuncInfo spectre spectre.classname = "npc_spectre" @@ -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" )