diff --git a/data/plugins/consumables/consumable.rb b/data/plugins/consumables/consumable.rb index bdf37900..d46f19ff 100644 --- a/data/plugins/consumables/consumable.rb +++ b/data/plugins/consumables/consumable.rb @@ -6,15 +6,22 @@ CONSUMABLES = {} # The id of the food consumption animation. CONSUME_ANIMATION_ID = 829 +# Contains the different types of consumables +module ConsumableType + FOOD = 1 + POTION = 2 +end + # An item that can be consumed to produce a skill effect. class Consumable - attr_reader :name, :id, :sound, :delay + attr_reader :name, :id, :sound, :delay, :type - def initialize(name, id, sound, delay) + def initialize(name, id, sound, delay, type) @name = name.to_s.gsub(/_/, ' ') @id = id @sound = sound @delay = delay + @type = type end def consume(_player) @@ -55,7 +62,7 @@ class ConsumeAction < Action end def equals(other) - mob == other.mob + mob == other.mob && @consumable.type == other.consumable.type end end diff --git a/data/plugins/consumables/food.rb b/data/plugins/consumables/food.rb index 7bab7185..659cf5aa 100644 --- a/data/plugins/consumables/food.rb +++ b/data/plugins/consumables/food.rb @@ -14,7 +14,7 @@ EAT_FOOD_SOUND = 317 class Food < Consumable def initialize(name, id, restoration, replace, delay) - super(name, id, EAT_FOOD_SOUND, delay) + super(name, id, EAT_FOOD_SOUND, delay, ConsumableType::FOOD) @restoration = restoration @replace = replace end diff --git a/data/plugins/consumables/potions.rb b/data/plugins/consumables/potions.rb index ee3cd009..148ce057 100644 --- a/data/plugins/consumables/potions.rb +++ b/data/plugins/consumables/potions.rb @@ -21,7 +21,7 @@ end class Potion < Consumable def initialize(id, name, doses) - super(name, id, Constants::DRINK_POTION_SOUND, Constants::POTION_DELAY) + super(name, id, Constants::DRINK_POTION_SOUND, Constants::POTION_DELAY, ConsumableType::POTION) @doses = doses end