mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
index sendTables by name
This commit is contained in:
parent
afa0451a66
commit
c4969d23ff
1 changed files with 6 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ export class Match {
|
||||||
players: Player[];
|
players: Player[];
|
||||||
playerMap: {[entityId: number]: Player};
|
playerMap: {[entityId: number]: Player};
|
||||||
entityClasses: {[entityId: string]: ServerClass};
|
entityClasses: {[entityId: string]: ServerClass};
|
||||||
|
sendTableMap: {[name: string]: SendTable};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.tick = 0;
|
this.tick = 0;
|
||||||
|
|
@ -55,11 +56,16 @@ export class Match {
|
||||||
boundaryMax: {x: 0, y: 0, z: 0}
|
boundaryMax: {x: 0, y: 0, z: 0}
|
||||||
};
|
};
|
||||||
this.entityClasses = {};
|
this.entityClasses = {};
|
||||||
|
this.sendTableMap = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
getSendTable(name) {
|
getSendTable(name) {
|
||||||
|
if (this.sendTableMap[name]) {
|
||||||
|
return this.sendTableMap[name];
|
||||||
|
}
|
||||||
for (const table of this.sendTables) {
|
for (const table of this.sendTables) {
|
||||||
if (table.name === name) {
|
if (table.name === name) {
|
||||||
|
this.sendTableMap[name] = table;
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue