# HG changeset patch # User KarstenBock@gmx.net # Date 1315575023 -7200 # Node ID ba85e5aff37089dfe0351544017cca16516693ea # Parent 3f6299f975fed15dd33effd5f2e144315a7c258e Removed the pos value from the fifeagent component. getItemActions of Gamescenecontroller gets the position by calling a method of the behaviour. diff -r 3f6299f975fe -r ba85e5aff370 components/fifeagent.py --- a/components/fifeagent.py Fri Sep 09 15:18:17 2011 +0200 +++ b/components/fifeagent.py Fri Sep 09 15:30:23 2011 +0200 @@ -12,14 +12,13 @@ # along with this program. If not, see . from bGrease.component import Component -from bGrease.geometry import Vec2d class FifeAgent(Component): """Component that stores the values for a fife agent""" def __init__(self): """Constructor""" - Component.__init__(self, identifier=str, layer=object, behaviour=object, gfx=str, pos=Vec2d) + Component.__init__(self, identifier=str, layer=object, behaviour=object, gfx=str) def setup_behaviour(agent): diff -r 3f6299f975fe -r ba85e5aff370 entities/character.py --- a/entities/character.py Fri Sep 09 15:18:17 2011 +0200 +++ b/entities/character.py Fri Sep 09 15:30:23 2011 +0200 @@ -17,7 +17,7 @@ class Character(Entity): def __init__(self, world, view_name, real_name, desc, statistics, max_bulk, identifier, layer=None, behaviour=None, dialogue=None, - gfx=None, pos=Vec2d(0.0, 0.0), items=None + gfx=None, items=None ): self.characterstats.statistics = statistics @@ -34,4 +34,3 @@ self.fifeagent.layer = layer self.fifeagent.behaviour = behaviour self.fifeagent.gfx = gfx - self.fifeagent.pos = pos diff -r 3f6299f975fe -r ba85e5aff370 gamemodel.py --- a/gamemodel.py Fri Sep 09 15:18:17 2011 +0200 +++ b/gamemodel.py Fri Sep 09 15:30:23 2011 +0200 @@ -502,7 +502,6 @@ inst_dict["identifier"] = inst_id inst_dict["world"]= world inst_dict["type"] = object_type - inst_dict["pos"] = Vec2d(x_pos, y_pos) inst_dict["gfx"] = object_id if agent.has_key("Open"): inst_dict["is_open"] = parseBool(agent["Open"]) diff -r 3f6299f975fe -r ba85e5aff370 gamescenecontroller.py --- 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