Back to TPG

TPG.Rush.MaxStages

S🏷️ Rush

Part of TPG namespace

TPG.Rush.MaxStages()
View on GitHub|gamemode/objectives/sv_rush.lua:87-94
📋 Has LDoc👁️ 0 viewsUpdated 1 month ago

Description

How many stages fit inside the round's time budget. A stage costs, worst case, rushStageTimeLimit of nobody managing to take the point plus rushHoldTime of somebody finally doing it -- the abandon limit is only checked while the point is neutral (see Think), so a team that flips it on the last second still gets its full hold. Between stages sits a rushStageBreak, and there are one fewer breaks than stages because the last stage ends the round rather than leading anywhere. So the budget has to cover n * stageCost + (n - 1) * break, and the largest n that fits is the floor of (budget + break) / (stageCost + break). At the shipped numbers -- 300s limit, 60s hold, 300s break, 1800s budget -- that is 3 stages and a worst case of 28 minutes. Never returns less than 1. A budget too small for even one stage is a misconfiguration, and a Rush round with zero stages is not a shorter round, it is a round that cannot be played at all.

Parameters

No parameters.

Returns

TypeDescription
numberStage count, at least 1.

Examples

No examples available.

Used In

No usages found in the codebase.