Scrap !!
This commit is contained in:
@@ -472,3 +472,21 @@ Deno.test("a jester's music box and scream play from as far as it's got, for a p
|
||||
set_mods_client(undefined as unknown as Client);
|
||||
Deno.removeSync(dir, { recursive: true });
|
||||
});
|
||||
|
||||
Deno.test("dropped scrap lies around as scrap, picked up by right clicking it into a free hotbar slot", async () => {
|
||||
const { t } = await setup();
|
||||
const alice = t.game.players()[0];
|
||||
const inventory = alice.inventory;
|
||||
const scrap = t.game.spawn_item(0.5, 100, 2.5, new ItemStack("dangerous_business:air_horn"));
|
||||
assertEquals(scrap.type, "dangerous_business:scrap");
|
||||
|
||||
// with every hotbar slot taken it stays where it is
|
||||
for (let slot = 0; slot < 9; slot++) inventory.set_item(slot, new ItemStack(FLOOR));
|
||||
t.send(1, { type: "interact_entity", id: scrap.id });
|
||||
assert(!scrap.removed);
|
||||
|
||||
inventory.set_item(5, undefined);
|
||||
t.send(1, { type: "interact_entity", id: scrap.id });
|
||||
assert(scrap.removed);
|
||||
assertEquals(inventory.get_item(5)?.type_id, "dangerous_business:air_horn");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user