Constructs a representation of the demo file from a byte array. Immediately after being constructed, the object will contain only the header. For accessing other data, use events.
Buffer containing demo file data.
Optionalevents: {Event handlers. Aside from onFinish, each of these
may be asynchronous. If that's the case, demo parsing is paused until
the returned promise is resolved.
Event handlers must return a boolean. If it's true, demo parsing
continues. If it's false, parsing stops and onFinish is called
with success = false.
Available events:
File header, should be HL2DEMO. However, the parser never verifies this.
Demo file protocol, should be 4 for Portal 2.
Network protocol, should be 2001 for Portal 2.
The game server's address (and port). For a local game, should be localhost:27015.
Connecting client's username.
Name of the map file, with the extension and path omitted. For example, Triple Laser would be sp_a2_triple_laser.
Name of the "mod folder" for this game, should be portal2.
Duration in seconds. Not exact, often deviates from speedrun timers.
Duration in ticks. Not exact, often deviates from speedrun timers.
Seems to be an alternateticks-aware tick count, i.e. roughly half of playbackTicks for single player.
Size of sign on data in bytes.
Array of messages found in the demo, in order of appearance.
User-facing interface for the current state of the demo.
User-friendly interface for the current state of the demo.
Current server tick. Reports only even numbers on single player games due to sv_alternateticks.
List of Message.CmdInfo objects, one for each player. "players" might be a bit of a misnomer, as what this really tracks is the camera that the demo follows.
The primary entity interface. Holds all entities available on the current tick, as well as methods for querying them. See Entity.Entities for more information.
Internal bitstream buffer, seeked as the demo is parsed.
List of raw SendTables/DataTables found in the demo, indexed by table name.
List of server-side classes reported by the demo.
String table data, mainly from the StringTables message.
Reconstructed server classes with properties.
Entity baselines, i.e. the "default" properties of each entity class.
Represents a parsed Portal 2 demo. Manages state and data storage.