Ran rubocop autocorrect

This commit is contained in:
2020-12-02 17:37:48 -06:00
parent aa30ff73d0
commit 95bea199ed
116 changed files with 758 additions and 575 deletions

View File

@@ -1,7 +1,9 @@
# frozen_string_literal: true
class IMICFPS
class Subscription
attr_reader :entity, :event, :args, :block
def initialize(entity)
@entity = entity
@@ -13,28 +15,28 @@ class IMICFPS
def method_missing(event, *args, &block)
return unless Subscription.subscribable_events.include?(event)
@event, @args, @block = event, args, block
@event = event
@args = args
@block = block
Publisher.subscribe(self)
end
def trigger(event, *args)
if @block
@block.call(event, *args)
end
@block&.call(event, *args)
end
def self.subscribable_events
[
:tick,
:create, :move, :destroy,
:entity_moved,
:button_down, :button_up,
:mouse_move,
:interact,
:player_join, :player_leave, :player_die,
:pickup_item, :use_item, :drop_item,
:enter_vehicle, :exit_vehicle,
%i[
tick
create move destroy
entity_moved
button_down button_up
mouse_move
interact
player_join player_leave player_die
pickup_item use_item drop_item
enter_vehicle exit_vehicle
]
end
end
end
end