Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is displayed when a player looks at the room.
- def return_appearance(self, looker, **kwargs):
- if not looker:
- return ''
- string = ''
- # Cache the looker's screen width.
- len = looker.screenwidth
- # Note: I want the looker to be the first player in the list so I remove them
- # from the contents list and add them manually to 'players', but only
- # if they're not doing a remote look.
- visible = (con for con in self.contents if con != looker and con.access(looker, "view"))
- exits, players, things, views = [], [], [], []
- if looker.location is self:
- players = [looker]
- # Filter the visible objects into lists based on their type.
- for con in visible:
- if con.destination:
- exits.append(con)
- elif con.has_account:
- if con.sessions > 0:
- players.append(con)
- else:
- things.append(con)
- # Start with the name of the room.
- string += self.format_name(len)
- # Add the description.
- string += self.format_desc(len)
- #string += utils.subheader('', len, nonewline=True)
- # Add players if there are any.
- if players:
- string += self.format_players(len, players, looker)
- # Add non-player things if there are any.
- if things:
- string += self.format_contents(len, things)
- # Add exits if there are any.
- if exits:
- string += self.format_exits(len, exits)
- # Add footer.
- string += self.format_footer(len)
- # Return the formatted string.
- return string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement