

def func(self):
    'Perform the link'
    caller = self.caller
    if (not self.args):
        caller.msg('Usage: @link[/twoway] <object> = <target>')
        return
    object_name = self.lhs
    obj = caller.search(self, global_search=True)
    if (not obj):
        return
    string = ''
    if self.rhs:
        target = caller.search(self.rhs, global_search=True)
        if (not target):
            return
        string = ''
        if (not obj.destination):
            string += ('Note: %s(%s) did not have a destination set before. Make sure you linked the right thing.' % (obj.name, obj.dbref))
        if ('twoway' in self.switches):
            if (not (target.location and obj.location)):
                string = ('To create a two-way link, %s and %s must both have a location' % (obj, target))
                string += ' (i.e. they cannot be rooms, but should be exits).'
                self.caller.msg(string)
                return
            if (not target.destination):
                string += ('\nNote: %s(%s) did not have a destination set before. Make sure you linked the right thing.' % (target.name, target.dbref))
            obj.destination = target.location
            target.destination = obj.location
            string += ('\nLink created %s (in %s) <-> %s (in %s) (two-way).' % (obj.name, obj.location, target.name, target.location))
        else:
            obj.destination = target
            string += ('\nLink created %s -> %s (one way).' % (obj.name, target))
    elif (self.rhs is None):
        dest = obj.destination
        if dest:
            string = ('%s is an exit to %s.' % (obj.name, dest.name))
        else:
            string = ('%s is not an exit. Its home location is %s.' % (obj.name, obj.home))
    elif obj.destination:
        obj.destination = None
        string = ('Former exit %s no longer links anywhere.' % obj.name)
    else:
        string = ('%s had no destination to unlink.' % obj.name)
    caller.msg(string.strip())

dataset/ETHPy150Open evennia/evennia/evennia/commands/default/building.py CmdLink.func/VarMisuse@50/79 `object_name`->`self`