diff src/parpg/gamescenecontroller.py @ 145:3dddf09377b8

"Open" will now not be shown in the context menu when the lockable is locked. "Lock" will not not be shown in the context menu when the lockable is open.
author KarstenBock@gmx.net
date Mon, 03 Oct 2011 14:12:17 +0200
parents c9fba51214ed
children 6e1eb964a6e5
line wrap: on
line diff
--- a/src/parpg/gamescenecontroller.py	Mon Oct 03 13:05:23 2011 +0200
+++ b/src/parpg/gamescenecontroller.py	Mon Oct 03 14:12:17 2011 +0200
@@ -467,10 +467,11 @@
             
             if obj.lockable:
                 if obj.lockable.closed:
-                    actions.append(["Open", "Open", 
-                                    player.fifeagent.behaviour.approach,
-                                    [obj_pos.x, obj_pos.y],
-                                    OpenAction(self, obj)])
+                    if not obj.lockable.locked:
+                        actions.append(["Open", "Open", 
+                                        player.fifeagent.behaviour.approach,
+                                        [obj_pos.x, obj_pos.y],
+                                        OpenAction(self, obj)])
                 else:
                     actions.append(["Close", "Close", 
                                     player.fifeagent.behaviour.approach,
@@ -482,10 +483,11 @@
                                     [obj_pos.x, obj_pos.y],
                                     UnlockAction(self, obj)])
                 else:
-                    actions.append(["Lock", "Lock", 
-                                    player.fifeagent.behaviour.approach,
-                                    [obj_pos.x, obj_pos.y],
-                                    LockAction(self, obj)])
+                    if obj.lockable.closed:
+                        actions.append(["Lock", "Lock", 
+                                        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.