/** * @module net/packets/outgoing */ import { Writer } from '../../writer'; import { Reader } from '../../reader'; import { PacketType } from '../../packet-type'; import { Packet } from '../../packet'; /** * Sent when a non-destructable object, such as a tree, has been hit by a player. */ export class OtherHitPacket implements Packet { type = PacketType.OTHERHIT; propagate = true; //#region packet-specific members /** * The current client time. */ time: number; /** * The id of the bullet which hit the object. */ bulletId: number; /** * The object id of player who fired the projectile which hit the object. */ objectId: number; /** * The object id of the object which was hit. */ targetId: number; //#endregion write(writer: Writer): void { writer.writeInt32(this.time); writer.writeByte(this.bulletId); writer.writeInt32(this.objectId); writer.writeInt32(this.targetId); } read(reader: Reader): void { this.time = reader.readInt32(); this.bulletId = reader.readByte(); this.objectId = reader.readInt32(); this.targetId = reader.readInt32(); } }