From a0f792d8feadf919290b8349dbc0eac143545927 Mon Sep 17 00:00:00 2001 From: _Tradam Date: Mon, 3 Jan 2022 08:26:24 -0500 Subject: Major 4.0 Update (#16) See Changelog --- lib/felflame/system_manager.rb | 139 +++++++++++++++++++++++++++-------------- 1 file changed, 92 insertions(+), 47 deletions(-) (limited to 'lib/felflame/system_manager.rb') diff --git a/lib/felflame/system_manager.rb b/lib/felflame/system_manager.rb index cab2c4d..8982589 100644 --- a/lib/felflame/system_manager.rb +++ b/lib/felflame/system_manager.rb @@ -1,10 +1,11 @@ -class FelFlame +# frozen_string_literal: true + +module FelFlame class Systems # How early this System should be executed in a list of Systems attr_accessor :priority # The Constant name assigned to this System - attr_reader :const_name # Allows overwriting the storage of triggers, such as for clearing. # This method should generally only need to be used internally and @@ -12,10 +13,20 @@ class FelFlame # @!visibility private attr_writer :addition_triggers, :removal_triggers, :attr_triggers + # Stores all the scenes this system is a part of. + attr_writer :scenes + + def scenes + @scenes ||= [] + end + def priority=(priority) @priority = priority - FelFlame::Stage.systems.sort_by!(&:priority) + scenes.each do |scene| + scene.systems = scene.systems.sort_by(&:priority) + end end + # Stores references to components or their managers that trigger # this component when a component or component from that manager # is added to an entity. @@ -34,7 +45,6 @@ class FelFlame @removal_triggers ||= [] end - # Stores references to systems that should be triggered when an # attribute from this manager is changed # Do not edit this hash as it is managed by FelFlame automatically. @@ -43,13 +53,47 @@ class FelFlame @attr_triggers ||= {} end - class <