Mercurial > parpg-source
comparison gamemodel.py @ 90:4a8a0cd7f79a
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 | 939984cff702 |
children | 84b5808d995c |
comparison
equal
deleted
inserted
replaced
89:939984cff702 | 90:4a8a0cd7f79a |
---|---|
435 | 435 |
436 if (map_obj.getAction('default')): | 436 if (map_obj.getAction('default')): |
437 target = fife.Location(self.active_map.agent_layer) | 437 target = fife.Location(self.active_map.agent_layer) |
438 inst.act('default', target, True) | 438 inst.act('default', target, True) |
439 | 439 |
440 | 440 if entity_data.has_key("behaviour"): |
441 if entity_data["fifeagent"].has_key("behaviour"): | 441 entity_data["fifeagent"]["behaviour"] = \ |
442 entity_data["fifeagent"]["behaviour"] = getattr(behaviours, entity_data["fifeagent"]["behaviour"])() | 442 getattr(behaviours, |
443 entity_data["behaviour"]["behaviour_type"])() | |
443 else: | 444 else: |
444 entity_data["fifeagent"]["behaviour"] = behaviours.Base() | 445 entity_data["fifeagent"]["behaviour"] = behaviours.Base() |
445 if self.dialogues.has_key(inst_id): | 446 if self.dialogues.has_key(inst_id): |
446 entity_data["dialogue"] = {} | 447 entity_data["dialogue"] = {} |
447 entity_data["dialogue"]["dialogue"] = self.dialogues[inst_id] | 448 entity_data["dialogue"]["dialogue"] = self.dialogues[inst_id] |
672 agent_data = self.agents[map_id][identifier] | 673 agent_data = self.agents[map_id][identifier] |
673 | 674 |
674 entity_data = {} | 675 entity_data = {} |
675 entity_data["general"] = {"identifier": identifier} | 676 entity_data["general"] = {"identifier": identifier} |
676 for name, component in components.components.iteritems(): | 677 for name, component in components.components.iteritems(): |
677 if hasattr(entity, name): | 678 if getattr(entity, name): |
678 comp_data = {} | 679 comp_data = {} |
679 if name == "fifeagent": | 680 if name == "fifeagent": |
680 if agent_data["Entity"].has_key("fifeagent"): | 681 if agent_data["Entity"].has_key("fifeagent"): |
681 comp_data = agent_data["Entity"]["fifeagent"] | 682 comp_data = agent_data["Entity"]["fifeagent"] |
682 if entity.fifeagent.layer: | 683 if entity.fifeagent.layer: |
699 comp_data[field] = getattr(comp_vals, field) | 700 comp_data[field] = getattr(comp_vals, field) |
700 except AttributeError: | 701 except AttributeError: |
701 #The entity doesn't have this specific value, | 702 #The entity doesn't have this specific value, |
702 #ignore it | 703 #ignore it |
703 pass | 704 pass |
704 entity_data[name] = comp_data | 705 if comp_data: |
706 entity_data[name] = comp_data | |
705 agent_data["Entity"] = entity_data | 707 agent_data["Entity"] = entity_data |
706 | 708 |
707 | 709 |
708 def getAgentImportFiles(self): | 710 def getAgentImportFiles(self): |
709 """Searches the agents directory for import files """ | 711 """Searches the agents directory for import files """ |