Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom OOB timer per level scope #907

Merged
merged 4 commits into from
Jan 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function BaseGametype_Init()
level.titanAlwaysAvailableForTeam <- [ 0, 0, 0, 0 ]

level.missingPlayersTimeout <- null
level.customOOBTimer <- 0.0

CreateTeamColorControlPoints()

Expand Down Expand Up @@ -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 )
}
Expand All @@ -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
Expand Down
Loading