Mercurial > parpg-core
comparison src/parpg/gamescenecontroller.py @ 134:c938a828a38a
Added actions for lockable components (Open, Close, Lock and Unlock).
author | KarstenBock@gmx.net |
---|---|
date | Fri, 30 Sep 2011 14:05:16 +0200 |
parents | 0ffebdca7ba3 |
children | 140e5e93f026 |
comparison
equal
deleted
inserted
replaced
133:ecac92680bef | 134:c938a828a38a |
---|---|
26 from fife import extensions | 26 from fife import extensions |
27 | 27 |
28 from controllerbase import ControllerBase | 28 from controllerbase import ControllerBase |
29 from parpg.gui.hud import Hud | 29 from parpg.gui.hud import Hud |
30 from parpg.gui import drag_drop_data as data_drag | 30 from parpg.gui import drag_drop_data as data_drag |
31 from objects.action import ChangeMapAction, ExamineAction, OpenBoxAction, \ | 31 from objects.action import (ChangeMapAction, ExamineAction, TalkAction, |
32 UnlockBoxAction, LockBoxAction, TalkAction, \ | 32 OpenAction, CloseAction, UnlockAction, LockAction, |
33 PickUpAction, DropItemAction | 33 PickUpAction, DropItemAction, |
34 ) | |
34 | 35 |
35 from parpg.world import World | 36 from parpg.world import World |
36 | 37 |
37 #For debugging/code analysis | 38 #For debugging/code analysis |
38 if False: | 39 if False: |
463 [obj_pos.x, obj_pos.y], | 464 [obj_pos.x, obj_pos.y], |
464 ChangeMapAction(self, obj.change_map.target_map, | 465 ChangeMapAction(self, obj.change_map.target_map, |
465 obj.change_map.target_position)]) | 466 obj.change_map.target_position)]) |
466 | 467 |
467 if obj.lockable: | 468 if obj.lockable: |
468 actions.append(["Open", "Open", | 469 if obj.lockable.closed: |
469 player.fifeagent.behaviour.approach, | 470 actions.append(["Open", "Open", |
470 [obj_pos.x, obj_pos.y], | 471 player.fifeagent.behaviour.approach, |
471 OpenBoxAction(self, obj)]) | 472 [obj_pos.x, obj_pos.y], |
472 actions.append(["Unlock", "Unlock", | 473 OpenAction(self, obj)]) |
473 player.fifeagent.behaviour.approach, | 474 else: |
474 [obj_pos.x, obj_pos.y], | 475 actions.append(["Close", "Close", |
475 UnlockBoxAction(self, obj)]) | 476 player.fifeagent.behaviour.approach, |
476 actions.append(["Lock", "Lock", | 477 [obj_pos.x, obj_pos.y], |
477 player.fifeagent.behaviour.approach, | 478 CloseAction(self, obj)]) |
478 [obj_pos.x, obj_pos.y], | 479 if obj.lockable.locked: |
479 LockBoxAction(self, obj)]) | 480 actions.append(["Unlock", "Unlock", |
481 player.fifeagent.behaviour.approach, | |
482 [obj_pos.x, obj_pos.y], | |
483 UnlockAction(self, obj)]) | |
484 else: | |
485 actions.append(["Lock", "Lock", | |
486 player.fifeagent.behaviour.approach, | |
487 [obj_pos.x, obj_pos.y], | |
488 LockAction(self, obj)]) | |
480 if obj.containable: | 489 if obj.containable: |
481 actions.append(["Pick Up", "Pick Up", | 490 actions.append(["Pick Up", "Pick Up", |
482 player.fifeagent.behaviour.approach, | 491 player.fifeagent.behaviour.approach, |
483 [obj_pos.x, obj_pos.y], | 492 [obj_pos.x, obj_pos.y], |
484 PickUpAction(self, obj)]) | 493 PickUpAction(self, obj)]) |