1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

only apply updates for entities from the current packet

This commit is contained in:
Robin Appelman 2017-02-13 18:55:26 +01:00
commit 7cb74d93de
8 changed files with 46 additions and 50 deletions

View file

@ -1,4 +1,4 @@
import {Entity} from "./Entity";
import {PacketEntity} from "./PacketEntity";
import {ServerClass} from "./ServerClass";
import {SendTable} from "./SendTable";
import {StringTable} from "./StringTable";
@ -22,7 +22,7 @@ export class Match {
rounds: any[];
startTick: number;
intervalPerTick: number;
entities: (Entity|null)[];
packetEntities: (PacketEntity|null)[];
stringTables: StringTable[];
serverClasses: ServerClass[];
sendTables: SendTable[];
@ -41,11 +41,11 @@ export class Match {
this.rounds = [];
this.startTick = 0;
this.intervalPerTick = 0;
this.entities = [];
this.packetEntities = [];
this.stringTables = [];
this.sendTables = [];
this.serverClasses = [];
this.entities = [];
this.packetEntities = [];
this.instanceBaselines = [[], []];
this.staticBaseLines = [];
this.eventDefinitions = {};
@ -147,7 +147,7 @@ export class Match {
return this.users[userId];
}
getUserInfoForEntity(entity: Entity): UserInfo {
getUserInfoForEntity(entity: PacketEntity): UserInfo {
for (const id of Object.keys(this.users)) {
const user = this.users[id];
if (user && user.entityId === entity.entityIndex) {

View file

@ -1,7 +1,7 @@
import {StringTable} from "./StringTable";
import {Vector} from "./Vector";
import {GameEvent} from "./GameEvent";
import {Entity} from "./Entity";
import {PacketEntity} from "./PacketEntity";
export interface StringTablePacket {
packetType: 'stringTable';
@ -46,6 +46,7 @@ export interface GameEventListPacket {
export interface PacketEntitiesPacket {
packetType: 'packetEntities';
entities: PacketEntity[];
}
export interface ParseSoundsPacket {
@ -62,7 +63,7 @@ export interface SetConVarPacket {
export interface TempEntitiesPacket {
packetType: 'tempEntities';
entities: Entity[];
entities: PacketEntity[];
}
export interface SayText2Packet {

View file

@ -2,7 +2,7 @@ import {ServerClass} from "./ServerClass";
import {SendTable} from "./SendTable";
import {SendProp} from "./SendProp";
import {SendPropDefinition} from "./SendPropDefinition";
export class Entity {
export class PacketEntity {
serverClass: ServerClass;
sendTable: SendTable;
entityIndex: number;