node-insim
Version:
An InSim library for NodeJS with TypeScript support
84 lines (83 loc) • 2.99 kB
TypeScript
import { SendablePacket } from './base';
import { PacketType } from './enums';
import type { PacketDataWithRequiredReqI } from './types';
/**
* Replay Information Packet
*
* You can load a replay or set the position in a replay with an IS_RIP packet. Replay positions and lengths are
* specified in hundredths of a second. LFS will reply with another IS_RIP packet when the request is completed.
*
* You can request an IS_RIP packet at any time with this {@link IS_TINY}:
*
* - ReqI: non-zero (returned in the reply)
* - SubT: {@link TINY_RIP} (Replay Information Packet)
*/
export declare class IS_RIP extends SendablePacket {
readonly Size = 80;
readonly Type = PacketType.ISP_RIP;
/** Request: non-zero / reply: same value returned */
ReqI: number;
/** 0 or 1 = OK / for other values see {@link ReplayError} */
Error: ReplayError;
/** 0 = SPR / 1 = MPR */
MPR: ReplayMode;
/** Request: pause on arrival / reply: paused state */
Paused: number;
/**
* Various options.
*
* NOTE: {@link RIPOPT_FULL_PHYS} makes MPR searching much slower so should not normally be used. This flag was added
* to allow high accuracy {@link IS_MCI} packets to be output when fast forwarding.
* */
Options: ReplayOptions | 0;
private readonly Sp3;
/** (hundredths) request: destination / reply: position */
CTime: number;
/** (hundredths) request: zero / reply: replay length */
TTime: number;
/** Zero or replay name - last byte must be zero */
RName: string;
constructor(data?: IS_RIP_Data);
pack(): Uint8Array<ArrayBuffer>;
}
export type IS_RIP_Data = Omit<PacketDataWithRequiredReqI<IS_RIP>, 'Error' | 'TTime'>;
export declare enum ReplayError {
/** OK: completed instruction */
RIP_OK = 0,
/** OK: already at the destination */
RIP_ALREADY = 1,
/** Can't run a replay - dedicated host */
RIP_DEDICATED = 2,
/** Can't start a replay - not in a suitable mode */
RIP_WRONG_MODE = 3,
/** RName is zero but no replay is currently loaded */
RIP_NOT_REPLAY = 4,
/** {@link IS_RIP} corrupted (e.g. RName does not end with zero) */
RIP_CORRUPTED = 5,
/** The replay file was not found */
RIP_NOT_FOUND = 6,
/** Obsolete / future / corrupted */
RIP_UNLOADABLE = 7,
/** Destination is beyond replay length */
RIP_DEST_OOB = 8,
/** Unknown error found starting replay */
RIP_UNKNOWN = 9,
/** Replay search was terminated by user */
RIP_USER = 10,
/** Can't reach destination - SPR is out of sync */
RIP_OOS = 11
}
export declare enum ReplayMode {
/** Single player replay */
SPR = 0,
/** Multiplayer replay */
MPR = 1
}
export declare enum ReplayOptions {
/** Replay will loop if this bit is set */
RIPOPT_LOOP = 1,
/** Set this bit to download missing skins */
RIPOPT_SKINS = 2,
/** Use full physics when searching an MPR */
RIPOPT_FULL_PHYS = 4
}