Mercurial > parpg-core
diff src/parpg/gamemodel.py @ 120:1703dbb4fefb
Added Behaviour component.
Fixed updateObjectDB of GameModel storing values about components the Entity doesn't have.
author | KarstenBock@gmx.net |
---|---|
date | Tue, 27 Sep 2011 15:23:43 +0200 |
parents | 3564a46544bc |
children | 21dd4da40eab |
line wrap: on
line diff
--- a/src/parpg/gamemodel.py Tue Sep 27 14:58:03 2011 +0200 +++ b/src/parpg/gamemodel.py Tue Sep 27 15:23:43 2011 +0200 @@ -437,9 +437,10 @@ target = fife.Location(self.active_map.agent_layer) inst.act('default', target, True) - - if entity_data["fifeagent"].has_key("behaviour"): - entity_data["fifeagent"]["behaviour"] = getattr(behaviours, entity_data["fifeagent"]["behaviour"])() + if entity_data.has_key("behaviour"): + entity_data["fifeagent"]["behaviour"] = \ + getattr(behaviours, + entity_data["behaviour"]["behaviour_type"])() else: entity_data["fifeagent"]["behaviour"] = behaviours.Base() if self.dialogues.has_key(inst_id): @@ -674,7 +675,7 @@ entity_data = {} entity_data["general"] = {"identifier": identifier} for name, component in components.components.iteritems(): - if hasattr(entity, name): + if getattr(entity, name): comp_data = {} if name == "fifeagent": if agent_data["Entity"].has_key("fifeagent"): @@ -701,7 +702,8 @@ #The entity doesn't have this specific value, #ignore it pass - entity_data[name] = comp_data + if comp_data: + entity_data[name] = comp_data agent_data["Entity"] = entity_data