Mercurial > parpg-source
diff gamescenecontroller.py @ 57:ba85e5aff370
Removed the pos value from the fifeagent component. getItemActions of Gamescenecontroller gets the position by calling a method of the behaviour.
author | KarstenBock@gmx.net |
---|---|
date | Fri, 09 Sep 2011 15:30:23 +0200 |
parents | 7b9f6e3513d4 |
children | 28561412c7e7 |
line wrap: on
line diff
--- a/gamescenecontroller.py Fri Sep 09 15:18:17 2011 +0200 +++ b/gamescenecontroller.py Fri Sep 09 15:30:23 2011 +0200 @@ -20,6 +20,7 @@ import random import glob import os +import logging from fife import fife from fife import extensions @@ -37,7 +38,6 @@ from gamemodel import GameModel from parpg import PARPGApplication -import logging logger = logging.getLogger('gamescenecontroller') @@ -428,9 +428,11 @@ obj = self.model.game_state.\ getObjectById(obj_id, self.model.game_state.current_map_name) + obj_pos = obj.fifeagent.behaviour.getLocation().getLayerCoordinates() 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 and not is_player: @@ -440,7 +442,7 @@ if obj.description: actions.append(["Examine", "Examine", player.fifeagent.behaviour.approach, - [obj.fifeagent.pos.x, obj.fifeagent.pos.y], + [obj_pos.x, obj_pos.y], ExamineAction(self, obj_id, obj.description.view_name, obj.description.desc)]) @@ -448,27 +450,27 @@ if obj.change_map: actions.append(["Change Map", "Change Map", player.fifeagent.behaviour.approach, - [obj.fifeagent.pos.x, obj.fifeagent.pos.y], + [obj_pos.x, obj_pos.y], ChangeMapAction(self, obj.target_map_name, obj.target_pos)]) if obj.lockable: actions.append(["Open", "Open", player.fifeagent.behaviour.approach, - [obj.fifeagent.pos.x, obj.fifeagent.pos.y], + [obj_pos.x, obj_pos.y], OpenBoxAction(self, obj)]) actions.append(["Unlock", "Unlock", player.fifeagent.behaviour.approach, - [obj.fifeagent.pos.x, obj.fifeagent.pos.y], + [obj_pos.x, obj_pos.y], UnlockBoxAction(self, obj)]) actions.append(["Lock", "Lock", player.fifeagent.behaviour.approach, - [obj.fifeagent.pos.x, obj.fifeagent.pos.y], + [obj_pos.x, obj_pos.y], LockBoxAction(self, obj)]) if obj.containable: actions.append(["Pick Up", "Pick Up", player.fifeagent.behaviour.approach, - [obj.fifeagent.pos.x, obj.fifeagent.pos.y], + [obj_pos.x, obj_pos.y], PickUpAction(self, obj)]) return actions