""" Room Rooooooms """ from evennia import DefaultRoom from evennia import DefaultObject from evennia.locks.lockhandler import check_lockstring from evennia.utils.utils import list_to_string class Room(DefaultRoom): def check_perm(self, caller, permission): return check_lockstring(caller, f"dummy:perm({permission})") def return_appearance(self, looker, exclude=(), **kwargs): """ This is called whenever someone runs the 'look' command. Args: looker (Object): Object doing the looking. **kwargs (dict): Arbitrary, optional arguments for users overriding the call (unused by default). """ output = f"{self.db.desc}" users, other_objs = [], [] contents = self.contents if exclude: contents = list(set(contents) - set(exclude)) for obj in contents: if obj.id == looker.id: continue obj_name = obj.get_numbered_name(1, looker)[0] if obj.is_connected: users.append(obj.get_display_name(looker)) if not obj.destination and not obj.has_account and not obj.db.immovable: other_objs.append(obj_name) if users: output += f"\nThese people are here: {list_to_string(users)}" if other_objs: output += f"\nYou also see: {list_to_string(other_objs)}" admin_only_objs = [] if self.check_perm(looker, 'Admin'): for obj in contents: if obj.id != looker.id: admin_only_objs.append(obj.get_display_name(looker)) if admin_only_objs: output += f"\n\n|xAdmin only: {list_to_string(admin_only_objs)}" return output