From 258550dc4e747c4e0e1ae85a41de05def54aa406 Mon Sep 17 00:00:00 2001 From: ASpoonPlaysGames <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Sat, 23 Sep 2023 11:49:52 +0100 Subject: [PATCH 1/2] move leeched NPCs over to the owner player's team when they change team --- .../mod/scripts/vscripts/pilot/_leeching.gnut | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/pilot/_leeching.gnut b/Northstar.CustomServers/mod/scripts/vscripts/pilot/_leeching.gnut index c9d1f9dda..d1c5d2065 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( npc, player.GetTeam() ) + } +} + void function EnableLeeching( entity self ) { self.SetUsePrompts( "#DEFAULT_HACK_HOLD_PROMPT", "#DEFAULT_HACK_HOLD_PROMPT" ) From 8eb817f6862f4f46432ac93b80c8200f5d65a276 Mon Sep 17 00:00:00 2001 From: ASpoonPlaysGames <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Sat, 23 Sep 2023 11:49:52 +0100 Subject: [PATCH 2/2] move leeched NPCs over to the owner player's team when they change team --- .../mod/scripts/vscripts/pilot/_leeching.gnut | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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" )