Add support for specifying the option for events in the declaration (where applicable).

This commit is contained in:
Major-
2014-08-08 02:00:01 +01:00
parent a863d8ea71
commit 22f712da23
9 changed files with 89 additions and 96 deletions
+5 -7
View File
@@ -54,12 +54,10 @@ class ConsumeAction < Action
end
# Intercepts the first item option event and consumes the consumable, if necessary.
on :event, :item_option do |ctx, player, event|
if (event.option == 1)
consumable = CONSUMABLES[event.id]
unless consumable == nil
player.start_action(ConsumeAction.new(player, event.slot, consumable))
ctx.break_handler_chain
end
on :event, :first_item_option do |ctx, player, event|
consumable = CONSUMABLES[event.id]
unless consumable == nil
player.start_action(ConsumeAction.new(player, event.slot, consumable))
ctx.break_handler_chain
end
end