Changeset 114 for adventure/world.py

Show
Ignore:
Timestamp:
10/14/07 17:08:42 (3 years ago)
Author:
elghinn
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • adventure/world.py

    r112 r114  
    4949 
    5050    def move_thing(self, thing, newplace): 
    51         for t in each_thing_by_place(thing.place): 
     51        for t in self.each_thing_by_place(thing.place): 
    5252            # Call leave hooks 
    5353            t.on_leave(thing, newplace) 
     
    7373        thing.place = newplace 
    7474 
    75         for t in each_thing_by_place(thing.place): 
     75        for t in self.each_thing_by_place(thing.place): 
    7676            # Broadcast availability presence to enterer 
    7777            if t.presence: 
     
    9595        thing.see(place(newplace)) 
    9696 
    97         for t in each_thing_by_place(thing.place): 
     97        for t in self.each_thing_by_place(thing.place): 
    9898            # Call enter hooks 
    9999            t.on_enter(thing, oldplace) 
    100100 
    101     def handle_presence(pres): 
     101    def handle_presence(self, _, pres): 
    102102        # A help for the irritated first: 
    103103        if pres.getType() == 'subscribe': 
     
    139139            player.presence = pres 
    140140            self.players[player.name] = player 
    141             move_thing(player, attributes['start']) 
     141            self.move_thing(player, self.start) 
    142142            player.send_message('Help!', 'Send "?" to get a list of available commands any time.') 
    143143        # Or broadcast updated presence 
     
    145145            player.presence = pres 
    146146 
    147             for t in each_thing_by_place(player.place): 
     147            for t in self.each_thing_by_place(player.place): 
    148148                # Broadcast presence to all who are here 
    149149                pres = Presence(node=player.presence) 
     
    156156            del self.players[player.name] 
    157157 
    158     def handle_message(msg): 
     158    def handle_message(self, _, msg): 
    159159        player = None 
    160160        for thing in self.things.values(): 
     
    170170 
    171171        if not command(player, msg.getBody()): 
    172             for thing in each_thing_by_place(player.place): 
     172            for thing in self.each_thing_by_place(player.place): 
    173173                thing.send_message(player.iname, msg.body) 
    174174 
    175     def command(player, text): 
     175    def command(self, player, text): 
    176176        if text == '?': 
    177177            player.send_message(None, '(Command) who') 
     
    195195                newplace = None 
    196196 
    197                 for go in oldplace.each_element('go'): 
    198                     if go.attributes['spec'] == what: 
    199                         newplace = go.attributes['place'] 
     197                for name, place in oldplace.exits.items(): 
     198                    if name == what: 
     199                        newplace = place 
    200200 
    201201                if newplace: 
    202                     move_thing(player, newplace) 
     202                    self.move_thing(player, newplace) 
    203203                else: 
    204204                    player.send_message(None, 'You cannot go there')