Mercurial > parpg-source
comparison 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 |
comparison
equal
deleted
inserted
replaced
84:bb9e2f2548c6 | 85:04af237dde10 |
---|---|
19 | 19 |
20 logger = logging.getLogger('action') | 20 logger = logging.getLogger('action') |
21 | 21 |
22 from parpg.gui import drag_drop_data as data_drag | 22 from parpg.gui import drag_drop_data as data_drag |
23 from parpg.dialoguecontroller import DialogueController | 23 from parpg.dialoguecontroller import DialogueController |
24 from parpg.components import container | |
25 | |
24 | 26 |
25 class NoSuchQuestException(Exception): | 27 class NoSuchQuestException(Exception): |
26 """NoQuestException is used when there is no active quest with the id""" | 28 """NoQuestException is used when there is no active quest with the id""" |
27 pass | 29 pass |
28 | 30 |
371 super(UseAction, self).execute() | 373 super(UseAction, self).execute() |
372 | 374 |
373 class PickUpAction(Action): | 375 class PickUpAction(Action): |
374 """Action for picking up items from a map""" | 376 """Action for picking up items from a map""" |
375 | 377 |
376 def __init__(self, controller, map_item, commands = None): | 378 def __init__(self, controller, item, commands = None): |
377 super(PickUpAction, self).__init__(controller, commands) | 379 super(PickUpAction, self).__init__(controller, commands) |
378 self.map_item = map_item | 380 self.item = item |
379 self.view = controller.view | 381 self.view = controller.view |
380 | 382 |
381 def execute(self): | 383 def execute(self): |
382 real_item = self.map_item.item | 384 real_item = self.item.containable |
383 self.model.deleteObject(self.map_item.ID) | 385 player = self.model.game_state.getObjectById("PlayerCharacter") |
384 self.model.game_state.getObjectById("PlayerCharacter").fifeagent.\ | 386 self.model.moveObject(self.item.fifeagent.identifier, None) |
385 inventory.placeItem(real_item) | 387 container.put_item(player.container, real_item) |
386 self.view.hud.inventory.updateInventoryButtons() | |
387 super(PickUpAction, self).execute() | 388 super(PickUpAction, self).execute() |
388 | 389 |
389 class DropItemAction(Action): | 390 class DropItemAction(Action): |
390 """Action for dropping an items on a map""" | 391 """Action for dropping an items on a map""" |
391 def __init__(self, controller, item, commands = None): | 392 def __init__(self, controller, item, commands = None): |