diff --git a/CHANGELOG.md b/CHANGELOG.md index b881c45311..f3f5ca5999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,8 @@ Up requirements to Django 3.2+, Twisted 21+ - Change `settings.COMMAND_DEFAULT_ARG_REGEX` default from `None` to a regex meaning that a space or `/` must separate the cmdname and args. This better fits common expectations. - Add confirmation question to `ban`/`unban` commands. +- Add `move` and `move_here` to `tel` command to optionally allow to limit + teleportation of an object or to a specific destination. ### Evennia 0.9.5 (2019-2020) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index bb6589acf5..7ba0911c97 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -3356,6 +3356,13 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS): Teleports an object somewhere. If no object is given, you yourself are teleported to the target location. + + To lock an object from being teleported, set its `move` lock, it will be + checked with the caller. To block + a destination from being teleported to, set the destination's `move_here` + lock - it will be checked with the thing being teleported. Admins and + higher permissions can always teleport. + """ key = "tel" @@ -3437,6 +3444,16 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS): caller.msg("%s is already at %s." % (obj_to_teleport, destination)) return + # check any move-locks + if not (caller.permissions.check("Admin") or obj_to_teleport.access(caller, "move")): + caller.msg(f"{obj_to_teleport} 'move'-lock blocks you from teleporting it anywhere.") + return + + if not (caller.permissions.check("Admin") + or destination.access(obj_to_teleport, "move_here")): + caller.msg(f"{destination} 'move_to'-lock blocks {obj_to_teleport} from moving there.") + return + # try the teleport if not obj_to_teleport.location: # teleporting from none-location @@ -3454,7 +3471,6 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS): caller.msg("Teleportation failed.") - class CmdTag(COMMAND_DEFAULT_CLASS): """ handles the tags of an object