diff options
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut (renamed from Northstar.Custom/mod/scripts/vscripts/client/cl_gamestate.gnut) | 0 | ||||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut | 25 | ||||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball_intro.gnut | 13 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut | 5 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut | 15 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut | 6 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut | 66 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_crashsite3.nut | 8 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut | 38 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut | 2 |
10 files changed, 95 insertions, 83 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/client/cl_gamestate.gnut b/Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut index 93be01ea..93be01ea 100644 --- a/Northstar.Custom/mod/scripts/vscripts/client/cl_gamestate.gnut +++ b/Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut diff --git a/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut b/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut index ac08c7b5..e629e5ae 100644 --- a/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut @@ -4,7 +4,6 @@ global function NorthstarDevCommands_Init void function NorthstarDevCommands_Init() { AddClientCommandCallback( "noclip", ClientCommandCallbackToggleNoclip ) - AddClientCommandCallback( "script", ClientCommandCallbackEvalScript ) AddClientCommandCallback( "kill", ClientCommandCallbackKill ) AddClientCommandCallback( "explode", ClientCommandCallbackExplode ) } @@ -22,30 +21,6 @@ bool function ClientCommandCallbackToggleNoclip( entity player, array<string> ar return true } -bool function ClientCommandCallbackEvalScript( entity player, array<string> args ) -{ - if ( args.len() < 1 || GetConVarInt( "sv_cheats" ) != 1 ) - return true - - // todo: rewrite this at some point to use a concommand because clientcommands can't just take in a single string with spaces, quotes etc - // should just have the concommand call a clientcommand manually with properly formatted args - string joinedArgs = args[0] - for ( int i = 1; i < args.len(); i++ ) - joinedArgs += " " + args[i] - - try - { - compilestring( joinedArgs )() - } - catch (exception) - { - // should probably send this to the client at some point - // no need to log here because compilestring errors already do that - } - - return true -} - bool function ClientCommandCallbackKill( entity player, array<string> args ) { if ( IsAlive( player ) && GetConVarInt( "sv_cheats" ) == 1 ) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball_intro.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball_intro.gnut index 367cafc2..86094693 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball_intro.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball_intro.gnut @@ -8,8 +8,6 @@ struct { table< int, Point > buddySpawns entity militiaBuddy entity imcBuddy - - table<entity, bool> playersHoldingJump } file void function GamemodeFastballIntroSetup() @@ -38,7 +36,6 @@ void function OnPrematchStart() ClassicMP_OnIntroStarted() file.introStartTime = Time() - file.playersHoldingJump = {} // clear it Point militiaBuddySpawn Point imcBuddySpawn @@ -198,14 +195,4 @@ void function FastballPlayer( entity player ) player.SetVelocity( throwVel ) TryGameModeAnnouncement( player ) -} - -void function PlayerHoldingJumpInIntro( entity player ) -{ - file.playersHoldingJump[ player ] <- true -} - -void function PlayerNoLongerHoldingJumpInIntro( entity player ) -{ - file.playersHoldingJump[ player ] <- false }
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index b9a8fc7c..da8ca9f5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -165,6 +165,11 @@ void function EarnMeterMP_BoostEarned( entity player ) if ( burncard.extraWeaponMod != "" ) mods.append( burncard.extraWeaponMod ) + // ensure inventory slot isn't full to avoid crash + entity preexistingWeapon = player.GetOffhandWeapon( OFFHAND_INVENTORY ) + if ( IsValid( preexistingWeapon ) ) + player.TakeWeaponNow( preexistingWeapon.GetWeaponClassName() ) + player.GiveOffhandWeapon( burncard.weaponName, OFFHAND_INVENTORY, mods ) Remote_CallFunction_Replay( player, "ServerCallback_RewardReadyMessage", player.s.respawnTime ) } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut index 9a7e89e2..96b84c23 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut @@ -96,8 +96,12 @@ void function EvacEpilogue() { int winner = GetWinningTeam() - // make sure we don't run this on ffa modes if no epilogue was specified or it won't work for current gamestate, since evac is default epilogue - if ( GetCurrentPlaylistVarInt( "max_teams", 2 ) == 2 && ( winner == TEAM_MILITIA || winner == TEAM_IMC ) ) + // make sure we don't run evac if it won't be supported for current map/gamestate + bool canRunEvac = GetCurrentPlaylistVarInt( "max_teams", 2 ) == 2 && + ( winner == TEAM_MILITIA || winner == TEAM_IMC ) && + ( file.evacNodes.len() > 0 || IsValid( GetEnt( "escape_node1" ) ) ) // code assumes escape_node1 should be first node if automatically registering + + if ( canRunEvac ) thread Evac( GetOtherTeam( winner ), EVAC_INITIAL_WAIT, EVAC_ARRIVAL_TIME, EVAC_WAIT_TIME, EvacEpiloguePlayerCanBoard, EvacEpilogueShouldLeaveEarly, EvacEpilogueCompleted ) else thread EvacEpilogueCompleted( null ) // this is hacky but like, this also shouldn't really be hit in normal gameplay @@ -125,7 +129,7 @@ bool function EvacEpilogueShouldLeaveEarly( entity dropship ) if ( IsValid( player ) ) numEvacing++ - return GetPlayerArrayOfTeam( dropship.GetTeam() ).len() == numEvacing || numEvacing == dropship.s.evacSlots.len() + return GetPlayerArrayOfTeam_Alive( dropship.GetTeam() ).len() == numEvacing || numEvacing == dropship.s.evacSlots.len() } void function EvacEpilogueCompleted( entity dropship ) @@ -283,8 +287,11 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa wait WARPINFXTIME // go to space + // hardcoded angles here are a hack, spacenode position doesn't face the planet in the skybox, for some reason - file.spaceNode.SetAngles( < 30, -75, 20 >) + // nvm removing for now + //file.spaceNode.SetAngles( < 30, -75, 20 > ) + dropship.SetOrigin( file.spaceNode.GetOrigin() ) dropship.SetAngles( file.spaceNode.GetAngles() ) dropship.SetInvulnerable() diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut index 4a756c02..3213827d 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut @@ -116,8 +116,8 @@ void function RateSpawnpoints_CTF( int checkClass, array<entity> spawnpoints, in vector zonePos = averageFriendlySpawns + Normalize( averageEnemySpawns - averageFriendlySpawns ) * ( i * averageFriendlySpawnDist ) float zonePower - foreach ( entity player in enemyPlayers ) - if ( Distance2D( player.GetOrigin(), zonePos ) < averageFriendlySpawnDist ) + foreach ( entity otherPlayer in enemyPlayers ) + if ( Distance2D( otherPlayer.GetOrigin(), zonePos ) < averageFriendlySpawnDist ) zonePower += 1.0 / enemyPlayers.len() zonePower = min( zonePower, remainingZonePower ) @@ -134,7 +134,7 @@ bool function VerifyCTFSpawnpoint( entity spawnpoint, int team ) { // ensure spawnpoints aren't too close to enemy base - if ( HasSwitchedSides() && spawnpoint.GetTeam() >= 2 ) + if ( HasSwitchedSides() && spawnpoint.GetTeam() >= TEAM_IMC ) team = GetOtherTeam( team ) array<entity> startSpawns = SpawnPoints_GetPilotStart( team ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 83d889dd..0eef7f00 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -302,7 +302,7 @@ void function GameStateEnter_WinnerDetermined_Threaded() SetServerVar( "roundWinningKillReplayEntHealthFrac", file.roundWinningKillReplayHealthFrac ) foreach ( entity player in GetPlayerArray() ) - thread PlayerWatchesRoundWinningKillReplay( player, doReplay, replayLength ) + thread PlayerWatchesRoundWinningKillReplay( player, replayLength ) wait ROUND_WINNING_KILL_REPLAY_SCREEN_FADE_TIME CleanUpEntitiesForRoundEnd() // fade should be done by this point, so cleanup stuff now when people won't see @@ -323,7 +323,7 @@ void function GameStateEnter_WinnerDetermined_Threaded() ScreenFadeToBlackForever( player, 4.0 ) } - wait 6.5 + wait ROUND_WINNING_KILL_REPLAY_LENGTH_OF_REPLAY CleanUpEntitiesForRoundEnd() // fade should be done by this point, so cleanup stuff now when people won't see foreach( entity player in GetPlayerArray() ) @@ -360,45 +360,39 @@ void function GameStateEnter_WinnerDetermined_Threaded() } } -void function PlayerWatchesRoundWinningKillReplay( entity player, bool doReplay, float replayLength ) +void function PlayerWatchesRoundWinningKillReplay( entity player, float replayLength ) { + // end if player dcs + player.EndSignal( "OnDestroy" ) + player.FreezeControlsOnServer() - - if ( IsRoundBased() || !ClassicMP_ShouldRunEpilogue() ) // if we're doing evac, then no fades or killreplay + ScreenFadeToBlackForever( player, ROUND_WINNING_KILL_REPLAY_SCREEN_FADE_TIME ) + wait ROUND_WINNING_KILL_REPLAY_SCREEN_FADE_TIME + + player.SetPredictionEnabled( false ) // prediction fucks with replays + + entity attacker = file.roundWinningKillReplayAttacker + player.SetKillReplayDelay( Time() - replayLength, THIRD_PERSON_KILL_REPLAY_ALWAYS ) + player.SetKillReplayInflictorEHandle( attacker.GetEncodedEHandle() ) + player.SetKillReplayVictim( file.roundWinningKillReplayVictim ) + player.SetViewIndex( attacker.GetIndexForEntity() ) + player.SetIsReplayRoundWinning( true ) + + if ( replayLength >= ROUND_WINNING_KILL_REPLAY_LENGTH_OF_REPLAY - 0.5 ) // only do fade if close to full length replay { - ScreenFadeToBlackForever( player, ROUND_WINNING_KILL_REPLAY_SCREEN_FADE_TIME ) - wait ROUND_WINNING_KILL_REPLAY_SCREEN_FADE_TIME - - if ( doReplay ) - { - player.SetPredictionEnabled( false ) // prediction fucks with replays - - entity attacker = file.roundWinningKillReplayAttacker - player.SetKillReplayDelay( Time() - replayLength, THIRD_PERSON_KILL_REPLAY_ALWAYS ) - player.SetKillReplayInflictorEHandle( attacker.GetEncodedEHandle() ) - player.SetKillReplayVictim( file.roundWinningKillReplayVictim ) - player.SetViewIndex( attacker.GetIndexForEntity() ) - player.SetIsReplayRoundWinning( true ) - - if ( replayLength >= ROUND_WINNING_KILL_REPLAY_LENGTH_OF_REPLAY - 0.5 ) // only do fade if close to full length replay - { - // this doesn't work because fades don't work on players that are in a replay, unsure how official servers do this - wait replayLength - 2.0 - ScreenFadeToBlackForever( player, 2.0 ) + // this doesn't work because fades don't work on players that are in a replay, unsure how official servers do this + wait replayLength - 2.0 + ScreenFadeToBlackForever( player, 2.0 ) - wait 2.0 - } - else - wait replayLength - } - else - wait replayLength // this will just be extra delay if no replay - - player.SetPredictionEnabled( true ) - player.ClearReplayDelay() - player.ClearViewEntity() - player.UnfreezeControlsOnServer() + wait 2.0 } + else + wait replayLength + + player.SetPredictionEnabled( true ) + player.ClearReplayDelay() + player.ClearViewEntity() + player.UnfreezeControlsOnServer() } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_crashsite3.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_crashsite3.nut index 37b89169..f169d0c7 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_crashsite3.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_crashsite3.nut @@ -1 +1,7 @@ -//fuck
\ No newline at end of file +untyped +global function CodeCallback_MapInit + +void function CodeCallback_MapInit() +{ + ClassicMP_SetLevelIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() ) +}
\ 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 b6c8cfc2..3a46eba8 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut @@ -1,7 +1,45 @@ untyped global function CodeCallback_MapInit +struct { + bool introStartTime +} file + void function CodeCallback_MapInit() { + AddEvacNode( GetEnt( "evac_location1" ) ) + AddEvacNode( GetEnt( "evac_location2" ) ) + AddEvacNode( GetEnt( "evac_location3" ) ) + AddEvacNode( GetEnt( "evac_location4" ) ) + + SetEvacSpaceNode( GetEnt( "end_spacenode" ) ) + + // currently disabled: intro + // if ( !IsFFAGame() ) + // ClassicMP_SetLevelIntro( WargamesIntroSetup, 25.0 ) +} + +// intro stuff +void function WargamesIntroSetup() +{ + AddCallback_OnClientConnected( WargamesIntro_OnClientConnected ) + AddCallback_OnClientDisconnected( WargamesIntro_OnClientDisconnected ) + + AddCallback_GameStateEnter( eGameState.Prematch, OnPrematchStart ) +} + +void function WargamesIntro_OnClientConnected( entity player ) +{ +} + +void function WargamesIntro_OnClientDisconnected( entity player ) +{ + +} + +void function OnPrematchStart() +{ + ClassicMP_OnIntroStarted() + file.introStartTime = Time() }
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut index 94138561..18026f17 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut @@ -144,7 +144,7 @@ entity function FindSpawnPoint( entity player, bool isTitan, bool useStartSpawnp else spawnpoints = isTitan ? SpawnPoints_GetTitan() : SpawnPoints_GetPilot() - InitRatings( player, team ) + InitRatings( player, player.GetTeam() ) // don't think this is necessary since we call discardratings //foreach ( entity spawnpoint in spawnpoints ) |