Mercurial > parpg-core
comparison src/parpg/gamemodel.py @ 157:db6403c1a7a1
Fixed that dropped items cannot be picked up.
author | KarstenBock@gmx.net |
---|---|
date | Fri, 07 Oct 2011 14:36:36 +0200 |
parents | 7214224b8d83 |
children | d1f9652d0651 |
comparison
equal
deleted
inserted
replaced
156:04de7f38429a | 157:db6403c1a7a1 |
---|---|
667 self.object_db.update(object_info) | 667 self.object_db.update(object_info) |
668 | 668 |
669 def updateObjectDB(self, world): | 669 def updateObjectDB(self, world): |
670 """Updates the values in the object database with the worlds values""" | 670 """Updates the values in the object database with the worlds values""" |
671 | 671 |
672 all_agents = self.agents[self.ALL_AGENTS_KEY] | |
672 for entity in world.entities: | 673 for entity in world.entities: |
673 identifier = entity.general.identifier | 674 identifier = entity.general.identifier |
674 agent_data = {} | 675 agent_data = {} |
675 map_id = self.game_state.getMapOfObject(identifier) | 676 map_id = self.game_state.getMapOfObject(identifier) |
676 if map_id: | 677 if map_id: |
677 if self.agents[self.ALL_AGENTS_KEY].has_key(identifier): | 678 if all_agents.has_key(identifier): |
678 agent_data = self.agents[self.ALL_AGENTS_KEY][identifier] | 679 agent_data = self.agents[self.ALL_AGENTS_KEY][identifier] |
679 else: | 680 else: |
680 agent_data = self.agents[map_id][identifier] | 681 agent_data = self.agents[map_id][identifier] |
682 | |
681 else: | 683 else: |
682 if not self.items.has_key(identifier): | 684 if not self.items.has_key(identifier): |
683 self.items[identifier] = {} | 685 self.items[identifier] = {} |
684 agent_data = self.items[identifier] | 686 agent_data = self.items[identifier] |
685 entity_data = {} | 687 entity_data = {} |
702 if entity.fifeagent.layer: | 704 if entity.fifeagent.layer: |
703 layer = entity.fifeagent.layer | 705 layer = entity.fifeagent.layer |
704 inst = layer.getInstance(identifier) | 706 inst = layer.getInstance(identifier) |
705 loc = inst.getLocation().getExactLayerCoordinates() | 707 loc = inst.getLocation().getExactLayerCoordinates() |
706 agent_data["Position"] = (loc.x, loc.y, loc.z) | 708 agent_data["Position"] = (loc.x, loc.y, loc.z) |
707 agent_data["Map"] = map_id | 709 if all_agents.has_key(identifier): |
710 agent_data["Map"] = map_id | |
708 agent_data["Rotation"] = inst.getRotation() | 711 agent_data["Rotation"] = inst.getRotation() |
709 elif name == "container" and hasattr(comp_vals, | 712 elif name == "container" and hasattr(comp_vals, |
710 "children"): | 713 "children"): |
711 inventory_data = {} | 714 inventory_data = {} |
712 inventory_data["Slots"] = len(comp_vals.children) | 715 inventory_data["Slots"] = len(comp_vals.children) |