summaryrefslogtreecommitdiffhomepage
path: root/app/systems/death.rb
blob: 7c1021221c33ee02bc969930ddb8fba9eaa84f66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
FF::Scn::BoidRules.add(
  FF::Sys.new("Death", priority: 200) do
    FF::Cmp::Hp.each do |hp|
      if hp.health <= 0
        component_hash = hp.entities[0].components.clone
        component_hash.each_pair do |manager, manager_array|
          next if manager.equal?(FF::Cmp::Hp)
          manager_array.each do |component|
            next if component.respond_to?(:singleton)
            component.delete
          end
        end
        hp.entities[0].delete
        hp.delete
      end
    end
  end
)