Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def at_traverse(self, obj, destination):
- """
- TurboliftExit checks to see if it's destination room (which should
- be the Turbolift room) contains an exit which leads to the player's
- current location. If it does, then the player will be allowed to
- pass through the exit normally. If there is no such exit, then we
- will add the player's current room to the lift's travel queue, then
- start a ticker (if necessary) to simulate movement of the lift by
- periodically popping a destination off the queue and relinking the
- exit leading out to that destination.
- """
- # Find the destination
- lift = self.destination or None
- if not lift:
- utils.cemit("lift-excit", "Turbolift exit ({}) is not linked!".format(self))
- return super().at_traverse(obj, destination)
- # Check that the destination is a turbolift
- if not inherits_from(lift, "typeclasses.rooms.Turbolift"):
- utils.cemit_debug("lift-exit", "Turbolift exit ({}) has a destination ({}) that is not a Turbolift!".format(self, self.destination))
- # Dest not a turbolift. Hand off to parent (Exit) for normal processing.
- return super().at_traverse(obj, destination)
- if lift.exit.destination == obj.location:
- # The lift is already at the player's destination. Hand off to the parent.
- return super().at_traverse(obj, destination)
- if not lift.room_is_queued(self.destination):
- obj.msg("You call the lift.")
- self.location.msg_contents("%s calls the lift." % obj.title, exclude=obj)
- self.destination.queue_room(obj.location)
- else:
- obj.msg("This room is already queued.")
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement