diff src/parpg/gamemodel.py @ 136:e1fd4cda237d

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 e28c13a4802a
children 140e5e93f026
line wrap: on
line diff
--- a/src/parpg/gamemodel.py	Fri Sep 30 14:11:02 2011 +0200
+++ b/src/parpg/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