Files
fizzy/app/helpers/splats_helper.rb
T
2024-08-29 18:14:38 -05:00

14 lines
406 B
Ruby

module SplatsHelper
SPLAT_ROTATION = %w[ 90 80 75 60 45 35 25 5 -45 -40 -75 ]
SPLAT_SIZE = [ 14, 16, 18, 20, 22 ]
MIN_THRESHOLD = 7
def splat_rotation(splat)
SPLAT_ROTATION[Zlib.crc32(splat.to_param) % SPLAT_ROTATION.size]
end
def splat_size(splat)
"--splat-size: #{ SPLAT_SIZE.min_by { |size| (size - (splat.boosts.size + splat.comments.size + MIN_THRESHOLD)).abs } }cqi;"
end
end