diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp')
3 files changed, 34 insertions, 9 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut index 4f6a12914..d3b4cd7e7 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut @@ -64,25 +64,40 @@ void function OnPrematchStart() // make 2 empty dropship structs per team IntroDropship emptyDropship - file.militiaDropships = [ clone emptyDropship, clone emptyDropship ] - file.imcDropships = [ clone emptyDropship, clone emptyDropship ] + file.militiaDropships.clear() + file.imcDropships.clear() - // spawn dropships - foreach ( entity dropshipSpawn in GetEntArrayByClass_Expensive( "info_spawnpoint_dropship_start" ) ) - { + array<entity> validDropshipSpawns + array<entity> dropshipSpawns = GetEntArrayByClass_Expensive( "info_spawnpoint_dropship_start" ) + foreach ( entity dropshipSpawn in dropshipSpawns ) + { if ( dropshipSpawn.HasKey( "gamemode_" + GetSpawnpointGamemodeOverride() ) ) if ( dropshipSpawn.kv[ "gamemode_" + GetSpawnpointGamemodeOverride() ] == "0" ) continue + + validDropshipSpawns.append( dropshipSpawn ) + } + + // if no dropship spawns for this mode, just allow any dropship spawns + if ( validDropshipSpawns.len() < 2 ) + validDropshipSpawns = dropshipSpawns + // spawn dropships + foreach ( entity dropshipSpawn in validDropshipSpawns ) + { // todo: possibly make this only spawn dropships if we've got enough players to need them int createTeam = HasSwitchedSides() ? dropshipSpawn.GetTeam() : GetOtherTeam( dropshipSpawn.GetTeam() ) array<IntroDropship> teamDropships = createTeam == TEAM_MILITIA ? file.militiaDropships : file.imcDropships - int dropshipIndex = !IsValid( teamDropships[ 0 ].dropship ) ? 0 : 1 + if ( teamDropships.len() >= 2 ) + continue + // create entity entity dropship = CreateDropship( createTeam, dropshipSpawn.GetOrigin(), dropshipSpawn.GetAngles() ) - teamDropships[ dropshipIndex ].dropship = dropship + teamDropships.append( clone emptyDropship ) + teamDropships[ teamDropships.len() - 1 ].dropship = dropship + AddAnimEvent( dropship, "dropship_warpout", WarpoutEffect ) dropship.SetValueForModelKey( $"models/vehicle/crow_dropship/crow_dropship_hero.mdl" ) dropship.SetModel( $"models/vehicle/crow_dropship/crow_dropship_hero.mdl" ) @@ -110,6 +125,8 @@ void function EndIntroWhenFinished() void function SpawnPlayerIntoDropship( entity player ) { + player.EndSignal( "OnDestroy" ) + if ( IsAlive( player ) ) player.Die() // kill them so we don't have any issues respawning them later @@ -133,7 +150,6 @@ void function SpawnPlayerIntoDropship( entity player ) WaitFrame() player.EndSignal( "OnDeath" ) - player.EndSignal( "OnDestroy" ) // find the player's dropship and seat array<IntroDropship> teamDropships diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 2f16379e2..63ecbf684 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -183,6 +183,10 @@ void function GameStateEnter_Prematch() void function StartGameWithoutClassicMP() { + foreach ( entity player in GetPlayerArray() ) + if ( IsAlive( player ) ) + player.Die() + WaitFrame() // wait for callbacks to finish // need these otherwise game will complain diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_titan_transfer.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_titan_transfer.nut index 7b126cd0c..c84e6aba5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_titan_transfer.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_titan_transfer.nut @@ -178,7 +178,12 @@ void function GiveWeaponsFromStoredArray( entity player, array<StoredWeapon> sto UpdateProScreen( player, weapon ) } - string weaponCategory = GetWeaponInfoFileKeyField_GlobalString( weapon.GetWeaponClassName(), "menu_category" ) + string weaponCategory = "" + if ( IsWeaponKeyFieldDefined(weapon.GetWeaponClassName(), "menu_category") ) + { + weaponCategory = GetWeaponInfoFileKeyField_GlobalString( weapon.GetWeaponClassName(), "menu_category" ) + } + if ( weaponCategory == "at" || weaponCategory == "special" ) // refill AT/grenadier ammo stockpile { int defaultTotal = weapon.GetWeaponSettingInt( eWeaponVar.ammo_default_total ) |