Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.83 KB | None | 0 0
  1. def at_traverse(self, obj, destination):
  2.         """
  3.        TurboliftExit checks to see if it's destination room (which should
  4.        be the Turbolift room) contains an exit which leads to the player's
  5.        current location.  If it does, then the player will be allowed to
  6.        pass through the exit normally.  If there is no such exit, then we
  7.        will add the player's current room to the lift's travel queue, then
  8.        start a ticker (if necessary) to simulate movement of the lift by
  9.        periodically popping a destination off the queue and relinking the
  10.        exit leading out to that destination.
  11.                
  12.        """
  13.         # Find the destination
  14.         lift = self.destination or None
  15.         if not lift:
  16.             utils.cemit("lift-excit", "Turbolift exit ({}) is not linked!".format(self))
  17.             return super().at_traverse(obj, destination)
  18.            
  19.         # Check that the destination is a turbolift
  20.         if not inherits_from(lift, "typeclasses.rooms.Turbolift"):
  21.             utils.cemit_debug("lift-exit", "Turbolift exit ({}) has a destination ({}) that is not a Turbolift!".format(self, self.destination))
  22.             # Dest not a turbolift. Hand off to parent (Exit) for normal processing.
  23.             return super().at_traverse(obj, destination)
  24.         if lift.exit.destination == obj.location:
  25.             # The lift is already at the player's destination. Hand off to the parent.
  26.             return super().at_traverse(obj, destination)
  27.         if not lift.room_is_queued(self.destination):
  28.             obj.msg("You call the lift.")
  29.             self.location.msg_contents("%s calls the lift." % obj.title, exclude=obj)
  30.             self.destination.queue_room(obj.location)
  31.         else:
  32.             obj.msg("This room is already queued.")
  33.            
  34.         return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement