From bcf214ee0da6200bfc26240476714003359cb4bd Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 15 Apr 2012 22:04:15 +0200 Subject: [PATCH] Changed so object.move_to() traverses exits by default - i.e. you will no longer end up INSIDE the exit object if you move_to the exit, but instead you will go to the exits destination. This should be the most common use. The use_destination keyword to object.move_to can be used to change this behaviour. Also @teleport (which uses move_to()) has gotten a new flag to allow for teleporting into exits if so specifically desired. Resolves issue 224. --- src/commands/default/building.py | 14 +++++++++----- src/objects/models.py | 6 ++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/commands/default/building.py b/src/commands/default/building.py index 4869665b7..b8359b500 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -1831,11 +1831,12 @@ class CmdTeleport(MuxCommand): @tel/switch [ =] Switches: - quiet - don't inform the source and target - locations about the move. + quiet - don't echo leave/arrive messages to the source/target + locations for the move. + intoexit - if target is an exit, teleport INTO + the exit object instead of to its destination - Teleports an object somewhere. If no object is - given we are teleporting ourselves. + Teleports an object or yourself somewhere. """ key = "@tel" aliases = "@teleport" @@ -1874,8 +1875,11 @@ class CmdTeleport(MuxCommand): if obj_to_teleport == destination: caller.msg("You can't teleport an object inside of itself!") return + use_destination = True + if "intoexit" in self.switches: + use_destination = False # try the teleport - if obj_to_teleport.move_to(destination, quiet=tel_quietly, emit_to_obj=caller): + if obj_to_teleport.move_to(destination, quiet=tel_quietly, emit_to_obj=caller, use_destination=use_destination): if obj_to_teleport == caller: caller.msg("Teleported to %s." % destination.key) else: diff --git a/src/objects/models.py b/src/objects/models.py index 932bd7a3f..cbe9f0dd7 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -17,7 +17,6 @@ transparently through the decorating TypeClass. import traceback from django.db import models from django.conf import settings -from django.contrib.contenttypes.models import ContentType from src.utils.idmapper.models import SharedMemoryModel from src.typeclasses.models import Attribute, TypedObject, TypeNick, TypeNickHandler @@ -25,12 +24,11 @@ from src.typeclasses.models import _get_cache, _set_cache, _del_cache from src.typeclasses.typeclass import TypeClass from src.objects.manager import ObjectManager from src.players.models import PlayerDB -from src.server.models import ServerConfig from src.commands.cmdsethandler import CmdSetHandler from src.commands import cmdhandler from src.scripts.scripthandler import ScriptHandler from src.utils import logger -from src.utils.utils import make_iter, to_unicode, to_str, mod_import +from src.utils.utils import make_iter, to_unicode, mod_import #__all__ = ("ObjAttribute", "Alias", "ObjectNick", "ObjectDB") @@ -640,7 +638,7 @@ class ObjectDB(TypedObject): if not destination: emit_to_obj.msg("The destination doesn't exist.") return - if destination.destination: + if destination.destination and use_destination: # traverse exits destination = destination.destination