Breathing !

This commit is contained in:
2026-10-02 11:28:30 -03:00
parent 9ca717d2d0
commit 88d6de13d5
10 changed files with 50 additions and 12 deletions
+4 -2
View File
@@ -1544,10 +1544,12 @@ export class GameServer {
if (player.health > player.max_health) player.health = player.max_health;
const { food, saturation } = player.vitals;
const { health, max_health } = player;
// in bubbles' halves like hunger, so it's only sent when a bubble changes, not every tick under water
const air = Math.max(0, Math.ceil(player.air / player.max_air * 20));
sync(
"vitals",
[health, max_health, food, saturation],
() => ({ type: "vitals", health, max_health, food, saturation }),
[health, max_health, food, saturation, air],
() => ({ type: "vitals", health, max_health, food, saturation, air }),
);
const attack_speed = player.attribute(ATTRIBUTES.attack_speed);
sync("attack_speed", attack_speed, () => ({ type: "attack_speed", value: attack_speed }));