ctx.recipes.list api on shared side
This commit is contained in:
@@ -237,7 +237,7 @@ export function add_recipe(recipes: RecipeBook, recipe: RecipeJson) {
|
||||
|
||||
// ctx.recipes for shared scripts, the same on the server and every client: a recipe registered there is in the book
|
||||
// on every side without being sent, like one from the mod's recipes/. checked like a data file's. fail throws, as the
|
||||
// side's error for the mod
|
||||
// side's error for the mod. list reads the book as it is, so a script sees the recipes of the ones before it
|
||||
export function shared_recipes_api(
|
||||
recipes: () => RecipeBook,
|
||||
setting_up: () => boolean,
|
||||
@@ -255,5 +255,6 @@ export function shared_recipes_api(
|
||||
fail((e as Error).message);
|
||||
}
|
||||
},
|
||||
list: (type) => structuredClone(type ? recipes().all.filter((recipe) => recipe.type === type) : recipes().all),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user