From 207facbc402f5639cbcd31f079214351ef605cf2 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Tue, 22 Jun 2021 14:30:49 +0100 Subject: initial commit after moving to new repo --- .../scripts/vscripts/mp/_vr.nut | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Northstar.CustomServers/scripts/vscripts/mp/_vr.nut (limited to 'Northstar.CustomServers/scripts/vscripts/mp/_vr.nut') diff --git a/Northstar.CustomServers/scripts/vscripts/mp/_vr.nut b/Northstar.CustomServers/scripts/vscripts/mp/_vr.nut new file mode 100644 index 000000000..b9759ddf5 --- /dev/null +++ b/Northstar.CustomServers/scripts/vscripts/mp/_vr.nut @@ -0,0 +1,66 @@ +untyped + +global function VR_Init +global function VR_GroundTroopsDeathCallback + +struct { + string vr_settings = "" +} file + +function VR_Init( string settings = "", bool enableDropships = false ) +{ + if ( reloadingScripts ) + return + + if ( !enableDropships ) + FlagSet( "DisableDropships" ) + + file.vr_settings = settings + + //AddDeathCallback( "npc_soldier", VR_GroundTroopsDeathCallback ) + //AddDeathCallback( "npc_spectre", VR_GroundTroopsDeathCallback ) + //AddDeathCallback( "npc_marvin", VR_GroundTroopsDeathCallback ) + //AddDeathCallback( "player", VR_GroundTroopsDeathCallback ) + AddCallback_EntitiesDidLoad( EntitiesDidLoad ) +} + +void function EntitiesDidLoad() +{ + if ( file.vr_settings.find( "no_evac" ) != null ) + svGlobal.evacEnabled = false + + if ( file.vr_settings.find( "no_npc" ) != null ) + { + disable_npcs() + } + + if ( file.vr_settings.find( "no_titan" ) != null ) + { + Riff_ForceTitanAvailability( eTitanAvailability.Never ) + FlagSet( "PilotBot" ) + } +} + +void function VR_GroundTroopsDeathCallback( entity guy, var damageInfo ) +{ + EmitSoundAtPosition( TEAM_UNASSIGNED, guy.GetOrigin(), "Object_Dissolve" ) + + if ( ShouldDoDissolveDeath( guy, damageInfo ) ) + guy.Dissolve( ENTITY_DISSOLVE_CHAR, Vector( 0, 0, 0 ), 0 ) +} + +function ShouldDoDissolveDeath( guy, damageInfo ) +{ + if ( !guy.IsPlayer() ) + return true + + // can't dissolve players when they're not playing the game, otherwise when the game starts again they're invisible + local gs = GetGameState() + if ( gs != eGameState.Playing && gs != eGameState.SuddenDeath && gs != eGameState.Epilogue ) + { + printt( "Skipping player dissolve death because game is not active ( player:", guy, ")" ) + return false + } + + return true +} \ No newline at end of file -- cgit v1.2.3