From f80fd9ea0e340db6286feb014e437c9ca0c93dd0 Mon Sep 17 00:00:00 2001 From: realtradam Date: Mon, 9 Aug 2021 14:28:43 -0400 Subject: . --- lib/rules/limit.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/rules/limit.rb') diff --git a/lib/rules/limit.rb b/lib/rules/limit.rb index dba9f96..b2a8f32 100644 --- a/lib/rules/limit.rb +++ b/lib/rules/limit.rb @@ -3,10 +3,16 @@ FF::Sys.new('Limit') do unless $config.limit < 0 FF::Cmp::Boids.each do |boid| + if boid.entities[0].components[FF::Cmp::Piranha].nil? + multi = 1.0 + else + multi = 0.3 + end + absolute_velocity = Math.sqrt((boid.vx**2) + (boid.vy**2)) if absolute_velocity > $config.limit - boid.vx = (boid.vx / absolute_velocity) * $config.limit - boid.vy = (boid.vy / absolute_velocity) * $config.limit + boid.vx = (boid.vx / absolute_velocity) * $config.limit * multi + boid.vy = (boid.vy / absolute_velocity) * $config.limit * multi end end end -- cgit v1.2.3