Implement tags !
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Container, ItemStack } from "$/common/inventory.ts";
|
||||
import { CRAFTING_RESULT_SLOT } from "$/common/protocol.ts";
|
||||
import { choice_ids, type GridRecipe } from "$/common/mod_data.ts";
|
||||
import { choice_matches, type GridRecipe } from "$/common/mod_data.ts";
|
||||
|
||||
// recipes come from mods, see RecipeBook in common/mod_loader.ts
|
||||
|
||||
@@ -28,7 +28,7 @@ function matches_recipe(grid: (string | undefined)[], recipe: GridRecipe): boole
|
||||
if (
|
||||
choice === undefined
|
||||
? item !== undefined
|
||||
: item === undefined || !choice_ids(choice).includes(item)
|
||||
: item === undefined || !choice_matches(choice, item)
|
||||
) {
|
||||
match = false;
|
||||
break;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { BlockRegistry, EverythingRegistry, ItemRegistry } from "$/common/everything_registry.ts";
|
||||
import { Container as EngineContainer, ItemStack as EngineItemStack } from "$/common/inventory.ts";
|
||||
import { get_state_value, set_state_value } from "$/common/utils.ts";
|
||||
import { tag_api } from "$/common/tags.ts";
|
||||
import type {
|
||||
BlockComponent,
|
||||
BlockRef,
|
||||
@@ -514,6 +515,7 @@ export class ModRuntime {
|
||||
},
|
||||
list: (type) => structuredClone(game().recipes.by_type.get(type) ?? []),
|
||||
},
|
||||
tags: tag_api(),
|
||||
containers: {
|
||||
create: (size) => {
|
||||
if (!Number.isInteger(size) || size < 1 || size > MAX_CONTAINER_SIZE) {
|
||||
|
||||
@@ -102,6 +102,7 @@ function as_loaded_mod(file: string, bmod: Bmod): LoadedMod {
|
||||
ores: entries(bmod.data.ores),
|
||||
entities: entries(bmod.data.entities),
|
||||
entity_models: entries(bmod.data.entity_models),
|
||||
tags: entries(bmod.data.tags),
|
||||
textures: [...bmod.textures.keys()],
|
||||
texture_files: new Map(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user