Module for controlling the Assault Course and Quad Bike timers in gym levels.
trx.assault.active_track (trx.assault.Track). The track Lara is currently running, or nil if none. (read-only)A timed gym track.
trx.assault.Track.QUAD = 0trx.assault.Track.COURSE = 1Where a time sits in the table of best times, fastest first. Counted from 1.
Which attempt at a track it was, counted in the order they were made. Counted from 1.
One of a track's best times.
Properties:
attempt_num: trx.assault.AttemptNum.time: trx.game.Seconds. The time it took.trx.assault.stats
A track's record table, as shown on the stats screen. Each track keeps its own. The records are stored in the player's profile, so writing to them outlives the level, and they can be read outside a gym level.
trx.assault.start([track])
Starts the timer and clears its state. Raises outside a gym level.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).trx.assault.stop([track])
Stops the timer, leaving it on screen. Raises outside a gym level.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).trx.assault.finish([track])
Stops the timer as completing the track does, rather than as an abort. Raises outside a gym level.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).trx.assault.reset([track])
Stops the timer and clears its state. Raises outside a gym level.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).trx.assault.is_running([track])
Whether the timer is counting. False outside a gym level.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: boolean. True from the start of a run until it is finished or stopped.
trx.assault.is_visible([track])
Whether the timer is shown on screen. It stays visible after trx.assault.stop.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: boolean. True while the timer is drawn, counting or not.
trx.assault.get_time()
How long the current run has taken.
This is the level clock, which is what a gym level times its tracks with, so it takes no track.
Returns: trx.game.Frames. The time on the clock, counting up while the timer runs.
trx.assault.get_best_time([track])
The fastest time the track has on record.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: trx.game.Frames. The best time, or 0 where the track has none.
trx.assault.get_penalty([track])
The penalty the run has taken for missed pads.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: trx.game.Frames. The penalty, added to the time when the run is filed.
trx.assault.get_target_penalty([track])
The penalty the run has taken for missed targets.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: trx.game.Frames. The penalty, added to the time when the run is filed.
trx.assault.get_penalty_timer([track])
How much longer a penalty stays on screen.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: trx.game.Frames. The time left, and 0 where no penalty is shown.
trx.assault.get_lap_time([track])
How long the last lap took.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: trx.game.Frames. The lap time, and 0 before a lap is finished.
trx.assault.get_lap_timer([track])
How much longer the lap times stay on screen.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: trx.game.Frames. The time left, and 0 where no lap time is shown.
trx.assault.stats.add_record(time, [track])
Files a new record, inserting it in time order and bumping the attempt count.
Parameters:
time (trx.game.Seconds). Must be greater than zero.track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: boolean. false if the table is full and the time is slower than every record in it.
Example:
trx.assault.stats.add_record(30.0)
trx.assault.stats.remove_record(record_num, [track])
Removes a record, closing the gap behind it.
Parameters:
record_num (trx.assault.RecordNum).track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: boolean. false if there is no record at that position.
trx.assault.stats.list_records([track])
The records, fastest first.
Parameters:
track (trx.assault.Track, optional, default trx.assault.Track.COURSE).Returns: a list of trx.assault.Record.
Example:
for _, record in ipairs(trx.assault.stats.list_records(trx.assault.Track.QUAD)) do
trx.log.info(("attempt %d: %.2fs"):format(record.attempt_num, record.time))
end