diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/gamemodes')
3 files changed, 42 insertions, 10 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index 4c9f61d5..41f5fedb 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -34,7 +34,10 @@ void function GamemodeCP_Init() void function RateSpawnpoints_CP( int checkClass, array<entity> spawnpoints, int team, entity player ) { + // check hardpoints + array<entity> startSpawns = SpawnPoints_GetPilotStart( team ) + array<entity> enemyStartSpawns = SpawnPoints_GetPilotStart( GetOtherTeam( team ) ) } void function SpawnHardpoints() diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut index 09caa48d..4a756c02 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut @@ -40,6 +40,8 @@ void function CaptureTheFlag_Init() AddCallback_OnPlayerKilled( OnPlayerKilled ) AddCallback_OnPilotBecomesTitan( DropFlagForBecomingTitan ) + AddSpawnpointValidationRule( VerifyCTFSpawnpoint ) + RegisterSignal( "FlagReturnEnded" ) RegisterSignal( "ResetDropTimeout" ) @@ -128,6 +130,32 @@ void function RateSpawnpoints_CTF( int checkClass, array<entity> spawnpoints, in } } +bool function VerifyCTFSpawnpoint( entity spawnpoint, int team ) +{ + // ensure spawnpoints aren't too close to enemy base + + if ( HasSwitchedSides() && spawnpoint.GetTeam() >= 2 ) + team = GetOtherTeam( team ) + + array<entity> startSpawns = SpawnPoints_GetPilotStart( team ) + array<entity> enemyStartSpawns = SpawnPoints_GetPilotStart( GetOtherTeam( team ) ) + + vector averageFriendlySpawns + vector averageEnemySpawns + + foreach ( entity spawn in startSpawns ) + averageFriendlySpawns += spawn.GetOrigin() + + averageFriendlySpawns /= startSpawns.len() + + foreach ( entity spawn in enemyStartSpawns ) + averageEnemySpawns += spawn.GetOrigin() + + averageEnemySpawns /= startSpawns.len() + + return Distance2D( spawnpoint.GetOrigin(), averageEnemySpawns ) / Distance2D( averageFriendlySpawns, averageEnemySpawns ) > 0.35 +} + void function CTFInitPlayer( entity player ) { if ( !IsValid( file.imcFlagSpawn ) ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_riff_floor_is_lava.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_riff_floor_is_lava.nut index f8aa7799..99f51396 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_riff_floor_is_lava.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_riff_floor_is_lava.nut @@ -1,16 +1,17 @@ global function RiffFloorIsLava_Init -struct { - float pilotDamageMultiplier - float titanDamageMultiplier -} file - void function RiffFloorIsLava_Init() { AddCallback_OnPlayerRespawned( FloorIsLava_PlayerRespawned ) AddSpawnCallback( "env_fog_controller", InitLavaFogController ) AddCallback_EntitiesDidLoad( CreateCustomSpawns ) + AddSpawnpointValidationRule( VerifyFloorIsLavaSpawnpoint ) +} + +bool function VerifyFloorIsLavaSpawnpoint( entity spawnpoint, int team ) +{ + return spawnpoint.GetOrigin().z > GetLethalFogTop() } void function InitLavaFogController( entity fogController ) @@ -98,14 +99,14 @@ void function FloorIsLava_ThinkForPlayer( entity player ) if ( height < GetLethalFogTop() ) { // do damage - float damageMultiplier = 0.08 + float damageMultiplier if ( player.IsTitan() ) - damageMultiplier = 0.04 + damageMultiplier = 0.0025 + else + damageMultiplier = 0.05 // scale damage by time spent in fog and depth - damageMultiplier *= 1 - ( height / GetLethalFogTop() ) - - player.TakeDamage( player.GetMaxHealth() * damageMultiplier, null, null, { damageSourceId = eDamageSourceId.floor_is_lava } ) + player.TakeDamage( player.GetMaxHealth() * GraphCapped( ( GetLethalFogTop() - height ) / ( GetLethalFogTop() - GetLethalFogBottom() ), 0.0, 1.0, 0.2, 1.0 ) * damageMultiplier, null, null, { damageSourceId = eDamageSourceId.floor_is_lava } ) wait 0.1 } |