mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Code tidying with Rubocop
This commit is contained in:
@@ -81,7 +81,8 @@ end
|
||||
# class Array
|
||||
#===============================================================================
|
||||
class Array
|
||||
def ^(other) # xor of two arrays
|
||||
# xor of two arrays
|
||||
def ^(other)
|
||||
return (self | other) - (self & other)
|
||||
end
|
||||
|
||||
@@ -401,5 +402,5 @@ def lerp(start_val, end_val, duration, delta, now = nil)
|
||||
delta = now - delta if now
|
||||
return start_val if delta <= 0
|
||||
return end_val if delta >= duration
|
||||
return start_val + (end_val - start_val) * delta / duration.to_f
|
||||
return start_val + ((end_val - start_val) * delta / duration.to_f)
|
||||
end
|
||||
|
||||
@@ -248,8 +248,7 @@ module PluginManager
|
||||
incompats = [incompats] if !incompats.is_a?(Array)
|
||||
incompats.each do |incompat|
|
||||
if self.installed?(incompat)
|
||||
self.error("Plugin '#{name}' is incompatible with '#{incompat}'. " +
|
||||
"They cannot both be used at the same time.")
|
||||
self.error("Plugin '#{name}' is incompatible with '#{incompat}'. They cannot both be used at the same time.")
|
||||
end
|
||||
end
|
||||
when :credits # Plugin credits
|
||||
@@ -271,8 +270,7 @@ module PluginManager
|
||||
end
|
||||
@@Plugins.each_value do |plugin|
|
||||
if plugin[:incompatibilities]&.include?(name)
|
||||
self.error("Plugin '#{plugin[:name]}' is incompatible with '#{name}'. " +
|
||||
"They cannot both be used at the same time.")
|
||||
self.error("Plugin '#{plugin[:name]}' is incompatible with '#{name}'. They cannot both be used at the same time.")
|
||||
end
|
||||
end
|
||||
# Add plugin to class variable
|
||||
|
||||
@@ -9,15 +9,15 @@ class SpriteAnimation
|
||||
@sprite = sprite
|
||||
end
|
||||
|
||||
["x", "y", "ox", "oy", "viewport", "flash", "src_rect", "opacity", "tone"].each do |def_name|
|
||||
eval <<-__END__
|
||||
|
||||
def #{def_name}(*arg) # def x(*arg)
|
||||
@sprite.#{def_name}(*arg) # @sprite.x(*arg)
|
||||
end # end
|
||||
|
||||
__END__
|
||||
end
|
||||
def x(*arg); @sprite.x(*arg); end
|
||||
def y(*arg); @sprite.y(*arg); end
|
||||
def ox(*arg); @sprite.ox(*arg); end
|
||||
def oy(*arg); @sprite.oy(*arg); end
|
||||
def viewport(*arg); @sprite.viewport(*arg); end
|
||||
def flash(*arg); @sprite.flash(*arg); end
|
||||
def src_rect(*arg); @sprite.src_rect(*arg); end
|
||||
def opacity(*arg); @sprite.opacity(*arg); end
|
||||
def tone(*arg); @sprite.tone(*arg); end
|
||||
|
||||
def self.clear
|
||||
@@_animations.clear
|
||||
@@ -151,7 +151,7 @@ class SpriteAnimation
|
||||
end
|
||||
end
|
||||
|
||||
def update_loop_animation(quick_update = false)
|
||||
def update_loop_animation
|
||||
new_index = ((System.uptime - @_loop_animation_timer_start) / @_loop_animation_time_per_frame).to_i
|
||||
new_index %= @_loop_animation_duration
|
||||
quick_update = (@_loop_animation_index == new_index)
|
||||
|
||||
Reference in New Issue
Block a user