diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-29 23:52:45 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-29 23:52:45 +0100 |
commit | 53194543e43f8a645ba83ddb464028ba0c3b9d70 (patch) | |
tree | bee4f045e4e0dba4ca07fef04e2600b2c897c3c1 | |
parent | 31c8a052e8f3cdccedb7f6f8d2bd11678189001a (diff) | |
download | NorthstarMods-53194543e43f8a645ba83ddb464028ba0c3b9d70.tar.gz NorthstarMods-53194543e43f8a645ba83ddb464028ba0c3b9d70.zip |
fix lts spawn bugs and some crashes
10 files changed, 71 insertions, 20 deletions
diff --git a/Northstar.CustomServers/scripts/vscripts/_powerup.gnut b/Northstar.CustomServers/scripts/vscripts/_powerup.gnut index 3a0ce273..a6a117af 100644 --- a/Northstar.CustomServers/scripts/vscripts/_powerup.gnut +++ b/Northstar.CustomServers/scripts/vscripts/_powerup.gnut @@ -45,16 +45,16 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) entity powerup = CreateEntity( "item_powerup" ) - // need to do this otherwise the position seems to mess up occasionally - powerup.SetOrigin( base.GetOrigin() ) - powerup.SetAngles( base.GetAngles() ) - powerup.SetParent( base ) // parenting ensures that gravity isn't an issue + powerup.SetOrigin( base.GetOrigin() + powerupDef.modelOffset ) + powerup.SetAngles( base.GetAngles() + powerupDef.modelAngles ) powerup.SetValueForModelKey( powerupDef.model ) DispatchSpawn( powerup ) - powerup.SetLocalOrigin( powerupDef.modelOffset ) - powerup.SetLocalAngles( powerupDef.modelAngles ) + // unless i'm doing something really dumb, this all has to be done after dispatchspawn to get the powerup to not have gravity + powerup.StopPhysics() + powerup.SetOrigin( base.GetOrigin() + powerupDef.modelOffset ) + powerup.SetAngles( base.GetAngles() + powerupDef.modelAngles ) powerup.SetModel( powerupDef.model ) powerup.s.powerupRef <- powerupDef.itemRef @@ -65,9 +65,7 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) OnThreadEnd( function() : ( powerup ) { if ( IsValid( powerup ) ) - { powerup.Destroy() - } }) powerup.WaitSignal( "OnDestroy" ) @@ -86,6 +84,7 @@ bool function OnPowerupCollected( entity player, entity healthpack ) if ( ( powerup.index == ePowerUps.titanTimeReduction || powerup.index == ePowerUps.LTS_TitanTimeReduction ) && PlayerHasBattery( player ) ) return false + // idk why the powerup.destroyFunc doesn't just return a bool? would mean they could just handle stuff like this in powerup code powerup.destroyFunc( player ) return true // destroys the powerup } diff --git a/Northstar.CustomServers/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index b5ad4fb1..a465164d 100644 --- a/Northstar.CustomServers/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -61,6 +61,7 @@ void function OnPlayerRespawned( entity player ) void function EarnMeterMP_PlayerLifeThink( entity player ) { player.EndSignal( "OnDeath" ) + player.EndSignal( "OnDestroy" ) int lastEarnMeterMode = PlayerEarnMeter_GetMode( player ) float lastPassiveGainTime = Time() diff --git a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut index b9d5aa49..89f9c991 100644 --- a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut +++ b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut @@ -21,6 +21,7 @@ void function GamemodeLts_Init() Riff_ForceSetSpawnAsTitan( eSpawnAsTitan.Always ) SetShouldUseRoundWinningKillReplay( true ) SetRoundWinningKillReplayKillClasses( true, true ) // both titan and pilot kills are tracked + FlagSet( "ForceStartSpawn" ) AddCallback_OnPilotBecomesTitan( RefreshThirtySecondWallhackHighlight ) AddCallback_OnTitanBecomesPilot( RefreshThirtySecondWallhackHighlight ) diff --git a/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut index 5a684f20..9d2ccc91 100644 --- a/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -423,7 +423,7 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) // do titanfall scoreevent AddPlayerScore( player, "Titanfall", player ) - entity camera = CreateTitanDropCamera( spawnpoint.GetAngles(), < 90, 10, 0 > ) + entity camera = CreateTitanDropCamera( spawnpoint.GetAngles(), < 90, titan.GetAngles().y, 0 > ) camera.SetParent( titan ) // calc offset for spawnpoint angle @@ -584,7 +584,7 @@ void function AddToTitanDamageStat( entity victim, var damageInfo ) float amount = DamageInfo_GetDamage( damageInfo ) if ( attacker.IsPlayer() && attacker != victim ) - attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, amount ) // titan damage on + attacker.AddToPlayerGameStat( file.titanDamageGameStat, amount ) // titan damage on } diff --git a/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut b/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut index d4712cf1..f6cedd4e 100644 --- a/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut +++ b/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut @@ -103,8 +103,8 @@ void function OnPrematchStart() // spawn dropships array<entity> dropshipSpawns = GetEntArrayByClass_Expensive( "info_spawnpoint_dropship_start" ) foreach ( entity dropshipSpawn in dropshipSpawns ) - { - if ( GameModeRemove( dropshipSpawn ) || ( GetSpawnpointGamemodeOverride() != GAMETYPE && dropshipSpawn.kv[ "gamemode_" + GetSpawnpointGamemodeOverride() ] == "0" ) ) + { + if ( GameModeRemove( dropshipSpawn ) || ( GetSpawnpointGamemodeOverride() != GAMETYPE && dropshipSpawn.HasKey( "gamemode_" + GetSpawnpointGamemodeOverride() ) && dropshipSpawn.kv[ "gamemode_" + GetSpawnpointGamemodeOverride() ] == "0" ) ) continue // todo: possibly make this only spawn dropships if we've got enough players to need them diff --git a/Northstar.CustomServers/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/scripts/vscripts/mp/_score.nut index 9f1e5978..c54bbf8d 100644 --- a/Northstar.CustomServers/scripts/vscripts/mp/_score.nut +++ b/Northstar.CustomServers/scripts/vscripts/mp/_score.nut @@ -31,7 +31,7 @@ void function AddPlayerScore( entity targetPlayer, string scoreEventName, entity { ScoreEvent event = GetScoreEvent( scoreEventName ) - if ( !event.enabled ) + if ( !event.enabled || !targetPlayer.IsPlayer() ) return var associatedHandle = 0 diff --git a/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_angel_city.nut b/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_angel_city.nut index 3a5b637f..68b49ad5 100644 --- a/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_angel_city.nut +++ b/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_angel_city.nut @@ -1,11 +1,27 @@ global function CodeCallback_MapInit void function CodeCallback_MapInit() -{ +{ Evac_AddLocation( < 2527.889893, -2865.360107, 753.002991 >, < 0, -80.54, 0 > ) Evac_AddLocation( < 1253.530029, -554.075012, 811.125 >, < 0, 180, 0 > ) Evac_AddLocation( < 2446.989990, 809.364014, 576.0 >, < 0, 90.253, 0 > ) Evac_AddLocation( < -2027.430054, 960.395020, 609.007996 >, < 0, 179.604, 0 > ) Evac_SetSpacePosition( < -1700, -5500, -7600 >, < -3.620642, 270.307129, 0 > ) + + // todo: also we need to change the powerup spawns on this map, they use a version from an older patch + + // there are some really busted titan startspawns that are on the fucking other side of the map from where they should be, so we remove them + AddSpawnCallback( "info_spawnpoint_titan_start", TrimBadTitanStartSpawns ) +} + +void function TrimBadTitanStartSpawns( entity spawn ) +{ + if ( spawn.GetTeam() == TEAM_MILITIA ) + return // mil spawns are fine on this map + + vector comparisonOrigin = < 2281.39, -3333.06, 200.031 > + + if ( Distance2D( spawn.GetOrigin(), comparisonOrigin ) >= 2000.0 ) + spawn.Destroy() }
\ No newline at end of file diff --git a/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_black_water_canal.nut b/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_black_water_canal.nut index 37b89169..2e35417f 100644 --- a/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_black_water_canal.nut +++ b/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_black_water_canal.nut @@ -1 +1,19 @@ -//fuck
\ No newline at end of file +global function CodeCallback_MapInit + +void function CodeCallback_MapInit() +{ + // there are some really busted titan startspawns that are on the fucking other side of the map from where they should be, so we remove them + AddSpawnCallback( "info_spawnpoint_titan_start", TrimBadTitanStartSpawns ) +} + +void function TrimBadTitanStartSpawns( entity spawn ) +{ + vector comparisonOrigin + if ( spawn.GetTeam() == TEAM_IMC ) + comparisonOrigin = < 160.625, 4748.13, -251.447 > + else + comparisonOrigin = < 1087.13, -4914.88, -199.969 > + + if ( Distance2D( spawn.GetOrigin(), comparisonOrigin ) >= 1000.0) + spawn.Destroy() +}
\ No newline at end of file diff --git a/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_grave.nut b/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_grave.nut index 37b89169..f4b48f6d 100644 --- a/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_grave.nut +++ b/Northstar.CustomServers/scripts/vscripts/mp/levels/mp_grave.nut @@ -1 +1,19 @@ -//fuck
\ No newline at end of file +global function CodeCallback_MapInit + +void function CodeCallback_MapInit() +{ + // there are some really busted titan startspawns that are on the fucking other side of the map from where they should be, so we remove them + AddSpawnCallback( "info_spawnpoint_titan_start", TrimBadTitanStartSpawns ) +} + +void function TrimBadTitanStartSpawns( entity spawn ) +{ + vector comparisonOrigin + if ( spawn.GetTeam() == TEAM_IMC ) + comparisonOrigin = < -2144, -4944, 1999.7 > + else + comparisonOrigin = < 11026.8, -5163.18, 1885.64 > + + if ( Distance2D( spawn.GetOrigin(), comparisonOrigin ) >= 2000.0 ) + spawn.Destroy() +}
\ No newline at end of file diff --git a/bobthebob.testing/scripts/vscripts/ui/menu_mode_select.nut b/bobthebob.testing/scripts/vscripts/ui/menu_mode_select.nut index 4e0ecef5..b6bd6d38 100644 --- a/bobthebob.testing/scripts/vscripts/ui/menu_mode_select.nut +++ b/bobthebob.testing/scripts/vscripts/ui/menu_mode_select.nut @@ -102,16 +102,14 @@ void function ModeButton_Click( var button ) if ( Hud_IsLocked( button ) ) return - int mapID = int( Hud_GetScriptID( button ) ) + ( file.currentModePage * MODES_PER_PAGE ) - - var menu = GetMenu( "MapsMenu" ) + int modeID = int( Hud_GetScriptID( button ) ) + ( file.currentModePage * MODES_PER_PAGE ) array<string> modesArray = GetPrivateMatchModes() string modeName = modesArray[mapID] // on modded servers set us to the first map for that mode automatically // need this for coliseum mainly which is literally impossible to select without this - if ( IsNorthstarServer() && !PrivateMatch_IsValidMapModeCombo( PrivateMatch_GetSelectedMap(), modesArray[ mapID ] ) ) + if ( IsNorthstarServer() && !PrivateMatch_IsValidMapModeCombo( PrivateMatch_GetSelectedMap(), modesArray[ modeID ] ) ) ClientCommand( "SetCustomMap " + GetPrivateMatchMapsForMode( modeName )[ 0 ] ) // set it |