Add some comments
This commit is contained in:
parent
eb3a268d58
commit
3c1091e2b2
1 changed files with 12 additions and 2 deletions
14
timer.nut
14
timer.nut
|
@ -287,6 +287,7 @@ class Timer
|
|||
{
|
||||
local entindex = ply.entindex();
|
||||
|
||||
// Dead or spectator?
|
||||
if (!ply.IsAlive() ||
|
||||
(ply.GetTeam() != Constants.ETFTeam.TF_TEAM_RED &&
|
||||
ply.GetTeam() != Constants.ETFTeam.TF_TEAM_BLUE)
|
||||
|
@ -299,6 +300,7 @@ class Timer
|
|||
continue;
|
||||
}
|
||||
|
||||
// New player to track?
|
||||
if (!(entindex in this.players))
|
||||
{
|
||||
this.players[entindex] <- PlayerState();
|
||||
|
@ -311,9 +313,10 @@ class Timer
|
|||
|
||||
local prev_zone_index = this.players[entindex].prev_zone_index;
|
||||
local start_time = this.players[entindex].start_time;
|
||||
|
||||
if (prev_zone_index < 0)
|
||||
{
|
||||
// Not yet in start zone, only check the first.
|
||||
// Not yet in start zone, only check if we are entering it.
|
||||
if (this.zones[0].Clips(ply))
|
||||
{
|
||||
this.players[entindex].prev_zone_index = 0;
|
||||
|
@ -345,7 +348,8 @@ class Timer
|
|||
continue;
|
||||
}
|
||||
|
||||
// Check if entering the next zone.
|
||||
// Check if entering any later zone.
|
||||
// We allow skipping zones on purpose here.
|
||||
for (local i = prev_zone_index + 1; i < this.zones.len(); i++)
|
||||
{
|
||||
if (this.zones[i].Clips(ply))
|
||||
|
@ -385,6 +389,8 @@ class Timer
|
|||
// Commands
|
||||
// --------------------------------
|
||||
|
||||
// Build a new zone!
|
||||
// You should call this 3 times to pick the bounds.
|
||||
::CreateZone <- function()
|
||||
{
|
||||
if ("zone_builder" in getroottable())
|
||||
|
@ -398,6 +404,7 @@ class Timer
|
|||
}
|
||||
}
|
||||
|
||||
// Draw all created zones.
|
||||
::DrawZones <- function()
|
||||
{
|
||||
if ("cool_timer" in getroottable())
|
||||
|
@ -409,6 +416,7 @@ class Timer
|
|||
}
|
||||
}
|
||||
|
||||
// Remove the last zone.
|
||||
::RemoveZone <- function()
|
||||
{
|
||||
if ("cool_timer" in getroottable())
|
||||
|
@ -417,6 +425,7 @@ class Timer
|
|||
}
|
||||
}
|
||||
|
||||
// Remove all the zones.
|
||||
::ClearZones <- function()
|
||||
{
|
||||
if ("cool_timer" in getroottable())
|
||||
|
@ -425,6 +434,7 @@ class Timer
|
|||
}
|
||||
}
|
||||
|
||||
// Debug print zone bounds to console.
|
||||
::DumpZones <- function()
|
||||
{
|
||||
if ("cool_timer" in getroottable())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue