# HG changeset patch # User KarstenBock@gmx.net # Date 1317131428 -7200 # Node ID 21dd4da40eab996f1cbc570f2b1031633b69250a # Parent 24edf5d530839de8693745c89979862e4804265c Added Graphics component. diff -r 24edf5d53083 -r 21dd4da40eab src/parpg/components/__init__.py --- a/src/parpg/components/__init__.py Tue Sep 27 15:38:24 2011 +0200 +++ b/src/parpg/components/__init__.py Tue Sep 27 15:50:28 2011 +0200 @@ -11,6 +11,7 @@ from equip import Equip from general import General from behaviour import Behaviour +from graphics import Graphics components = { "general": General(), @@ -26,4 +27,5 @@ "equipable": Equipable(), "equip": Equip(), "behaviour": Behaviour(), + "graphics": Graphics(), } \ No newline at end of file diff -r 24edf5d53083 -r 21dd4da40eab src/parpg/components/graphics.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parpg/components/graphics.py Tue Sep 27 15:50:28 2011 +0200 @@ -0,0 +1,22 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from base import Base + + +class Graphics(Base): + """Component that stores the values for the graphical representation""" + + def __init__(self): + """Constructor""" + Base.__init__(self, gfx=str) \ No newline at end of file diff -r 24edf5d53083 -r 21dd4da40eab src/parpg/gamemodel.py --- a/src/parpg/gamemodel.py Tue Sep 27 15:38:24 2011 +0200 +++ b/src/parpg/gamemodel.py Tue Sep 27 15:50:28 2011 +0200 @@ -334,11 +334,11 @@ agent[unique_agent_id] = agent_values self.agents[namespace].update(agent) object_model = "" - if agent_values["Entity"].has_key("fifeagent") \ - and agent_values["Entity"]["fifeagent"].has_key("gfx"): - object_model = agent_values["Entity"]["fifeagent"]["gfx"] + if agent_values["Entity"].has_key("graphics") \ + and agent_values["Entity"]["graphics"].has_key("gfx"): + object_model = agent_values["Entity"]["graphics"]["gfx"] else: - object_model = self.object_db[agent_values["Template"]]["fifeagent"]["gfx"] + object_model = self.object_db[agent_values["Template"]]["graphics"]["gfx"] import_file = self.agent_import_files[object_model] loadImportFile(self.obj_loader, import_file, self.engine) @@ -400,10 +400,11 @@ def createAgent(self, agent, inst_id, world): entity_data = deepcopy(agent["Entity"]) + entity_data["fifeagent"] = {} if agent.has_key("Template"): entity_data = self.checkAttributes(entity_data, agent["Template"]) - object_id = entity_data["fifeagent"]["gfx"] \ - if entity_data["fifeagent"].has_key("gfx") \ + object_id = entity_data["graphics"]["gfx"] \ + if entity_data["graphics"].has_key("gfx") \ else "generic_item" map_obj = self.fife_model.getObject(str(object_id), "PARPG") if not map_obj: