diff options
Diffstat (limited to 'app/systems/death.rb')
| -rw-r--r-- | app/systems/death.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/systems/death.rb b/app/systems/death.rb index 7c10212..edeb493 100644 --- a/app/systems/death.rb +++ b/app/systems/death.rb @@ -2,10 +2,12 @@ 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| + hp.entities[0].components.each do |manager, manager_array| + if manager.equal?(FF::Cmp::SingletonPlayer) + FF::Sys::EndGame.call + end next if manager.equal?(FF::Cmp::Hp) - manager_array.each do |component| + manager_array.reverse_each do |component| next if component.respond_to?(:singleton) component.delete end |
