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 }));
-5
View File
@@ -126,11 +126,6 @@ export class ServerPlayer extends LivingEntity {
return false;
}
// there's no air bar to show yet, so players don't drown
override get can_breathe_underwater() {
return true;
}
// their client moves them, this only burns, falls out of the world and counts effects and hurt time down. while
// knocked back it moves them like a mob that isn't walking anywhere, landing hands them back to their client
override tick() {