Handle '@spawn/edit ' (no prototype key given) brings OLC menu. Handle '@spawn/edit testball' brings OLC menu. Handle '@spawn/edit NO_EXISTS' that returns error

This commit is contained in:
Henddher Pedroza 2018-10-20 20:11:41 -05:00
parent 414f72c3b0
commit 931290a7a0
2 changed files with 20 additions and 13 deletions

View file

@ -2913,7 +2913,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
prototype = None
if self.lhs:
key = self.lhs
prototype = spawner.search_prototype(key=key, return_meta=True)
prototype = protlib.search_prototype(key=key)
if len(prototype) > 1:
caller.msg("More than one match for {}:\n{}".format(
key, "\n".join(proto.get('prototype_key', '') for proto in prototype)))
@ -2921,6 +2921,10 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
elif prototype:
# one match
prototype = prototype[0]
else:
# no match
caller.msg("No prototype '{}' was found.".format(key))
return
olc_menus.start_olc(caller, session=self.session, prototype=prototype)
return