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: {
affinity: 'uint8',
},
from: 'string',
from: 'uint32',
isDamage: 'bool',
},
];

View File

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

View File

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

View File

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