Ignore:
Timestamp:
07/17/10 14:35:34 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

  • Renamed replaceStuff in dialogues to replaceThing
  • Added replaceStuff to dialogues, this replaces a set of items

with another set of items.

  • Added removeItem to Inventory, removes an item from the inventory independent if it is in the backpack or a slot
  • moved give-method from NonPlayerCharacter? to CharacterBase?
  • getStuff now longer checks if the player already has an item of that type. (For what reason was that there?)
  • giveStuff now actually gives the item to the npc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/objects/actors.py

    r590 r591  
    220220        self.behaviour.agent.setLocation(location) 
    221221 
     222    def give (self, item, actor): 
     223        """Gives the specified item to the different actor. Raises an exception if the item was invalid or not found 
     224           @type item: Carryable 
     225           @param item: The item object to give 
     226           @param actor: Person to give item to""" 
     227        if item == None:  
     228            raise ValueError("I don't have %s" % item.name) 
     229        self.inventory.takeItem(item) 
     230        actor.inventory.placeItem(item)            
     231         
    222232    def hasItem(self, item_id): 
    223233        """Returns wether an item is present in the players inventory or not 
     
    388398        self.behaviour.pc = pc.behaviour.agent 
    389399        self.behaviour.idle() 
    390          
    391     def give (self, item, actor): 
    392         """Gives the specified item to the different actor. Raises an exception if the item was invalid or not found 
    393            @type item: Carryable 
    394            @param item: The item object to give 
    395            @param actor: Person to give item to""" 
    396         if item == None:  
    397             raise ValueError("I don't have %s" % item.name) 
    398         self.inventory.takeItem(item) 
    399         actor.inventory.placeItem(item)            
Note: See TracChangeset for help on using the changeset viewer.