From 9a6295ca02702fa8eb3fa8a698f09129550f2fdd Mon Sep 17 00:00:00 2001 From: Zanieon Date: Sun, 24 Nov 2024 20:02:09 -0300 Subject: [PATCH] Add custom OOB timer per level scope --- .../mod/scripts/vscripts/mp/_base_gametype.gnut | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut index 362407b39..7283f318b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut @@ -36,6 +36,7 @@ function BaseGametype_Init() level.titanAlwaysAvailableForTeam <- [ 0, 0, 0, 0 ] level.missingPlayersTimeout <- null + level.customOOBTimer <- 0.0 CreateTeamColorControlPoints() @@ -1792,10 +1793,14 @@ void function EntityOutOfBounds( entity trigger, entity ent, entity caller, var //printt( "Valid Out OfBounds Entity, EntityOutOfBounds" ) + float overridenOOBTimer = expect float( level.customOOBTimer ) if ( !(ent in file.outOfBoundsTable) ) //Note that we never remove the ent from the table after adding it { OutOfBoundsDataStruct initialDataStruct initialDataStruct.timeBackInBound = max( 0, Time() - OUT_OF_BOUNDS_DECAY_TIME ) + + if( overridenOOBTimer > 0.0 ) + initialDataStruct.timeLeftBeforeDyingFromOutOfBounds = overridenOOBTimer ManageAddEntToOutOfBoundsTable( ent, initialDataStruct ) } @@ -1813,6 +1818,12 @@ void function EntityOutOfBounds( entity trigger, entity ent, entity caller, var float outOfBoundsTimeRegained = decayTime * ( OUT_OF_BOUNDS_TIME_LIMIT / OUT_OF_BOUNDS_DECAY_TIME ) float deadTime = clamp( dataStruct.timeLeftBeforeDyingFromOutOfBounds + outOfBoundsTimeRegained, 0.0, OUT_OF_BOUNDS_TIME_LIMIT ) + if( overridenOOBTimer > 0.0 ) + { + outOfBoundsTimeRegained = decayTime * ( overridenOOBTimer / OUT_OF_BOUNDS_DECAY_TIME ) + deadTime = clamp( dataStruct.timeLeftBeforeDyingFromOutOfBounds + outOfBoundsTimeRegained, 0.0, overridenOOBTimer ) + } + //printt( "Decay Time: " + decayTime + ", outOfBoundsTimeRegained:" + outOfBoundsTimeRegained + ", timeLeftBeforeDyingFromOutOfBounds: " + dataStruct.timeLeftBeforeDyingFromOutOfBounds + ", deadTime: " + deadTime ) dataStruct.timeLeftBeforeDyingFromOutOfBounds = deadTime