Make durability work like sunlit valley

This commit is contained in:
2026-09-29 18:00:32 -03:00
parent 8fe581ea93
commit f76cf2bf38
30 changed files with 70 additions and 28 deletions
+3 -1
View File
@@ -1252,7 +1252,8 @@ export class GameServer {
}
}
// like minecraft: everything they carried falls out where they died, and they start over at spawn
// like minecraft: everything they carried falls out where they died, and they start over at spawn. tools lose 1
// durability first, and ones that run out break instead of dropping
#kill(player: ServerPlayer, cause: string) {
const { x, y, z } = player;
this.close_screen(player);
@@ -1260,6 +1261,7 @@ export class GameServer {
const item = player.inventory.get_item(i);
if (item) {
player.inventory.set_item(i, undefined);
if (item.damage(1)) continue;
this.pop_item(Math.floor(x), Math.floor(Math.max(y, 0)), Math.floor(z), item);
}
}