Ignore:
Timestamp:
07/23/10 14:12:29 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

  • Items lying on the map can now be picked up. (Items can't be dropped on the map yet though)
  • Every Agent is now given a unique ID if the original is already used. This is needed for the items to be correctly removed from the map in savegames. Note: Savegames have NOT become incompatible in this revision.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/objects/action.py

    r584 r595  
    284284        super(UseAction, self).execute() 
    285285 
     286class PickUpAction(Action): 
     287    """Action for picking up items from a map""" 
     288 
     289    def __init__(self, controller, map_item, commands = None): 
     290        super(PickUpAction, self).__init__(controller, commands) 
     291        self.view = controller.view 
     292        self.map_item = map_item 
     293 
     294    def execute(self): 
     295        real_item = self.model.createContainerObject(self.map_item.item) 
     296        self.model.deleteObject(self.map_item.ID) 
     297        self.model.game_state.player_character.\ 
     298                                inventory.placeItem(real_item) 
     299        super(PickUpAction, self).execute() 
     300         
    286301ACTIONS = {"ChangeMap":ChangeMapAction,  
    287302           "OpenBox":OpenBoxAction,  
     
    292307           "Read":ReadAction, 
    293308           "Talk":TalkAction, 
    294            "Use":UseAction} 
     309           "Use":UseAction, 
     310           "PickUp":PickUpAction} 
Note: See TracChangeset for help on using the changeset viewer.