changeset 53:7b9f6e3513d4

Added code that checks if the object is the player so certain actions (talk, attack) will not appear in the menu.
author KarstenBock@gmx.net
date Thu, 08 Sep 2011 18:36:40 +0200
parents 3dfd26b1c7ef
children de09adb7a736
files gamescenecontroller.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gamescenecontroller.py	Thu Sep 08 18:23:06 2011 +0200
+++ b/gamescenecontroller.py	Thu Sep 08 18:36:40 2011 +0200
@@ -429,13 +429,13 @@
                         getObjectById(obj_id,
                                       self.model.game_state.current_map_name)
         player = self.model.game_state.getObjectById("PlayerCharacter")
-        
+        is_player = obj.fifeagent.identifier == player.fifeagent.identifier
         
         #TODO: Check all actions to be compatible with the grease components
         if obj is not None:
-            if obj.dialogue:
+            if obj.dialogue and not is_player:
                 actions.append(["Talk", "Talk", self.initTalk, obj])
-            if obj.characterstats:
+            if obj.characterstats and not is_player:
                 actions.append(["Attack", "Attack", self.nullFunc, obj])
             if obj.description:
                 actions.append(["Examine", "Examine",
@@ -452,7 +452,6 @@
                    ChangeMapAction(self, obj.target_map_name,
                                    obj.target_pos)])
             
-            # is it a container?
             if obj.lockable:
                 actions.append(["Open", "Open", 
                                 player.fifeagent.behaviour.approach,
@@ -466,7 +465,6 @@
                                 player.fifeagent.behaviour.approach,
                                 [obj.fifeagent.pos.x, obj.fifeagent.pos.y],
                                 LockBoxAction(self, obj)])
-            # can you pick it up?
             if obj.containable:
                 actions.append(["Pick Up", "Pick Up", 
                                 player.fifeagent.behaviour.approach,