def destroy(self): 'Get rid of this exit.' if self.room is not None: self.room.rmexit(self) remove(self) TZObj.destroy(self)
def __init__(self, name='', short='', long='', room=None, destination=None, return_name=''): from share import Deprecated raise Deprecated TZObj.__init__(self, name, short, long) self._rid = None self.room = room self.weight = 0 self.locked = False if room is not None: room.addexit(self) self.destination = destination if return_name and destination is not None: x = destination.exitname(return_name) if x is not None: x.destination = room else: x = Exit(return_name, room=destination, destination=room) self.link(x) self._keys = PersistentList() add(self)
def destroy(self): 'Get rid of this item and remove it from the index.' container = self.container room = self.room if container is not None: container.remove(self) remove(self) TZObj.destroy(self) if room is not None: room.action(dict(act='destroy_item', delay=0.4, actor=None, item=self))
def __copy__(self): newx = TZObj.__copy__(self) newx.room = self.room newx.destination = self.destination for _key in self._keys: newx._keys.append(_key) return newx
def act_near(self, info): '''Something has happened in this room. Handle it if necessary, and pass the action on to any contained items. ''' TZObj.act_near(self, info) for player in self.players(): player.act_near(info) for mob in self.mobs(): mob.act_near(info) for item in self.items(): item.act_near(info) for x in self.exits(): x.act_near(info)
def look(self, s): '''Return a multiline message (list of strings) to a player looking at this exit. ''' if self.short or self.long: msgs = TZObj.look(self, s) else: msgs = [] if self._destid is None or self.destination is None: msgs.append('Broken exit.') else: if not self.locked: msgs.append(u'Exit %s to %s.' % (unicode(self), self.destination)) else: msgs.append(u'The exit %s is locked.' % self) return msgs
def __str__(self): 'Return the colorized name of this exit.' name = TZObj.__str__(self) return yellow(name)
def act_near(self, info): TZObj.act_near(self, info)
def __str__(self): 'Returns the colorized name of this item.' name = TZObj.__str__(self) return green(name)
def __init__(self, name='', short='', long='', owner=None): 'Initialize this item, and add it to the item index.' TZObj.__init__(self, name, short, long, owner) add(self)