mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
saved delay for tempentities
This commit is contained in:
parent
2e43f5bb7f
commit
f88c919a8e
2 changed files with 8 additions and 6 deletions
|
|
@ -18,6 +18,7 @@ export class PacketEntity {
|
||||||
public inPVS: boolean;
|
public inPVS: boolean;
|
||||||
public pvs: PVS;
|
public pvs: PVS;
|
||||||
public serialNumber?: number;
|
public serialNumber?: number;
|
||||||
|
public delay?: number;
|
||||||
|
|
||||||
constructor(serverClass: ServerClass, entityIndex: number, pvs: PVS) {
|
constructor(serverClass: ServerClass, entityIndex: number, pvs: PVS) {
|
||||||
this.serverClass = serverClass;
|
this.serverClass = serverClass;
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,23 @@ import {applyEntityUpdate} from '../EntityDecoder';
|
||||||
|
|
||||||
export function ParseTempEntities(stream: BitStream, match: Match, skip: boolean = false): TempEntitiesPacket { // 10: classInfo
|
export function ParseTempEntities(stream: BitStream, match: Match, skip: boolean = false): TempEntitiesPacket { // 10: classInfo
|
||||||
const entityCount = stream.readBits(8);
|
const entityCount = stream.readBits(8);
|
||||||
const length = readVarInt(stream);
|
const length = readVarInt(stream);
|
||||||
const end = stream.index + length;
|
const end = stream.index + length;
|
||||||
|
|
||||||
let entity: PacketEntity|null = null;
|
let entity: PacketEntity | null = null;
|
||||||
const entities: PacketEntity[] = [];
|
const entities: PacketEntity[] = [];
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
for (let i = 0; i < entityCount; i++) {
|
for (let i = 0; i < entityCount; i++) {
|
||||||
const delay = (stream.readBoolean()) ? stream.readUint8() / 100 : 0; // unused it seems
|
const delay = (stream.readBoolean()) ? stream.readUint8() / 100 : 0; // unused it seems
|
||||||
if (stream.readBoolean()) {
|
if (stream.readBoolean()) {
|
||||||
const classId = stream.readBits(match.classBits);
|
const classId = stream.readBits(match.classBits);
|
||||||
const serverClass = match.serverClasses[classId - 1];
|
const serverClass = match.serverClasses[classId - 1];
|
||||||
// no clue why the -1 but it works
|
// no clue why the -1 but it works
|
||||||
// maybe because world (id=0) can never be temp
|
// maybe because world (id=0) can never be temp
|
||||||
// but it's not like the -1 saves any space
|
// but it's not like the -1 saves any space
|
||||||
const sendTable = match.getSendTable(serverClass.dataTable);
|
const sendTable = match.getSendTable(serverClass.dataTable);
|
||||||
entity = new PacketEntity(serverClass, 0, PVS.ENTER);
|
entity = new PacketEntity(serverClass, 0, PVS.ENTER);
|
||||||
|
entity.delay = delay;
|
||||||
applyEntityUpdate(entity, sendTable, stream);
|
applyEntityUpdate(entity, sendTable, stream);
|
||||||
entities.push(entity);
|
entities.push(entity);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue