changeset 106:edadf3ff8a9a

Added optional Slot value to the "Items" list in the agents file. updateObjectDB now saves the slot of the item
author KarstenBock@gmx.net
date Fri, 30 Sep 2011 15:08:53 +0200
parents dc573ac08355
children 100a39fa64a2
files gamemodel.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gamemodel.py	Fri Sep 30 14:11:02 2011 +0200
+++ b/gamemodel.py	Fri Sep 30 15:08:53 2011 +0200
@@ -422,6 +422,7 @@
             items = inv["Items"] if inv.has_key("Items") else list()
             for data in items:
                 item = None
+                slot = data["Slot"] if data.has_key("Slot") else -1
                 if data.has_key("type"):
                     item_type = data["type"]
                     item_data = {}
@@ -442,7 +443,7 @@
                         item = self.create_item(identifier, item_data,
                                                 world, item_type)
                         
-                container.put_item(obj.container, item.containable)
+                container.put_item(obj.container, item.containable, slot)
 
         if agent.has_key("Equipment"):
             for slot, data in agent["Equipment"].iteritems():
@@ -700,7 +701,8 @@
                             if not child:
                                 continue
                             items.append(
-                                {"ID": child.entity.general.identifier}
+                                {"ID": child.entity.general.identifier,
+                                 "Slot": child.slot}
                             )
                         inventory_data["Items"] = items
                         agent_data["Inventory"] = inventory_data