changeset 115:26e65f27dbd7

"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 8bb84164e6a2
children 7f7f54c4077b
files gamescenecontroller.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gamescenecontroller.py	Mon Oct 03 13:05:23 2011 +0200
+++ b/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.