Mercurial > parpg-core
comparison src/parpg/objects/action.py @ 146:6e1eb964a6e5
Fixed dropping items on the map.
author | KarstenBock@gmx.net |
---|---|
date | Mon, 03 Oct 2011 18:25:31 +0200 |
parents | 140e5e93f026 |
children | 7214224b8d83 |
comparison
equal
deleted
inserted
replaced
145:3dddf09377b8 | 146:6e1eb964a6e5 |
---|---|
423 super(DropItemAction, self).__init__(controller, commands) | 423 super(DropItemAction, self).__init__(controller, commands) |
424 self.item = item | 424 self.item = item |
425 | 425 |
426 def execute(self): | 426 def execute(self): |
427 map_name = self.model.game_state.current_map_name | 427 map_name = self.model.game_state.current_map_name |
428 map_item_values = {} | 428 identifier = self.item.entity.general.identifier |
429 map_item_values["ViewName"] = self.item.name | 429 agent_values = self.model.items[identifier] |
430 map_item_values["ObjectType"] = "MapItem" | 430 coords = (self.model.game_state.getObjectById("PlayerCharacter"). |
431 map_item_values["ItemType"] = self.item.item_type | 431 fifeagent.behaviour.getLocation().getExactLayerCoordinates() |
432 map_item_values["Map"] = map_name | 432 ) |
433 coords = self.model.game_state.getObjectById("PlayerCharacter").fifeagent.\ | 433 agent_values["Position"] = (coords.x, coords.y) |
434 getLocation().getExactLayerCoordinates() | 434 agent_values["Rotation"] = 0 |
435 map_item_values["Position"] = (coords.x, coords.y) | 435 self.model.deleteObject(identifier) |
436 map_item_values["Rotation"] = 0 | 436 self.model.addAgent(map_name, {identifier: agent_values}) |
437 map_item_values["item"] = self.item | 437 self.model.placeAgents(self.item.entity.world) |
438 agent = {} | |
439 agent[self.item.ID] = map_item_values | |
440 self.model.addAgent("All", agent) | |
441 self.model.placeAgents() | |
442 super(DropItemAction, self).execute() | 438 super(DropItemAction, self).execute() |
443 | 439 |
444 class DropItemFromContainerAction(DropItemAction): | 440 class DropItemFromContainerAction(DropItemAction): |
445 """Action for dropping an items from the Inventory to a map""" | 441 """Action for dropping an items from the Inventory to a map""" |
446 | 442 |