Add sell value for every block and item in the game, crazy
This commit is contained in:
@@ -45,10 +45,27 @@ Deno.test("mods/bworld json survives going to the registry and back", async () =
|
||||
}
|
||||
for (const file of Deno.readDirSync("mods/bworld/items")) {
|
||||
const { item: json } = JSON.parse(Deno.readTextFileSync(`mods/bworld/items/${file.name}`));
|
||||
// one without a texture fills in a block's item instead, see the test below
|
||||
if (json.texture === undefined) continue;
|
||||
assertEquals(item_to_json(json.id, item_from_json(json)), json, file.name);
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("an item file without a texture fills in the item of the block with its id", async () => {
|
||||
const dir = mods_with_template();
|
||||
Deno.writeTextFileSync(
|
||||
`${dir}/copper_tools/items/example_block.json`,
|
||||
JSON.stringify({ format_version: 1, item: { id: "copper_tools:example_block", base_sell_value: 3 } }),
|
||||
);
|
||||
await test_game(dir);
|
||||
const item = EverythingRegistry.get<ItemRegistry>("items", "copper_tools:example_block")!;
|
||||
assertEquals(item.base_sell_value, 3);
|
||||
// and keeps what the block gave it
|
||||
assertEquals(item.block_id, "copper_tools:example_block");
|
||||
assertEquals(item.texture_id, "copper_tools:example_block");
|
||||
Deno.removeSync(dir, { recursive: true });
|
||||
});
|
||||
|
||||
Deno.test("a mod made from the template loads and runs", async () => {
|
||||
const dir = mods_with_template();
|
||||
const { game, take, send } = await test_game(dir);
|
||||
|
||||
Reference in New Issue
Block a user