diff gamemodel.py @ 92:84b5808d995c

Added Graphics component.
author KarstenBock@gmx.net
date Tue, 27 Sep 2011 15:50:28 +0200
parents 4a8a0cd7f79a
children c0db5f521695
line wrap: on
line diff
--- a/gamemodel.py	Tue Sep 27 15:38:24 2011 +0200
+++ b/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: