Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
fix: 99 damage taken bug
Browse files Browse the repository at this point in the history
  • Loading branch information
leia-uwu committed Oct 9, 2024
1 parent cbd0023 commit 4a60020
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions shared/net/playerStatsMsg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export class PlayerStatsMsg implements AbstractMsg {
s.writeUint16(this.playerStats.timeAlive);
s.writeUint8(this.playerStats.kills);
s.writeUint8(this.playerStats.dead as unknown as number);
s.writeUint16(this.playerStats.damageDealt);
s.writeUint16(this.playerStats.damageTaken);
// writing integers will just strip the decimal digits instead of rounding
// so without rounding 99.9999... will become 99 instead of 100
s.writeUint16(Math.round(this.playerStats.damageDealt));
s.writeUint16(Math.round(this.playerStats.damageTaken));
}

deserialize(s: BitStream) {
Expand Down

0 comments on commit 4a60020

Please sign in to comment.