diff objects/action.py @ 85:04af237dde10

Fixed PickUpAction. Items can be picked up again.
author KarstenBock@gmx.net
date Fri, 23 Sep 2011 15:09:02 +0200
parents de09adb7a736
children a9cc5559ec2a
line wrap: on
line diff
--- a/objects/action.py	Fri Sep 23 15:08:27 2011 +0200
+++ b/objects/action.py	Fri Sep 23 15:09:02 2011 +0200
@@ -21,6 +21,8 @@
 
 from parpg.gui import drag_drop_data as data_drag
 from parpg.dialoguecontroller import DialogueController
+from parpg.components import container
+
 
 class NoSuchQuestException(Exception):
     """NoQuestException is used when there is no active quest with the id"""
@@ -373,17 +375,16 @@
 class PickUpAction(Action):
     """Action for picking up items from a map"""
 
-    def __init__(self, controller, map_item, commands = None):
+    def __init__(self, controller, item, commands = None):
         super(PickUpAction, self).__init__(controller, commands)
-        self.map_item = map_item
+        self.item = item
         self.view = controller.view
         
     def execute(self):
-        real_item = self.map_item.item
-        self.model.deleteObject(self.map_item.ID)
-        self.model.game_state.getObjectById("PlayerCharacter").fifeagent.\
-                                inventory.placeItem(real_item)
-        self.view.hud.inventory.updateInventoryButtons()
+        real_item = self.item.containable
+        player = self.model.game_state.getObjectById("PlayerCharacter")
+        self.model.moveObject(self.item.fifeagent.identifier, None)
+        container.put_item(player.container, real_item)
         super(PickUpAction, self).execute()
 
 class DropItemAction(Action):