lib/goby/entity/entity.rb
# Adds the item and the given amount to the inventory.
#
# @param [Item] item the item being added.
# @param [Integer] amount the amount of the item to add.
Adds the item and the given amount to the inventory.
Adds the item and the given amount to the inventory .
def add_item(item, amount = 1)
      @inventory.each do |couple|
        if (couple.first == item)
          couple.second += amount
          return
        end
      end
      @inventory.push(C[item, amount])
    end
def add_item ( item , amount = 1 ) @inventory . each do | couple | if ( couple . first == item ) couple . second += amount return end end @inventory . push ( C [ item , amount ] ) end
Adds the item and the given amount to the inventory.
Adds the item and the given amount to the inventory .
# Increase the amount if the item already exists in the inventory. # If not already in the inventory, push a couple.
item
amount
amount the amount of the item to add.
amount the amount of the item to add .