diff gamescenecontroller.py @ 107:100a39fa64a2

Added ExamineContentsAction. Added "Examine Contents" to the context menu, when the object is a container and does not have a characterstats component.
author KarstenBock@gmx.net
date Fri, 30 Sep 2011 15:31:53 +0200
parents c9afad46091b
children 81b51b9d861e
line wrap: on
line diff
--- a/gamescenecontroller.py	Fri Sep 30 15:08:53 2011 +0200
+++ b/gamescenecontroller.py	Fri Sep 30 15:31:53 2011 +0200
@@ -30,7 +30,8 @@
 from parpg.gui import drag_drop_data as data_drag
 from objects.action import (ChangeMapAction, ExamineAction, TalkAction,
                             OpenAction, CloseAction, UnlockAction, LockAction, 
-                            PickUpAction, DropItemAction,
+                            PickUpAction, DropItemAction, 
+                            ExamineContentsAction,
                             )
 
 from parpg.world import World
@@ -486,6 +487,15 @@
                                     player.fifeagent.behaviour.approach,
                                     [obj_pos.x, obj_pos.y],
                                     LockAction(self, obj)])
+            if obj.container:
+                if obj.characterstats:
+                    #TODO: This is reserved for a possible "Steal" action.
+                    pass                
+                elif not obj.lockable or not obj.lockable.closed:
+                    actions.append(["Examine contents", "Examine Contents",
+                                    player.fifeagent.behaviour.approach,
+                                    [obj_pos.x, obj_pos.y],
+                                    ExamineContentsAction(self, obj)])
             if obj.containable:
                 actions.append(["Pick Up", "Pick Up", 
                                 player.fifeagent.behaviour.approach,