

def func(self):
    'Performs the teleport'
    caller = self.caller
    args = self.args
    (lhs, rhs) = (self.lhs, self.rhs)
    switches = self.switches
    tel_quietly = ('quiet' in switches)
    to_none = ('tonone' in switches)
    if to_none:
        if (not args):
            obj_to_teleport = caller
            caller.msg('Teleported to None-location.')
            if (caller.location and (not tel_quietly)):
                caller.location.msg_contents(('%s teleported into nothingness.' % caller), exclude=caller)
        else:
            obj_to_teleport = caller.search(lhs, global_search=True)
            if (not obj_to_teleport):
                caller.msg('Did not find object to teleport.')
                return
            caller.msg(('Teleported %s -> None-location.' % obj_to_teleport))
            if (obj_to_teleport.location and (not tel_quietly)):
                obj_to_teleport.location.msg_contents(('%s teleported %s into nothingness.' % (caller, obj_to_teleport)), exclude=caller)
        obj_to_teleport.location = None
        return
    if ((not args) and (not to_none)):
        caller.msg('Usage: teleport[/switches] [<obj> =] <target_loc>|home')
        return
    if rhs:
        obj_to_teleport = caller.search(lhs, global_search=True)
        destination = caller.search(rhs, global_search=True)
    else:
        obj_to_teleport = caller
        destination = caller.search(lhs, global_search=True)
    if (not obj_to_teleport):
        caller.msg('Did not find object to teleport.')
        return
    if (not destination):
        caller.msg('Destination not found.')
        return
    if (obj_to_teleport == destination):
        caller.msg("You can't teleport an object inside of itself!")
        return
    if (obj_to_teleport.location and (obj_to_teleport.location == destination)):
        caller.msg(('%s is already at %s.' % (obj_to_teleport, destination)))
        return
    use_destination = True
    if ('intoexit' in self.switches):
        use_destination = False
    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))
        else:
            caller.msg(('Teleported %s -> %s.' % (obj_to_teleport, destination)))

dataset/ETHPy150Open evennia/evennia/evennia/commands/default/building.py CmdTeleport.func/original