aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp/levels
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp/levels')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/levels/_lf_maps_shared.gnut2
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_lf_deck.nut1
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut423
3 files changed, 413 insertions, 13 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/_lf_maps_shared.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/_lf_maps_shared.gnut
index 695f096d..91b17840 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/_lf_maps_shared.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/_lf_maps_shared.gnut
@@ -5,5 +5,5 @@ void function SetupLiveFireMaps()
{
Riff_ForceTitanAvailability( eTitanAvailability.Never )
ClassicMP_SetLevelIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() )
- ClassicMP_ForceDisableEpilogue( true )
+ // ClassicMP_ForceDisableEpilogue( true ) // don't do this because evac handles this now
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_lf_deck.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_lf_deck.nut
index 398b2fc5..dca30fe9 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_lf_deck.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_lf_deck.nut
@@ -2,5 +2,6 @@ global function CodeCallback_MapInit
void function CodeCallback_MapInit()
{
+ FlagClear( "Disable_Marvins" )
SetupLiveFireMaps()
} \ No newline at end of file
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 3a46eba8..58a4be02 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut
@@ -2,7 +2,12 @@ untyped
global function CodeCallback_MapInit
struct {
- bool introStartTime
+ float introStartTime
+ entity militiaPod
+ entity imcPod
+
+ vector militiaPodFXEyePos
+ vector imcPodFXEyePos
} file
void function CodeCallback_MapInit()
@@ -14,32 +19,426 @@ void function CodeCallback_MapInit()
SetEvacSpaceNode( GetEnt( "end_spacenode" ) )
- // currently disabled: intro
- // if ( !IsFFAGame() )
- // ClassicMP_SetLevelIntro( WargamesIntroSetup, 25.0 )
+ // dissolve effects
+ AddDeathCallback( "player", WargamesDissolveDeadEntity )
+ AddDeathCallback( "npc_soldier", WargamesDissolveDeadEntity )
+ AddDeathCallback( "npc_spectre", WargamesDissolveDeadEntity )
+ AddDeathCallback( "npc_pilot_elite", WargamesDissolveDeadEntity )
+ AddDeathCallback( "npc_marvin", WargamesDissolveDeadEntity )
+
+ FlagClear( "Disable_Marvins" )
+
+ // currently disabled until finished: intro
+ if ( !IsFFAGame() )
+ ClassicMP_SetLevelIntro( WargamesIntroSetup, 20.0 )
}
-// intro stuff
+// dissolve effects
+void function WargamesDissolveDeadEntity( entity deadEnt, var damageInfo )
+{
+ if ( deadEnt.IsPlayer() || GamePlayingOrSuddenDeath() || GetGameState() == eGameState.Epilogue )
+ {
+ deadEnt.Dissolve( ENTITY_DISSOLVE_CHAR, < 0, 0, 0 >, 0 )
+ EmitSoundAtPosition( TEAM_UNASSIGNED, deadEnt.GetOrigin(), "Object_Dissolve" )
+ }
+}
+
+// intro stuff:
void function WargamesIntroSetup()
{
- AddCallback_OnClientConnected( WargamesIntro_OnClientConnected )
- AddCallback_OnClientDisconnected( WargamesIntro_OnClientDisconnected )
+ PrecacheParticleSystem( FX_POD_SCREEN_IN )
+ PrecacheParticleSystem( $"P_pod_scan_laser_FP" )
+ PrecacheParticleSystem( $"P_pod_Dlight_console1" )
+ PrecacheParticleSystem( $"P_pod_Dlight_console2" )
+ PrecacheParticleSystem( $"P_pod_door_glow_FP" )
+ PrecacheModel( $"models/titans/ogre/ogreposeopen.mdl" )
+
+ file.militiaPod = GetEnt( "training_pod" )
+ file.imcPod = GetEnt( "training_pod_imc" )
+
+ AddCallback_OnClientConnected( WargamesIntro_AddPlayer )
AddCallback_GameStateEnter( eGameState.Prematch, OnPrematchStart )
}
-void function WargamesIntro_OnClientConnected( entity player )
+void function WargamesIntro_AddPlayer( entity player )
{
+ if ( GetGameState() != eGameState.Prematch )
+ return
+
+ thread PlayerWatchesWargamesIntro( player )
+}
+void function OnPrematchStart()
+{
+ ClassicMP_OnIntroStarted()
+ file.introStartTime = Time()
+
+ // set up shared objects
+ // this breaks glowlights, not sure why
+ //file.imcPod.RenderWithViewModels( true )
+ //file.militiaPod.RenderWithViewModels( true )
+
+ PodFXLights( file.imcPod )
+ PodFXLights( file.militiaPod )
+
+ FirstPersonSequenceStruct openPodSequence
+ openPodSequence.thirdPersonAnimIdle = "trainingpod_doors_open_idle"
+ thread FirstPersonSequence( openPodSequence, file.imcPod )
+ thread FirstPersonSequence( openPodSequence, file.militiaPod )
+
+ // militia titans/marvins
+ entity militiaOgre = CreatePropDynamic( $"models/titans/ogre/ogreposeopen.mdl", < -2060, 2856, -1412.5 >, < 0, 0, 0 > )
+
+ entity militiaOgreMarvin1 = CreateMarvin( TEAM_UNASSIGNED, < -2113, 2911, -1412 >, < 0, 20, 0 > )
+ DispatchSpawn( militiaOgreMarvin1 )
+ thread PlayAnim( militiaOgreMarvin1, "mv_idle_weld" )
+
+ entity militiaOgreMarvin2 = CreateMarvin( TEAM_UNASSIGNED, < -2040, 2788, -1412 >, < 0, 140, 0 > )
+ DispatchSpawn( militiaOgreMarvin2 )
+ thread PlayAnim( militiaOgreMarvin2, "mv_idle_weld" )
+
+ entity militiaOgreMarvin3 = CreateMarvin( TEAM_UNASSIGNED, < -2116, 2868, -1458 >, < 0, 127, 0 > )
+ DispatchSpawn( militiaOgreMarvin3 )
+ thread PlayAnim( militiaOgreMarvin3, "mv_turret_repair_A_idle" )
+
+ entity militiaIon = CreatePropDynamic( $"models/titans/medium/titan_medium_ajax.mdl", < -1809.98, 2790.39, -1409 >, < 0, 80, 0 > )
+ thread PlayAnim( militiaIon, "at_titan_activation_wargames_intro" )
+
+ entity militiaPilot = CreateElitePilot( TEAM_UNASSIGNED, < 0, 0, 0 >, < 0, 0, 0 > )
+ DispatchSpawn( militiaPilot )
+ militiaPilot.SetParent( militiaIon, "HIJACK" )
+ militiaPilot.MarkAsNonMovingAttachment()
+ militiaPilot.Anim_ScriptedPlay( "pt_titan_activation_pilot" )
+ militiaPilot.Anim_EnableUseAnimatedRefAttachmentInsteadOfRootMotion()
+
+ entity militiaMarvinChillin = CreateMarvin( TEAM_UNASSIGNED, < -1786, 3060, -1412 >, < 0, -120, 0 > )
+ DispatchSpawn( militiaMarvinChillin )
+ thread PlayAnim( militiaMarvinChillin, "mv_idle_unarmed" )
+
+
+ // imc grunts
+ entity imcGrunt1 = CreatePropDynamic( $"models/humans/grunts/imc_grunt_rifle.mdl", < -2915, 2867, -1788 >, < 0, -137, 0 > )
+ thread PlayAnim( imcGrunt1, "pt_console_idle" )
+
+ entity imcGrunt2 = CreatePropDynamic( $"models/humans/grunts/imc_grunt_rifle.mdl", < -2870, 2746, -1786 >, < 0, -167, 0 > )
+ thread PlayAnim( imcGrunt2, "pt_console_idle" )
+ imcGrunt2.Anim_SetInitialTime( 2.0 )
+
+ entity imcGrunt3 = CreatePropDynamic( $"models/humans/grunts/imc_grunt_rifle.mdl", < -3037, 2909, -1786 >, < 0, -60, 0 > )
+ thread PlayAnim( imcGrunt3, "pt_console_idle" )
+ imcGrunt3.Anim_SetInitialTime( 4.0 )
+
+ entity imcGrunt4 = CreatePropDynamic( $"models/humans/grunts/imc_grunt_rifle.mdl", < -3281, 2941, -1790 >, < 0, 138, 0 > )
+ thread PlayAnim( imcGrunt4, "pt_console_idle" )
+ imcGrunt4.Anim_SetInitialTime( 6.0 )
+
+ // launch players into intro
+ foreach ( entity player in GetPlayerArray() )
+ thread PlayerWatchesWargamesIntro( player )
+
+ // 7 seconds of nothing until we start the pod sequence
+ wait 7.0
+
+ FirstPersonSequenceStruct podCloseSequence
+ podCloseSequence.thirdPersonAnim = "trainingpod_doors_close"
+ podCloseSequence.thirdPersonAnimIdle = "trainingpod_doors_close_idle"
+ thread FirstPersonSequence( podCloseSequence, file.imcPod )
+ thread FirstPersonSequence( podCloseSequence, file.militiaPod )
+
+ wait 7.0
+ thread PodBootFXThread( file.imcPod )
+ thread PodBootFXThread( file.militiaPod )
+
+ wait 6.0
+ ClassicMP_OnIntroFinished()
+
+ // make sure we stop using viewmodels for these otherwise everyone can see them in the floor 24/7
+ file.imcPod.RenderWithViewModels( false )
+ file.militiaPod.RenderWithViewModels( false )
+
+ //PodFXCleanup( file.imcPod )
+ //PodFXCleanup( file.militiaPod )
+
+ // cleanup intro objects
+ militiaOgre.Destroy()
+ militiaIon.Destroy()
+ militiaPilot.Destroy()
+ militiaOgreMarvin1.Destroy()
+ militiaOgreMarvin2.Destroy()
+ militiaOgreMarvin3.Destroy()
+ militiaMarvinChillin.Destroy()
+
+ imcGrunt1.Destroy()
+ imcGrunt2.Destroy()
+ imcGrunt3.Destroy()
+ imcGrunt4.Destroy()
}
-void function WargamesIntro_OnClientDisconnected( entity player )
+void function PlayerWatchesWargamesIntro( entity player )
{
+ if ( IsAlive( player ) )
+ player.Die()
+ OnThreadEnd( function() : ( player )
+ {
+ if ( IsValid( player ) )
+ {
+ RemoveCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING )
+ player.kv.VisibilityFlags = ENTITY_VISIBLE_TO_EVERYONE
+ ClearPlayerAnimViewEntity( player )
+ player.EnableWeaponViewModel()
+ player.ClearParent()
+ player.UnforceStand()
+ player.MovementEnable()
+ Remote_CallFunction_NonReplay( player, "ServerCallback_ClearFactionLeaderIntro" )
+ }
+ })
+
+ // we need to wait a frame if we killed ourselves to spawn into this, so just easier to do it all the time to remove any weirdness
+ WaitFrame()
+
+ player.EndSignal( "OnDestroy" )
+ player.EndSignal( "OnDeath" )
+
+ int factionTeam = ConvertPlayerFactionToIMCOrMilitiaTeam( player )
+ entity playerPod
+ if ( factionTeam == TEAM_IMC )
+ playerPod = file.imcPod
+ else
+ playerPod = file.militiaPod
+
+ // setup player
+ int podAttachId = playerPod.LookupAttachment( "REF" )
+ player.SetOrigin( playerPod.GetAttachmentOrigin( podAttachId ) )
+ player.SetAngles( playerPod.GetAttachmentAngles( podAttachId ) )
+ player.RespawnPlayer( null )
+ player.SetParent( playerPod, "REF" )
+ player.ForceStand()
+
+ if ( !HasAnimEvent( player.GetFirstPersonProxy(), "PlaySound_SimPod_DoorShut" ) )
+ AddAnimEvent( player.GetFirstPersonProxy(), "PlaySound_SimPod_DoorShut", PlaySound_SimPod_DoorShut )
+
+ AddCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING )
+ player.kv.VisibilityFlags = ENTITY_VISIBLE_TO_OWNER
+ TrainingPod_ViewConeLock_PodClosed( player )
+ player.DisableWeaponViewModel()
+ player.MovementDisable()
+
+ // spawn faction leader
+ // no clue why client subtracts 4.5 from the time we give this, so just add it here instead
+ if ( factionTeam == TEAM_IMC )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnIMCFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() )
+ else
+ Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnMilitiaFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() )
+
+ // idle pod sequence
+ FirstPersonSequenceStruct podIdleSequence
+ podIdleSequence.firstPersonAnimIdle = "ptpov_trainingpod_idle"
+ podIdleSequence.renderWithViewModels = true
+ podIdleSequence.attachment = "REF"
+ thread FirstPersonSequence( podIdleSequence, player, playerPod )
+
+ ScreenFadeFromBlack( player, max( 0.0, ( file.introStartTime + 0.5 ) - Time() ), max( 0.0, ( file.introStartTime + 0.5 ) - Time() ) )
+
+ // also get eye positions for fx here
+ if ( file.imcPodFXEyePos == < 0, 0, 0 > && factionTeam == TEAM_IMC )
+ file.imcPodFXEyePos = player.EyePosition()
+ else if ( file.militiaPodFXEyePos == < 0, 0, 0 > && factionTeam == TEAM_MILITIA )
+ file.militiaPodFXEyePos = player.EyePosition()
+
+ // 7 seconds of nothing before we start the pod sequence
+ wait ( file.introStartTime + 7.0 ) - Time()
+
+ FirstPersonSequenceStruct podCloseSequence
+ podCloseSequence.firstPersonAnim = "ptpov_trainingpod_doors_close"
+ podCloseSequence.renderWithViewModels = true
+ podCloseSequence.attachment = "REF"
+ podCloseSequence.viewConeFunction = TrainingPod_ViewConeLock_SemiStrict
+ podCloseSequence.setInitialTime = Time() - ( file.introStartTime + 7.0 )
+ waitthread FirstPersonSequence( podCloseSequence, player, playerPod )
+
+ // boot sequence
+ EmitSoundOnEntityOnlyToPlayer( player, player, "NPE_Scr_SimPod_PowerUp" )
+ TrainingPod_ViewConeLock_PodClosed( player )
+
+ // 10 seconds of starting pod before we run effects and spawn players
+ // note, this is cool because it waits for a specific time, so we can have a blocking call directly before it just fine
+ wait ( file.introStartTime + 15.5 ) - Time()
+ Remote_CallFunction_NonReplay( player, "ServerCallback_PlayPodTransitionScreenFX" )
+
+ // need to wait no matter what the delay is here so fx will sync up
+ wait 3.5
+
+ entity spawnpoint = FindSpawnPoint( player, false, true )
+ spawnpoint.s.lastUsedTime = Time()
+ player.SetOrigin( spawnpoint.GetOrigin() )
+ player.SetAngles( spawnpoint.GetAngles() )
+
+ thread DelayedGamemodeAnnouncement( player )
}
-void function OnPrematchStart()
+void function DelayedGamemodeAnnouncement( entity player )
{
- ClassicMP_OnIntroStarted()
- file.introStartTime = Time()
+ wait 1.0
+ TryGameModeAnnouncement( player )
+}
+
+void function PlaySound_SimPod_DoorShut( entity playerFirstPersonProxy ) // stolen from sp_training
+{
+ entity player = playerFirstPersonProxy.GetOwner()
+ if ( !IsValid( player ) )
+ return
+
+ EmitSoundOnEntityOnlyToPlayer( player, player, "NPE_Scr_SimPod_DoorShut" )
+}
+
+// intro viewcones
+void function TrainingPod_ViewConeLock_PodOpen( entity player )
+{
+ player.PlayerCone_FromAnim()
+ player.PlayerCone_SetMinYaw( -25 )
+ player.PlayerCone_SetMaxYaw( 25 )
+ player.PlayerCone_SetMinPitch( -30 )
+ player.PlayerCone_SetMaxPitch( 35 )
+}
+
+void function TrainingPod_ViewConeLock_PodClosed( entity player )
+{
+ player.PlayerCone_FromAnim()
+ player.PlayerCone_SetMinYaw( -25 )
+ player.PlayerCone_SetMaxYaw( 25 )
+ player.PlayerCone_SetMinPitch( -30 )
+ player.PlayerCone_SetMaxPitch( 30 )
+}
+
+void function TrainingPod_ViewConeLock_SemiStrict( entity player )
+{
+ player.PlayerCone_FromAnim()
+ player.PlayerCone_SetMinYaw( -10 )
+ player.PlayerCone_SetMaxYaw( 10 )
+ player.PlayerCone_SetMinPitch( -10 )
+ player.PlayerCone_SetMaxPitch( 10 )
+}
+
+// intro pod fx
+// here be dragons etc hell code probably
+void function PodFXLights( entity pod )
+{
+ // dlights
+ pod.s.podLightFXHandles <- []
+ pod.s.podLightFXHandles.append( PlayLoopFXOnEntity( $"P_pod_Dlight_console1", pod, "light_console1" ) )
+ pod.s.podLightFXHandles.append( PlayLoopFXOnEntity( $"P_pod_Dlight_console2", pod, "light_console2" ) )
+}
+
+void function PodFXLasers( entity pod )
+{
+ entity leftEmitter = CreateScriptMover( pod.GetOrigin() )
+ pod.s.leftLaserEmitter <- leftEmitter
+ entity rightEmitter = CreateScriptMover( pod.GetOrigin() )
+ pod.s.rightLaserEmitter <- rightEmitter
+
+ thread PodFXLaserSweep( leftEmitter, pod, pod == file.imcPod ? file.imcPodFXEyePos : file.militiaPodFXEyePos, "fx_laser_L" )
+ thread PodFXLaserSweep( rightEmitter, pod, pod == file.imcPod ? file.imcPodFXEyePos : file.militiaPodFXEyePos, "fx_laser_R" )
+}
+
+void function PodFXLaserSweep( entity emitter, entity pod, vector eyePos, string attachment )
+{
+ // setup emitter attachments
+ emitter.SetOrigin( < 5, 5, 5 > )
+ emitter.SetParent( pod, attachment )
+
+ float sweepTime = RandomFloatRange( 2.9, 3.15 )
+
+ vector centerAng = VectorToAngles( ( eyePos + < 0, 0, 7 > ) - emitter.GetOrigin() )
+ vector topAng = centerAng + < -270, 0, 0 >
+ vector bottomAng = centerAng + < -90, 0, 0 >
+
+ emitter.s.fxHandle <- PlayLoopFXOnEntity( $"P_pod_scan_laser_FP", emitter )
+
+ float finalCenterTime = sweepTime * 0.15
+ float bigSweepTime = ( sweepTime - finalCenterTime ) / 2
+
+ emitter.SetAbsAngles( topAng )
+ emitter.NonPhysicsRotateTo( topAng, bigSweepTime, 0.0, bigSweepTime * 0.2 )
+ wait bigSweepTime - 0.1
+
+ emitter.NonPhysicsRotateTo( bottomAng, bigSweepTime, 0.0, bigSweepTime * 0.2 )
+ wait bigSweepTime
+
+ emitter.NonPhysicsRotateTo( centerAng, finalCenterTime, 0.0, finalCenterTime * 0.2 )
+}
+
+void function PodFXGlowLights( entity pod )
+{
+ // see sp_training:5533 (TrainingPod_GlowLightsArraySetup)
+ array< array< string > > glowLightGroups = [
+ [ "fx_glow_L_door012", "fx_glow_R_door014" ],
+ [ "fx_glow_L_door013", "fx_glow_R_door013" ],
+ [ "fx_glow_L_door014", "fx_glow_R_door012" ],
+ [ "fx_glow_L_door011", "fx_glow_R_door011" ],
+ [ "fx_glow_L_door09", "fx_glow_R_door09" ],
+ [ "fx_glow_L_door010", "fx_glow_R_door010" ],
+ [ "fx_glow_L_door07", "fx_glow_R_door07" ],
+ [ "fx_glow_L_door08", "fx_glow_R_door08" ],
+ [ "fx_glow_L_door05", "fx_glow_R_door05" ],
+ [ "fx_glow_L_door06", "fx_glow_R_door06" ],
+ [ "fx_glow_L_door03", "fx_glow_R_door03" ],
+ [ "fx_glow_L_door04", "fx_glow_R_door04" ],
+ [ "fx_glow_L_door01", "fx_glow_R_door01" ],
+ [ "fx_glow_L_door02", "fx_glow_R_door02" ]
+ ]
+
+ pod.s.podGlowLightFXHandles <- []
+
+ foreach ( array<string> group in glowLightGroups )
+ {
+ foreach ( string attachName in group )
+ pod.s.podGlowLightFXHandles.append( PlayLoopFXOnEntity( $"P_pod_door_glow_FP", pod, attachName ) )
+
+ wait 0.1
+ }
+}
+
+void function PodBootFXThread( entity pod )
+{
+ PodFXGlowLights( pod )
+ PodFXLasers( pod )
+}
+
+void function PodFXCleanup( entity pod )
+{
+ foreach ( entity handle in pod.s.podLightFXHandles )
+ {
+ if ( IsValid_ThisFrame( handle ) )
+ {
+ handle.SetStopType( "DestroyImmediately" )
+ handle.ClearParent()
+ handle.Destroy()
+ }
+ }
+
+ pod.s.podLightFXHandles = []
+
+ foreach ( entity handle in pod.s.podGlowLightFXHandles )
+ {
+ if ( IsValid_ThisFrame( handle ) )
+ {
+ handle.SetStopType( "DestroyImmediately" )
+ handle.ClearParent()
+ handle.Destroy()
+ }
+ }
+
+ pod.s.podGlowLightFXHandles = []
+
+ pod.s.leftLaserEmitter.s.fxHandle.SetStopType( "DestroyImmediately" )
+ pod.s.leftLaserEmitter.s.fxHandle.ClearParent()
+ pod.s.leftLaserEmitter.s.fxHandle.Destroy()
+ pod.s.leftLaserEmitter.Destroy()
+
+ pod.s.rightLaserEmitter.s.fxHandle.SetStopType( "DestroyImmediately" )
+ pod.s.rightLaserEmitter.s.fxHandle.ClearParent()
+ pod.s.rightLaserEmitter.s.fxHandle.Destroy()
+ pod.s.rightLaserEmitter.Destroy()
} \ No newline at end of file