diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-17 21:53:06 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-17 21:53:06 +0000 |
commit | 7cac56cb9bcaabed9562a7b46718f5c5de3400b8 (patch) | |
tree | 5602ee1282509d028d8e4a76bd035cc2996b9f33 /Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut | |
parent | 06924c215dcf8d4dd425cbbf178509bc222c2f7d (diff) | |
download | NorthstarMods-7cac56cb9bcaabed9562a7b46718f5c5de3400b8.tar.gz NorthstarMods-7cac56cb9bcaabed9562a7b46718f5c5de3400b8.zip |
wargames intro and many fixes
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index 41f5fedbf..4ea25fa7a 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -34,10 +34,46 @@ void function GamemodeCP_Init() void function RateSpawnpoints_CP( int checkClass, array<entity> spawnpoints, int team, entity player ) { - // check hardpoints + if ( HasSwitchedSides() ) + team = GetOtherTeam( team ) + // check hardpoints, determine which ones we own array<entity> startSpawns = SpawnPoints_GetPilotStart( team ) - array<entity> enemyStartSpawns = SpawnPoints_GetPilotStart( GetOtherTeam( team ) ) + vector averageFriendlySpawns + + // average out startspawn positions + foreach ( entity spawnpoint in startSpawns ) + averageFriendlySpawns += spawnpoint.GetOrigin() + + averageFriendlySpawns /= startSpawns.len() + + entity friendlyHardpoint // determine our furthest out hardpoint + foreach ( entity hardpoint in HARDPOINTS ) + { + if ( hardpoint.GetTeam() == player.GetTeam() && GetGlobalNetFloat( "objective" + hardpoint.kv.hardpointGroup + "Progress" ) >= 0.95 ) + { + if ( IsValid( friendlyHardpoint ) ) + { + if ( Distance2D( averageFriendlySpawns, hardpoint.GetOrigin() ) > Distance2D( averageFriendlySpawns, friendlyHardpoint.GetOrigin() ) ) + friendlyHardpoint = hardpoint + } + else + friendlyHardpoint = hardpoint + } + } + + vector ratingPos + if ( IsValid( friendlyHardpoint ) ) + ratingPos = friendlyHardpoint.GetOrigin() + else + ratingPos = averageFriendlySpawns + + foreach ( entity spawnpoint in spawnpoints ) + { + // idk about magic number here really + float rating = 1.0 - ( Distance2D( spawnpoint.GetOrigin(), ratingPos ) / 1000.0 ) + spawnpoint.CalculateRating( checkClass, player.GetTeam(), rating, rating ) + } } void function SpawnHardpoints() |