mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
cache entity baseline
This commit is contained in:
parent
5fcbbe540e
commit
255602d1e2
6 changed files with 33 additions and 43 deletions
|
|
@ -27,7 +27,6 @@ export class Match {
|
|||
stringTables: StringTable[];
|
||||
serverClasses: ServerClass[];
|
||||
sendTables: SendTable[];
|
||||
instanceBaselines: SendProp[][][];
|
||||
staticBaseLines: BitStream[];
|
||||
eventDefinitions: GameEventDefinitionMap;
|
||||
world: World;
|
||||
|
|
@ -47,7 +46,6 @@ export class Match {
|
|||
this.stringTables = [];
|
||||
this.sendTables = [];
|
||||
this.serverClasses = [];
|
||||
this.instanceBaselines = [[], []];
|
||||
this.staticBaseLines = [];
|
||||
this.eventDefinitions = {};
|
||||
this.players = [];
|
||||
|
|
|
|||
|
|
@ -16,15 +16,13 @@ export class PacketEntity {
|
|||
entityIndex: number;
|
||||
props: SendProp[];
|
||||
inPVS: boolean;
|
||||
updatedProps: SendProp[];
|
||||
|
||||
constructor(serverClass: ServerClass, entityIndex: number, pvs: PVS) {
|
||||
this.serverClass = serverClass;
|
||||
this.entityIndex = entityIndex;
|
||||
this.props = [];
|
||||
this.inPVS = false;
|
||||
this.updatedProps = [];
|
||||
this.pvs = pvs;
|
||||
this.serverClass = serverClass;
|
||||
this.entityIndex = entityIndex;
|
||||
this.props = [];
|
||||
this.inPVS = false;
|
||||
this.pvs = pvs;
|
||||
}
|
||||
|
||||
getPropByDefinition(definition: SendPropDefinition) {
|
||||
|
|
@ -44,5 +42,13 @@ export class PacketEntity {
|
|||
}
|
||||
throw new Error('Property not found in entity');
|
||||
}
|
||||
|
||||
clone(): PacketEntity {
|
||||
const result = new PacketEntity(this.serverClass, this.entityIndex, this.pvs);
|
||||
for (const prop of this.props) {
|
||||
result.props.push(prop.clone());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export class SendProp {
|
|||
|
||||
clone():SendProp {
|
||||
const prop = new SendProp(this.definition);
|
||||
prop.value = clone(this.value);
|
||||
prop.value = clone(this.value, false);
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue