summaryrefslogtreecommitdiffhomepage
path: root/app/systems/ai/rejoin.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/systems/ai/rejoin.rb')
-rw-r--r--app/systems/ai/rejoin.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/systems/ai/rejoin.rb b/app/systems/ai/rejoin.rb
new file mode 100644
index 0000000..51137f9
--- /dev/null
+++ b/app/systems/ai/rejoin.rb
@@ -0,0 +1,14 @@
+FF::Sys.new("Rejoin", priority: 40) do
+ FF::Cmp::BoidsSeparation.each do |sep|
+ puts 'add align/cohesion'.upcase
+ sep.distance = 150
+ alignment_mgr = sep.entities[0].components[FF::Cmp::BoidsAlignment]
+ cohesion_mgr = sep.entities[0].components[FF::Cmp::BoidsCohesion]
+ if alignment_mgr.nil? || alignment_mgr.empty?
+ sep.entities[0].add FF::Cmp::BoidsAlignment.new(strength: 10)
+ end
+ if cohesion_mgr.nil? || cohesion_mgr.empty?
+ sep.entities[0].add FF::Cmp::BoidsCohesion.new(strength: 1000)
+ end
+ end
+end