diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-19 02:25:24 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-19 02:25:24 +0000 |
commit | 56f88c797f2c809b7793a7f039b4d44cba49e446 (patch) | |
tree | 27de08749ec57145aee7d92e3a89007f3fcf2e30 /Northstar.CustomServers | |
parent | ebfbdeedc2229d3b62a78ece45c7df61277d0184 (diff) | |
download | NorthstarMods-56f88c797f2c809b7793a7f039b4d44cba49e446.tar.gz NorthstarMods-56f88c797f2c809b7793a7f039b4d44cba49e446.zip |
automatically clear visibilityflags set by wargames death effects on early respawn
Diffstat (limited to 'Northstar.CustomServers')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut index 11587947..3f3a05f2 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut @@ -2,6 +2,8 @@ untyped global function CodeCallback_MapInit struct { + array<entity> marvinSpawners + float introStartTime entity militiaPod entity imcPod @@ -20,13 +22,14 @@ void function CodeCallback_MapInit() SetEvacSpaceNode( GetEnt( "end_spacenode" ) ) // dissolve effects - AddDeathCallback( "player", WargamesDissolveDeadEntity ) + AddDeathCallback( "player", WargamesDissolveDeadEntity ) AddDeathCallback( "npc_soldier", WargamesDissolveDeadEntity ) AddDeathCallback( "npc_spectre", WargamesDissolveDeadEntity ) AddDeathCallback( "npc_pilot_elite", WargamesDissolveDeadEntity ) AddDeathCallback( "npc_marvin", WargamesDissolveDeadEntity ) - FlagClear( "Disable_Marvins" ) + AddSpawnCallback( "info_spawnpoint_marvin", AddMarvinSpawner ) + AddCallback_GameStateEnter( eGameState.Prematch, SpawnMarvinsForRound ) // currently disabled until finished: intro if ( !IsFFAGame() ) @@ -40,6 +43,44 @@ void function WargamesDissolveDeadEntity( entity deadEnt, var damageInfo ) { deadEnt.Dissolve( ENTITY_DISSOLVE_CHAR, < 0, 0, 0 >, 0 ) EmitSoundAtPosition( TEAM_UNASSIGNED, deadEnt.GetOrigin(), "Object_Dissolve" ) + + if ( deadEnt.IsPlayer() ) + thread EnsureWargamesDeathEffectIsClearedForPlayer( deadEnt ) + } +} + +void function EnsureWargamesDeathEffectIsClearedForPlayer( entity player ) +{ + // this is slightly shit but whatever lol + player.EndSignal( "OnDestroy" ) + + float startTime = Time() + while ( player.kv.VisibilityFlags != "0" ) + { + if ( Time() > startTime + 4.0 ) // if we wait too long, just ignore + return + + WaitFrame() + } + + player.kv.VisibilityFlags = ENTITY_VISIBLE_TO_EVERYONE +} + +void function AddMarvinSpawner( entity spawn ) +{ + file.marvinSpawners.append( spawn ) +} + +void function SpawnMarvinsForRound() +{ + foreach ( entity spawner in file.marvinSpawners ) + { + entity marvin = CreateMarvin( TEAM_UNASSIGNED, spawner.GetOrigin(), spawner.GetAngles() ) + marvin.kv.health = 1 + marvin.kv.max_health = 1 + marvin.kv.spawnflags = 516 + DispatchSpawn( marvin ) + HideName( marvin ) } } |