Advertisement
Kovitikus

look crowd

Sep 6th, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.48 KB | None | 0 0
  1. # In Game Result
  2. """
  3. ------------------------------------------------------------------------------
  4. Name/key: a dimly lit hallway (#195)
  5. Typeclass: Room (typeclasses.rooms.Room)
  6. Location: None
  7. Home: Limbo (#2)
  8. Permissions: <None>
  9. Locks:      call:true(); control:id(44) or perm(Admin);  delete:id(44) or
  10.      perm(Admin);  edit:id(44) or perm(Admin); examine:perm(Builder);
  11.      get:false(); puppet:false(); tell:perm(Admin); view:all()
  12. Exits: south(#197), west(#213)
  13. Characters: Tester(#6), Bob(#44)
  14. ------------------------------------------------------------------------------
  15. a dimly lit hallway updated its existing typeclass (typeclasses.rooms.Room).
  16. Only the at_object_creation hook was run (update mode). Attributes set before swap were not removed.
  17. ------------------------------------------------------------------------------
  18. Name/key: a dimly lit hallway (#195)
  19. Typeclass: Room (typeclasses.rooms.Room)
  20. Location: None
  21. Home: Limbo (#2)
  22. Permissions: <None>
  23. Locks:      call:true(); control:id(44) or perm(Admin);  delete:id(44) or
  24.      perm(Admin);  edit:id(44) or perm(Admin); examine:perm(Builder);
  25.      get:false(); puppet:false(); tell:perm(Admin); view:all()
  26. Persistent attributes:
  27. short_desc = |rShort Description Not Set!|n
  28. crowd = False
  29. Exits: south(#197), west(#213)
  30. Characters: Tester(#6), Bob(#44)
  31. ------------------------------------------------------------------------------
  32. Modified attribute a dimly lit hallway/crowd = True
  33.    You see a dimly lit hallway(#195).
  34.    You see Hoff's Bar to the south(#197), and a door to the west(#213).
  35.    Tester(#6) is here.
  36. You look over the crowd and spot a merchant, a priest, a soldier, a prostitute and a fisherman.
  37. """
  38.  
  39. class CmdLook(Command):
  40.     """
  41.    look at location or object
  42.    Usage:
  43.      look
  44.      look <obj>
  45.      look *<account>
  46.    Observes your location or objects in your vicinity.
  47.    """
  48.     key = "look"
  49.     aliases = ["l", "ls"]
  50.     locks = "cmd:all()"
  51.    
  52.     def func(self):
  53.         """
  54.        Handle the looking.
  55.        """
  56.         caller = self.caller
  57.         if not self.args:
  58.             target = caller.location
  59.             if not target:
  60.                 caller.msg("You have no location to look at!")
  61.                 return
  62.         else:
  63.             args = self.args.strip()
  64.             if args == 'crowd':
  65.                 self.caller.location.crowd(self.caller)
  66.                 return
  67.             else:
  68.                 target = caller.search(args, location=[caller, caller.location])
  69.                 if not target:
  70.                     return
  71.         self.msg((caller.at_look(target), {'type': 'look'}), options=None)
  72.  
  73. class Room(DefaultRoom):
  74.     """
  75.    Rooms are like any Object, except their location is None
  76.    (which is default). They also use basetype_setup() to
  77.    add locks so they cannot be puppeted or picked up.
  78.    (to change that, use at_object_creation instead)
  79.  
  80.    See examples/object.py for a list of
  81.    properties and methods available on all Objects.
  82.    """
  83.     def at_object_creation(self):
  84.         if not self.attributes.has('short_desc'):
  85.             self.attributes.add('short_desc', '|rShort Description Not Set!|n')
  86.         if not self.attributes.has('crowd'):
  87.             self.attributes.add('crowd', False)
  88.  
  89.     def crowd(self, looker):
  90.         people = ['a merchant', 'a priest', 'a soldier', 'a prostitute', 'a fisherman']
  91.         if self.db.crowd:
  92.             looker.msg(f"You look over the crowd and spot {list_to_string(people)}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement