Ignore:
Timestamp:
07/24/10 14:09:19 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

  • Items can now be dropped and picked up again
  • Added generic image for items (Made by Q_x, he did the other items too).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/gamemodel.py

    r595 r596  
    8484        @type attributes: Dictionary 
    8585        @return: The modified attributes"""  
    86         from copy import deepcopy        
    8786        if attributes.has_key("object_type"): 
    8887            class_name = attributes.pop("object_type") 
    8988        else: 
    9089            class_name = attributes["type"] 
     90        if not attributes.has_key("type"): 
     91            attributes["type"] = class_name 
    9192        if self.object_db.has_key(class_name): 
    9293            db_attributes = deepcopy(self.object_db[class_name]) 
     
    336337            object_model =  agent_values["ObjectModel"] 
    337338        elif agent_values["ObjectType"] == "MapItem": 
    338             object_model = self.object_db[agent_values["ItemType"]]["gfx"] 
     339            object_data = self.object_db[agent_values["ItemType"]] 
     340            object_model = object_data["gfx"] if object_data.has_key("gfx") \ 
     341                        else "generic_item" 
    339342        else: 
    340343            object_model = self.object_db[agent_values["ObjectType"]]["gfx"] 
     
    405408        if object_id == None: 
    406409            if object_type == "MapItem": 
    407                 object_id = self.object_db[agent["ItemType"]]["gfx"] 
     410                object_data = self.object_db[agent["ItemType"]] 
     411                object_id = object_data["gfx"] if object_data.has_key("gfx") \ 
     412                            else "generic_item" 
    408413            else: 
    409414                object_id = self.object_db[object_type]["gfx"] 
     
    491496             
    492497        if agent.has_key("ItemType"): 
    493             item_data = {} 
    494             item_data["object_type"] = agent["ItemType"] 
    495             item_data["ID"] = inst_id  
     498            if not agent.has_key("item"): 
     499                item_data = {} 
     500                item_data["type"] = agent["ItemType"] 
     501                item_data["ID"] = inst_id  
     502            else: 
     503                item_data = agent["item"] 
    496504            inst_dict["item"] = item_data 
    497505            inst_dict["item_id"] = agent["ItemType"] 
Note: See TracChangeset for help on using the changeset viewer.