Assault course module

Module for controlling the Assault Course and Quad Bike timers in gym levels.

Properties

  • trx.assault.active_track (trx.assault.Track). The track Lara is currently running, or nil if none. (read-only)

Enums

  • trx.assault.Track

    A timed gym track.

    • trx.assault.Track.QUAD = 0
      The quad bike circuit.
    • trx.assault.Track.COURSE = 1
      Lara's assault course.

Structures

  • trx.assault.RecordNum

    Where a time sits in the table of best times, fastest first. Counted from 1.

  • trx.assault.AttemptNum

    Which attempt at a track it was, counted in the order they were made. Counted from 1.

  • trx.assault.Record

    One of a track's best times.

    Properties:

Functions

  • 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:

  • trx.assault.stop([track])
    Stops the timer, leaving it on screen. Raises outside a gym level.

    Parameters:

  • trx.assault.finish([track])
    Stops the timer as completing the track does, rather than as an abort. Raises outside a gym level.

    Parameters:

  • trx.assault.reset([track])
    Stops the timer and clears its state. Raises outside a gym level.

    Parameters:

  • trx.assault.is_running([track])
    Whether the timer is counting. False outside a gym level.

    Parameters:

    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:

    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:

    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:

    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:

    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:

    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:

    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:

    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:

    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:

    Returns: boolean. false if there is no record at that position.

  • trx.assault.stats.list_records([track])
    The records, fastest first.

    Parameters:

    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