ctx.items.damage and player_death event moved to bworld

This commit is contained in:
2026-11-14 00:09:55 -03:00
parent 9bf6b98953
commit 6c6be61dd0
7 changed files with 34 additions and 14 deletions
+1
View File
@@ -249,6 +249,7 @@ ctx.items.max_stack("bworld:wood_pickaxe"); // 1
ctx.items.max_stack(id, data); // the same for a stack with this data, fewer for a full fluid container
ctx.items.fluid_capacity("bworld:bucket"); // how much a fluid container holds full, or undefined
ctx.items.tool("bworld:wood_pickaxe"); // "pickaxe", or undefined for items that aren't tools
ctx.items.damage(item, 1); // takes durability off a tool stack, true when that used it up
ctx.items.sell_value("bworld:copper_coin"); // 1, or undefined for items without a base_sell_value
ctx.items.sell_value(id, data); // the same for a stack with this data, with a full fluid container's fluid on top
+3
View File
@@ -51,3 +51,6 @@ dropping.
The damage a tool has taken is kept in its stack's `data.damage`, and a worn tool shows a bar under it in its slot,
going from green to red as it wears down. Upgrading a tool at the smithing table keeps its data, damage included.
A server script wears a tool down with `ctx.items.damage(item, amount)`, which adds to the stack's `data.damage` and
returns true when that used it up. It does nothing to items that aren't tools. The base game's death drops use it.