summaryrefslogtreecommitdiffhomepage
path: root/app/systems/ai/rejoin.rb
blob: bc804de21ac0b325e9481d8a7bfd6e3801e7ff1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
FF::Sys.new("Rejoin", priority: 40) do
  FF::Cmp::SingletonRandomAIPick[0].entities.each do |entity|
    sep = entity.components[FF::Cmp::BoidsSeparation][0]
    sep.distance = Factory::SampleEnemy.defaults[:boids_seperation_distance]
    sep.strength = Factory::SampleEnemy.defaults[:boids_seperation_strength]
    alignment_mgr = entity.components[FF::Cmp::BoidsAlignment]
    cohesion_mgr = entity.components[FF::Cmp::BoidsCohesion]
    if alignment_mgr.nil? || alignment_mgr.empty?
      entity.add FF::Cmp::BoidsAlignment.new(strength: Factory::SampleEnemy.defaults[:boids_alignment_strength])
    end
    if cohesion_mgr.nil? || cohesion_mgr.empty?
      entity.add FF::Cmp::BoidsCohesion.new(strength: Factory::SampleEnemy.defaults[:boids_cohesion_strength])
    end
  end
end