# HG changeset patch # User KarstenBock@gmx.net # Date 1317990996 -7200 # Node ID 18623b5c2b45a2f8bee995410b7140b03d1d5d52 # Parent f7543a85c2ea9a70886de7bb98207610b22d52ee Fixed that dropped items cannot be picked up. diff -r f7543a85c2ea -r 18623b5c2b45 gamemodel.py --- a/gamemodel.py Fri Oct 07 14:16:21 2011 +0200 +++ b/gamemodel.py Fri Oct 07 14:36:36 2011 +0200 @@ -669,15 +669,17 @@ def updateObjectDB(self, world): """Updates the values in the object database with the worlds values""" + all_agents = self.agents[self.ALL_AGENTS_KEY] for entity in world.entities: identifier = entity.general.identifier agent_data = {} map_id = self.game_state.getMapOfObject(identifier) if map_id: - if self.agents[self.ALL_AGENTS_KEY].has_key(identifier): + if all_agents.has_key(identifier): agent_data = self.agents[self.ALL_AGENTS_KEY][identifier] else: agent_data = self.agents[map_id][identifier] + else: if not self.items.has_key(identifier): self.items[identifier] = {} @@ -704,7 +706,8 @@ inst = layer.getInstance(identifier) loc = inst.getLocation().getExactLayerCoordinates() agent_data["Position"] = (loc.x, loc.y, loc.z) - agent_data["Map"] = map_id + if all_agents.has_key(identifier): + agent_data["Map"] = map_id agent_data["Rotation"] = inst.getRotation() elif name == "container" and hasattr(comp_vals, "children"): diff -r f7543a85c2ea -r 18623b5c2b45 objects/action.py --- a/objects/action.py Fri Oct 07 14:16:21 2011 +0200 +++ b/objects/action.py Fri Oct 07 14:36:36 2011 +0200 @@ -432,8 +432,10 @@ ) agent_values["Position"] = (coords.x, coords.y) agent_values["Rotation"] = 0 + agent_values["Map"] = map_name self.model.deleteObject(identifier) - self.model.addAgent(map_name, {identifier: agent_values}) + self.model.addAgent(self.model.ALL_AGENTS_KEY, + {identifier: agent_values}) self.model.placeAgents(self.item.entity.world) self.model.updateObjectDB(self.item.entity.world) super(DropItemAction, self).execute()