classicborne
    Preparing search index...

    Class ChangeRecord

    Represents a change record for a level.

    Index

    Constructors

    • Creates a new ChangeRecord instance.

      Parameters

      • path: string

        The path to the change record file.

      • loadedCallback: Function = ...

        The callback function to call when file handles are opened.

      • options: any = {}

        Options for the change record.

      Returns ChangeRecord

    Properties

    actionCount: number
    bounds: number[]
    currentActionCount: number
    currentBuffer: SmartBuffer
    dirty: boolean
    draining: boolean
    keyframeRecord: KeyframeRecord
    path: string
    vhsFh: any
    lagKeyframeTime: number = 250

    Yet to be documented.

    Methods

    • Appends a block change to the change record.

      Parameters

      • position: Vector3

        The position of the block change.

      • block: number

        The block type.

      Returns void

    • Append an action to the change record.

      Parameters

      • isCommand: boolean = false

        Whether the action is a command.

      • actionBytes: number[]

        The action bytes to append.

      • commandString: string

        The command string (if applicable).

      Returns void

    • Trims the VHS file to the specified action count, discarding any actions beyond that count.

      Parameters

      • toActionCount: number

        The action count to trim to.

      • level: any

      Returns Promise<number>

    • Flush changes to disk by compressing current buffer and append it to the VHS file.

      Returns Promise<number>

      The length of the flushed buffer.

    • Restore block changes to a level.

      Parameters

      • level: Level

        The level to restore changes to.

      • OptionalmaxActions: number

        The maximum number of actions to restore.

      • Optionalstaller: Function

        The function to call to stall the restore process. Also prevents creating keyframes.

      Returns Promise<number>

      The total number of actions restored.