Giant chesplate
This commit is contained in:
@@ -12,7 +12,8 @@ Some of the base game is still built into the engine: recipe types, the inventor
|
||||
necklaces and belts, for any mod's items. They're in 2 columns left of the player's inventory, there whenever it's open.
|
||||
Shift clicking a curio in the inventory puts it in the first slot it fits.
|
||||
|
||||
Like the original, it adds no items, and a slot type only shows up once some mod puts an item in its tag.
|
||||
A slot type only shows up once some item is in its tag. The base game's one curio is the giant chestplate, a body curio
|
||||
that gives 20 more max health while worn, so the body slot is always there.
|
||||
|
||||
### Making an Item a Curio
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:giant_chestplate",
|
||||
"texture": "bworld:giant_chestplate",
|
||||
"max_stack": 1,
|
||||
"components": {
|
||||
"bworld:curio_modifiers": [
|
||||
{ "attribute": "bworld:max_health", "amount": 20, "operation": "add_value" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,6 @@ export function register_curios(ctx: ServerContext) {
|
||||
const container = ctx.containers.create(SLOTS.length);
|
||||
const ids = ctx.storage.get<Record<string, string>>("curios") ?? {};
|
||||
ctx.storage.set("curios", { ...ids, [player.name]: container.id });
|
||||
watch(player, container);
|
||||
return container;
|
||||
}
|
||||
|
||||
@@ -63,20 +62,19 @@ export function register_curios(ctx: ServerContext) {
|
||||
applied.set(player.id, now);
|
||||
}
|
||||
|
||||
ctx.events.after.player_join.subscribe(({ player }) => {
|
||||
const curios = saved_curios(player);
|
||||
if (curios) watch(player, curios);
|
||||
});
|
||||
ctx.events.after.player_leave.subscribe(({ player }) => {
|
||||
stop_watching.get(player.id)?.();
|
||||
stop_watching.delete(player.id);
|
||||
applied.delete(player.id);
|
||||
});
|
||||
|
||||
// the slot types in 2 columns left of the inventory, always there while it's open. the engine draws their panel
|
||||
// the slot types in 2 columns left of the inventory, always there while it's open. the engine draws their panel.
|
||||
// this runs as they join, before their health is checked against their max health, so what their curios give them
|
||||
// comes back first
|
||||
ctx.menus.extend_player_menu((menu, player) => {
|
||||
if (active.length === 0) return;
|
||||
const curios = curios_of(player);
|
||||
watch(player, curios);
|
||||
// what's in slot types no item goes in anymore, since the mod that put items in them was removed, goes back
|
||||
// to them
|
||||
for (const [index, slot] of SLOTS.entries()) {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"tag": {
|
||||
"values": ["bworld:giant_chestplate"]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 388 B |
Reference in New Issue
Block a user