perf: numeric IDs

This commit is contained in:
cha0s 2019-05-16 18:20:54 -05:00
parent 042034d5d8
commit e06b3d5089
4 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ export class DamagePacket extends EntityPacket {
damageSpec: { damageSpec: {
affinity: 'uint8', affinity: 'uint8',
}, },
from: 'string', from: 'uint32',
isDamage: 'bool', isDamage: 'bool',
}, },
]; ];

View File

@ -205,7 +205,7 @@ export class Vulnerable extends Trait {
isDamage, isDamage,
amount, amount,
damageSpec, damageSpec,
from: entity.instanceUuid, from: entity.numericUid,
}; };
this.entity.emit('tookDamage', damage); this.entity.emit('tookDamage', damage);
} }

View File

@ -5,7 +5,7 @@ export class SelfEntityPacket extends Packet {
static get schema() { static get schema() {
return { return {
...super.schema, ...super.schema,
data: 'string', data: 'uint32',
}; };
} }

View File

@ -59,7 +59,7 @@ export default class Game {
this.room.addEntityToLayer(entity, 0); this.room.addEntityToLayer(entity, 0);
// Initial information. // Initial information.
const packets = this.synchronizer.packetsForUpdate(true); const packets = this.synchronizer.packetsForUpdate(true);
packets.unshift(new SelfEntityPacket(entity.instanceUuid)); packets.unshift(new SelfEntityPacket(entity.numericUid));
entity.inform(packets); entity.inform(packets);
// Listen for events. // Listen for events.
socket.on('packet', this.createPacketListener(socket)); socket.on('packet', this.createPacketListener(socket));