Change whole gui system
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { CRAFTING_RESULT_SLOT, PLAYER_MENU_CRAFTING } from "$/common/protocol.ts";
|
||||
import { ItemStack } from "$/common/inventory.ts";
|
||||
import { test_game } from "./helpers.ts";
|
||||
|
||||
@@ -95,7 +96,7 @@ Deno.test("q throws one of an item the way the player looks, ctrl throws the who
|
||||
send(1, { type: "chat", text: "/give bworld:stone 5" });
|
||||
take(1);
|
||||
|
||||
send(1, { type: "drop_item", container: "inventory", index: 0, all: false });
|
||||
send(1, { type: "drop_item", menu: 0, slot: 0, all: false });
|
||||
const [thrown] = game.item_entities();
|
||||
assertEquals(thrown.item.amount, 1);
|
||||
assert(thrown.vz < -5 && Math.abs(thrown.vx) < 1, "thrown forwards");
|
||||
@@ -105,13 +106,13 @@ Deno.test("q throws one of an item the way the player looks, ctrl throws the who
|
||||
assert(thrown.z < -1, "it flew away from the player");
|
||||
assertEquals(game.item_entities().length, 1, "and isn't picked straight back up");
|
||||
|
||||
send(1, { type: "drop_item", container: "inventory", index: 0, all: true });
|
||||
send(1, { type: "drop_item", menu: 0, slot: 0, all: true });
|
||||
assertEquals(game.item_entities().map((entity) => entity.item.amount).sort(), [1, 4]);
|
||||
assertEquals(inventory_count(take(1), "bworld:stone"), 0);
|
||||
|
||||
// empty slots and the crafting result don't throw anything
|
||||
send(1, { type: "drop_item", container: "inventory", index: 0, all: true });
|
||||
send(1, { type: "drop_item", container: "crafting", index: 9, all: true });
|
||||
send(1, { type: "drop_item", menu: 0, slot: 0, all: true });
|
||||
send(1, { type: "drop_item", menu: 0, slot: PLAYER_MENU_CRAFTING + CRAFTING_RESULT_SLOT, all: true });
|
||||
assertEquals(game.item_entities().length, 2);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user