Tooltips
This commit is contained in:
+21
-3
@@ -1,7 +1,7 @@
|
||||
// the base game's block and item behavior: hoeing, chests, furnaces, crops and the watering can
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
import { get_state_value } from "$/common/utils.ts";
|
||||
import { BlockRegistry, EverythingRegistry, ItemRegistry } from "$/common/everything_registry.ts";
|
||||
import { display_name, get_state_value } from "$/common/utils.ts";
|
||||
import { test_game } from "./helpers.ts";
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
@@ -158,10 +158,28 @@ Deno.test("the last bone meal is used up", async () => {
|
||||
assertEquals(last_container(t.take(1), "inventory")[slot], null);
|
||||
});
|
||||
|
||||
Deno.test("a new watering can starts empty", async () => {
|
||||
Deno.test("a new watering can starts empty, and players are told so in its lore", async () => {
|
||||
const t = await setup([["bworld:watering_can", 1]]);
|
||||
const can = last_container(t.take(1), "inventory").find((i: Msg) => i?.id === "bworld:watering_can");
|
||||
assertEquals(can.data, { water: 0, max_water: 32 });
|
||||
assertEquals(can.lore, "Water: 0/32");
|
||||
|
||||
// lore is worked out for players, it isn't saved
|
||||
const saved = JSON.parse(t.game.save());
|
||||
const saved_can = saved.players.alice?.inventory?.find((i: Msg) => i?.id === "bworld:watering_can");
|
||||
assert(!saved_can || saved_can.lore === undefined);
|
||||
t.game.on_disconnect(1);
|
||||
const after = JSON.parse(t.game.save()).players.alice.inventory.find((i: Msg) => i?.id === "bworld:watering_can");
|
||||
assertEquals(after.lore, undefined);
|
||||
});
|
||||
|
||||
Deno.test("items are called by their name, or by one made from their id", async () => {
|
||||
await test_game("mods");
|
||||
assertEquals(display_name("bworld:iron_ingot"), "Iron Ingot");
|
||||
assertEquals(display_name("bworld:stone_pickaxe"), "Stone Pickaxe");
|
||||
assertEquals(display_name("bworld:hoed_dirt"), "Hoed Dirt");
|
||||
EverythingRegistry.register<ItemRegistry>("items", "test:thing", { texture_id: "engine:missing", name: "A Thing" });
|
||||
assertEquals(display_name("test:thing"), "A Thing");
|
||||
});
|
||||
|
||||
Deno.test("chests and furnaces from a world saved before they were mod code keep their items and keep smelting", async () => {
|
||||
|
||||
Reference in New Issue
Block a user