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.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