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