mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 23:47:16 +02:00
Merge pull request #3425 from InspectorCaracal/patch-10
Override example crafting recipes
This commit is contained in:
commit
772d4c21b5
1 changed files with 5 additions and 4 deletions
|
|
@ -146,9 +146,10 @@ def _load_recipes():
|
|||
|
||||
global _RECIPE_CLASSES
|
||||
if not _RECIPE_CLASSES:
|
||||
paths = ["evennia.contrib.game_systems.crafting.example_recipes"]
|
||||
if hasattr(settings, "CRAFT_RECIPE_MODULES"):
|
||||
paths += make_iter(settings.CRAFT_RECIPE_MODULES)
|
||||
if paths := getattr(settings, "CRAFT_RECIPE_MODULES", None):
|
||||
paths = make_iter(settings.CRAFT_RECIPE_MODULES)
|
||||
else:
|
||||
paths = ["evennia.contrib.game_systems.crafting.example_recipes"]
|
||||
for path in paths:
|
||||
for cls in callables_from_module(path).values():
|
||||
if inherits_from(cls, CraftingRecipeBase):
|
||||
|
|
@ -946,7 +947,7 @@ def craft(crafter, recipe_name, *inputs, raise_exception=False, **kwargs):
|
|||
# try in-match
|
||||
matches = [key for key in _RECIPE_CLASSES if recipe_name in key]
|
||||
if len(matches) == 1:
|
||||
RecipeClass = matches[0]
|
||||
RecipeClass = _RECIPE_CLASSES[matches[0]]
|
||||
|
||||
if not RecipeClass:
|
||||
if raise_exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue