From 5a5884f6da42f41f28a64ed89e02d80f0ad37608 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 13 Sep 2016 18:03:50 +0200 Subject: [PATCH] Add PROTOTYPE_MODULES to settings_default, making use of world/prototypes.py already being defined. --- evennia/commands/default/building.py | 6 +++--- evennia/game_template/world/prototypes.py | 11 +++++++---- evennia/settings_default.py | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index e5b6baf5c..0f1f805b1 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -2588,9 +2588,9 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS): def _show_prototypes(prototypes): "Helper to show a list of available prototypes" - string = "\nAvailable prototypes:\n %s" - string = string % utils.fill(", ".join(sorted(prototypes.keys()))) - return string + prots = ", ".join(sorted(prototypes.keys())) + return "\nAvailable prototypes (case sensistive): %s" % \ + ("\n" + utils.fill(prots) if prots else "None") prototypes = spawn(return_prototypes=True) if not self.args: diff --git a/evennia/game_template/world/prototypes.py b/evennia/game_template/world/prototypes.py index 58280deac..063510a25 100644 --- a/evennia/game_template/world/prototypes.py +++ b/evennia/game_template/world/prototypes.py @@ -38,8 +38,6 @@ See the `@spawn` command and `evennia.utils.spawner` for more info. #from random import randint # -#NOBODY = {} -# #GOBLIN = { # "key": "goblin grunt", # "health": lambda: randint(20,30), @@ -60,11 +58,16 @@ See the `@spawn` command and `evennia.utils.spawner` for more info. # "attacks": ["short bow"] #} # -#ARCHWIZARD = { +# This is an example of a prototype without a prototype +# (nor key) of its own, so it should normally only be +# used as a mix-in, as in the example of the goblin +# archwizard below. +#ARCHWIZARD_MIXIN = { # "attacks": ["archwizard staff"], +# "spells": ["greater fire ball", "greater lighting"] #} # #GOBLIN_ARCHWIZARD = { # "key": "goblin archwizard", -# "prototype" : ("GOBLIN_WIZARD", "ARCHWIZARD") +# "prototype" : ("GOBLIN_WIZARD", "ARCHWIZARD_MIXIN") #} diff --git a/evennia/settings_default.py b/evennia/settings_default.py index 8cb0d0662..a7d73aacf 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -305,6 +305,8 @@ LOCK_FUNC_MODULES = ("evennia.locks.lockfuncs", "server.conf.lockfuncs",) # will be loaded in order, meaning functions in later modules may overload # previous ones if having the same name. INPUT_FUNC_MODULES = ["evennia.server.inputfuncs", "server.conf.inputfuncs"] +# Modules that contain prototypes for use with the spawner mechanism. +PROTOTYPE_MODULES = ["world.prototypes"] # Module holding settings/actions for the dummyrunner program (see the # dummyrunner for more information) DUMMYRUNNER_SETTINGS_MODULE = "evennia.server.profiling.dummyrunner_settings"