Merge branch 'develop' into 2736-fix-cmdset-remove
This commit is contained in:
commit
90a555b259
99 changed files with 3381 additions and 1246 deletions
|
|
@ -450,9 +450,7 @@ class CmdSetHandler(object):
|
|||
|
||||
"""
|
||||
if "permanent" in kwargs:
|
||||
logger.log_dep(
|
||||
"obj.cmdset.add() kwarg 'permanent' has changed name to 'persistent'."
|
||||
)
|
||||
logger.log_dep("obj.cmdset.add() kwarg 'permanent' has changed name to 'persistent'.")
|
||||
persistent = kwargs["permanent"] if persistent is False else persistent
|
||||
|
||||
if not (isinstance(cmdset, str) or utils.inherits_from(cmdset, CmdSet)):
|
||||
|
|
|
|||
|
|
@ -603,7 +603,7 @@ class CmdCreate(ObjManipCommand):
|
|||
if "drop" in self.switches:
|
||||
if caller.location:
|
||||
obj.home = caller.location
|
||||
obj.move_to(caller.location, quiet=True)
|
||||
obj.move_to(caller.location, quiet=True, move_type="drop")
|
||||
if string:
|
||||
caller.msg(string)
|
||||
|
||||
|
|
@ -993,7 +993,7 @@ class CmdDig(ObjManipCommand):
|
|||
)
|
||||
caller.msg("%s%s%s" % (room_string, exit_to_string, exit_back_string))
|
||||
if new_room and "teleport" in self.switches:
|
||||
caller.move_to(new_room)
|
||||
caller.move_to(new_room, move_type="teleport")
|
||||
|
||||
|
||||
class CmdTunnel(COMMAND_DEFAULT_CLASS):
|
||||
|
|
@ -1071,7 +1071,7 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
|
|||
exitname, backshort = self.directions[exitshort]
|
||||
backname = self.directions[backshort][0]
|
||||
|
||||
# if we recieved a typeclass for the exit, add it to the alias(short name)
|
||||
# if we received a typeclass for the exit, add it to the alias(short name)
|
||||
if ":" in self.lhs:
|
||||
# limit to only the first : character
|
||||
exit_typeclass = ":" + self.lhs.split(":", 1)[-1]
|
||||
|
|
@ -1665,7 +1665,7 @@ class CmdSetAttribute(ObjManipCommand):
|
|||
def split_nested_attr(self, attr):
|
||||
"""
|
||||
Yields tuples of (possible attr name, nested keys on that attr).
|
||||
For performance, this is biased to the deepest match, but allows compatability
|
||||
For performance, this is biased to the deepest match, but allows compatibility
|
||||
with older attrs that might have been named with `[]`'s.
|
||||
|
||||
> list(split_nested_attr("nested['asdf'][0]"))
|
||||
|
|
@ -1927,14 +1927,11 @@ class CmdSetAttribute(ObjManipCommand):
|
|||
if self.rhs is None:
|
||||
# no = means we inspect the attribute(s)
|
||||
if not attrs:
|
||||
attrs = [attr.key for attr in obj.attributes.get(category=None)]
|
||||
attrs = [attr.key for attr in obj.attributes.get(category=None, return_obj=True)]
|
||||
for attr in attrs:
|
||||
if not self.check_attr(obj, attr, category):
|
||||
continue
|
||||
result.append(self.view_attr(obj, attr, category))
|
||||
# we view it without parsing markup.
|
||||
self.caller.msg("".join(result).strip(), options={"raw": True})
|
||||
return
|
||||
else:
|
||||
# deleting the attribute(s)
|
||||
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
||||
|
|
@ -1979,8 +1976,12 @@ class CmdSetAttribute(ObjManipCommand):
|
|||
else:
|
||||
value = _convert_from_string(self, value)
|
||||
result.append(self.set_attr(obj, attr, value, category))
|
||||
# send feedback
|
||||
caller.msg("".join(result).strip("\n"))
|
||||
# check if anything was done
|
||||
if not result:
|
||||
caller.msg("No valid attributes were found. Usage: set obj/attr[:category] = value. Use empty value to clear.")
|
||||
else:
|
||||
# send feedback
|
||||
caller.msg("".join(result).strip("\n"))
|
||||
|
||||
|
||||
class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||
|
|
@ -2219,11 +2220,13 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
|||
old_typeclass_path = obj.typeclass_path
|
||||
|
||||
if reset:
|
||||
answer = yield("|yNote that this will reset the object back to its typeclass' default state, "
|
||||
"removing any custom locks/perms/attributes etc that may have been added "
|
||||
"by an explicit create_object call. Use `update` or type/force instead in order "
|
||||
"to keep such data. "
|
||||
"Continue [Y]/N?|n")
|
||||
answer = yield (
|
||||
"|yNote that this will reset the object back to its typeclass' default state, "
|
||||
"removing any custom locks/perms/attributes etc that may have been added "
|
||||
"by an explicit create_object call. Use `update` or type/force instead in order "
|
||||
"to keep such data. "
|
||||
"Continue [Y]/N?|n"
|
||||
)
|
||||
if answer.upper() in ("N", "NO"):
|
||||
caller.msg("Aborted.")
|
||||
return
|
||||
|
|
@ -2732,7 +2735,7 @@ class CmdExamine(ObjManipCommand):
|
|||
return
|
||||
|
||||
if ndb_attr and ndb_attr[0]:
|
||||
return "\n " + " \n".join(
|
||||
return "\n " + "\n ".join(
|
||||
sorted(self.format_single_attribute(attr) for attr in ndb_attr)
|
||||
)
|
||||
|
||||
|
|
@ -2830,7 +2833,7 @@ class CmdExamine(ObjManipCommand):
|
|||
objdata["Stored Cmdset(s)"] = self.format_stored_cmdsets(obj)
|
||||
objdata["Merged Cmdset(s)"] = self.format_merged_cmdsets(obj, current_cmdset)
|
||||
objdata[
|
||||
f"Commands vailable to {obj.key} (result of Merged Cmdset(s))"
|
||||
f"Commands available to {obj.key} (result of Merged Cmdset(s))"
|
||||
] = self.format_current_cmds(obj, current_cmdset)
|
||||
if self.object_type == "script":
|
||||
objdata["Description"] = self.format_script_desc(obj)
|
||||
|
|
@ -3473,7 +3476,7 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
|||
caller.msg("\n".join(msgs))
|
||||
if "delete" not in self.switches:
|
||||
if script and script.pk:
|
||||
ScriptEvMore(caller, [script], session=self.session)
|
||||
ScriptEvMore(caller, [script], session=self.session)
|
||||
else:
|
||||
caller.msg("Script was deleted automatically.")
|
||||
else:
|
||||
|
|
@ -3706,6 +3709,7 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS):
|
|||
quiet="quiet" in self.switches,
|
||||
emit_to_obj=caller,
|
||||
use_destination="intoexit" not in self.switches,
|
||||
move_type="teleport"
|
||||
):
|
||||
|
||||
if obj_to_teleport == caller:
|
||||
|
|
@ -4029,7 +4033,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
|
|||
)
|
||||
return
|
||||
try:
|
||||
# we homogenize the protoype first, to be more lenient with free-form
|
||||
# we homogenize the prototype first, to be more lenient with free-form
|
||||
protlib.validate_prototype(protlib.homogenize_prototype(prototype))
|
||||
except RuntimeError as err:
|
||||
self.caller.msg(str(err))
|
||||
|
|
|
|||
|
|
@ -1818,7 +1818,7 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
class CmdGrapevine2Chan(COMMAND_DEFAULT_CLASS):
|
||||
"""
|
||||
Link an Evennia channel to an exteral Grapevine channel
|
||||
Link an Evennia channel to an external Grapevine channel
|
||||
|
||||
Usage:
|
||||
grapevine2chan[/switches] <evennia_channel> = <grapevine_channel>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class CmdHome(COMMAND_DEFAULT_CLASS):
|
|||
caller.msg("You are already home!")
|
||||
else:
|
||||
caller.msg("There's no place like home ...")
|
||||
caller.move_to(home)
|
||||
caller.move_to(home, move_type="teleport")
|
||||
|
||||
|
||||
class CmdLook(COMMAND_DEFAULT_CLASS):
|
||||
|
|
@ -434,7 +434,7 @@ class CmdGet(COMMAND_DEFAULT_CLASS):
|
|||
if not obj.at_pre_get(caller):
|
||||
return
|
||||
|
||||
success = obj.move_to(caller, quiet=True)
|
||||
success = obj.move_to(caller, quiet=True, move_type="get")
|
||||
if not success:
|
||||
caller.msg("This can't be picked up.")
|
||||
else:
|
||||
|
|
@ -484,7 +484,7 @@ class CmdDrop(COMMAND_DEFAULT_CLASS):
|
|||
if not obj.at_pre_drop(caller):
|
||||
return
|
||||
|
||||
success = obj.move_to(caller.location, quiet=True)
|
||||
success = obj.move_to(caller.location, quiet=True, move_type="drop")
|
||||
if not success:
|
||||
caller.msg("This couldn't be dropped.")
|
||||
else:
|
||||
|
|
@ -538,7 +538,7 @@ class CmdGive(COMMAND_DEFAULT_CLASS):
|
|||
return
|
||||
|
||||
# give object
|
||||
success = to_give.move_to(target, quiet=True)
|
||||
success = to_give.move_to(target, quiet=True, move_type="get")
|
||||
if not success:
|
||||
caller.msg("This could not be given.")
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
|
|||
help <topic>/<subtopic>/<subsubtopic> ...
|
||||
|
||||
Use the 'help' command alone to see an index of all help topics, organized
|
||||
by category.eSome big topics may offer additional sub-topics.
|
||||
by category. Some big topics may offer additional sub-topics.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
|
|||
click_topics=True,
|
||||
):
|
||||
"""This visually formats the help entry.
|
||||
This method can be overriden to customize the way a help
|
||||
This method can be overridden to customize the way a help
|
||||
entry is displayed.
|
||||
|
||||
Args:
|
||||
|
|
|
|||
|
|
@ -107,8 +107,7 @@ class TestGeneral(BaseEvenniaCommandTest):
|
|||
|
||||
def test_nick_list(self):
|
||||
self.call(general.CmdNick(), "/list", "No nicks defined.")
|
||||
self.call(general.CmdNick(), "test1 = Hello",
|
||||
"Inputline-nick 'test1' mapped to 'Hello'.")
|
||||
self.call(general.CmdNick(), "test1 = Hello", "Inputline-nick 'test1' mapped to 'Hello'.")
|
||||
self.call(general.CmdNick(), "/list", "Defined Nicks:")
|
||||
|
||||
def test_get_and_drop(self):
|
||||
|
|
@ -1295,7 +1294,8 @@ class TestBuilding(BaseEvenniaCommandTest):
|
|||
"Obj2 = evennia.objects.objects.DefaultExit",
|
||||
"Obj2 changed typeclass from evennia.objects.objects.DefaultObject "
|
||||
"to evennia.objects.objects.DefaultExit.",
|
||||
cmdstring="swap", inputs=["yes"],
|
||||
cmdstring="swap",
|
||||
inputs=["yes"],
|
||||
)
|
||||
self.call(building.CmdTypeclass(), "/list Obj", "Core typeclasses")
|
||||
self.call(
|
||||
|
|
@ -1332,7 +1332,7 @@ class TestBuilding(BaseEvenniaCommandTest):
|
|||
"/reset/force Obj=evennia.objects.objects.DefaultObject",
|
||||
"Obj updated its existing typeclass (evennia.objects.objects.DefaultObject).\n"
|
||||
"All object creation hooks were run. All old attributes where deleted before the swap.",
|
||||
inputs=["yes"]
|
||||
inputs=["yes"],
|
||||
)
|
||||
|
||||
from evennia.prototypes.prototypes import homogenize_prototype
|
||||
|
|
@ -1359,7 +1359,7 @@ class TestBuilding(BaseEvenniaCommandTest):
|
|||
"typeclasses.objects.Object.\nOnly the at_object_creation hook was run "
|
||||
"(update mode). Attributes set before swap were not removed\n"
|
||||
"(use `swap` or `type/reset` to clear all). Prototype 'replaced_obj' was "
|
||||
"successfully applied over the object type."
|
||||
"successfully applied over the object type.",
|
||||
)
|
||||
assert self.obj1.db.desc == "protdesc"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue