summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.rubocop.yml4
-rw-r--r--.ruby-version1
-rw-r--r--CHANGELOG.mdown74
-rw-r--r--Gemfile5
-rw-r--r--Gemfile.lock2
-rw-r--r--README.mdown187
-rw-r--r--Rakefile38
-rwxr-xr-xbin/console6
-rw-r--r--codeclimate/env.rb2
-rw-r--r--codeclimate/export-coverage.rb5
-rw-r--r--deprecated/components/00_renderable.rb36
-rw-r--r--deprecated/components/01_sprite.rb103
-rw-r--r--deprecated/components/03_player_control.rb47
-rw-r--r--deprecated/components/04_map.rb3
-rw-r--r--deprecated/components/05_interactable.rb4
-rw-r--r--deprecated/components/06_collidable.rb10
-rw-r--r--deprecated/components/07_battle.rb2
-rw-r--r--deprecated/components/07_indoor.rb2
-rw-r--r--deprecated/components/07_overworld.rb4
-rw-r--r--deprecated/components/debug_singleton.rb4
-rw-r--r--deprecated/helpers/00_tileset.rb28
-rw-r--r--deprecated/helpers/01_component.rb131
-rw-r--r--deprecated/systems/00_update_levels.rb4
-rw-r--r--deprecated/systems/10_player.rb44
-rw-r--r--deprecated/systems/99_render.rb38
-rw-r--r--docs/FelFlame.html62
-rw-r--r--docs/FelFlame/ComponentManager.html648
-rw-r--r--docs/FelFlame/Components.html142
-rw-r--r--docs/FelFlame/Entities.html494
-rw-r--r--docs/FelFlame/Order.html251
-rw-r--r--docs/FelFlame/Scenes.html134
-rw-r--r--docs/FelFlame/Stage.html82
-rw-r--r--docs/FelFlame/Systems.html448
-rw-r--r--docs/Felflame_.html4
-rw-r--r--docs/_index.html23
-rw-r--r--docs/class_list.html2
-rw-r--r--docs/file.README.html212
-rw-r--r--docs/index.html212
-rw-r--r--docs/method_list.html130
-rw-r--r--docs/top-level-namespace.html10
-rw-r--r--felflame.gemspec42
-rw-r--r--lib/felflame.rb36
-rw-r--r--lib/felflame/component_manager.rb169
-rw-r--r--lib/felflame/entity_manager.rb124
-rw-r--r--lib/felflame/order.rb24
-rw-r--r--lib/felflame/scene_manager.rb35
-rw-r--r--lib/felflame/stage_manager.rb43
-rw-r--r--lib/felflame/system_manager.rb139
-rw-r--r--lib/felflame/version.rb2
-rw-r--r--spec/component_manager_spec.rb110
-rw-r--r--spec/entity_manager_spec.rb105
-rw-r--r--spec/order_spec.rb71
-rw-r--r--spec/scene_manager_spec.rb26
-rw-r--r--spec/spec_helper.rb114
-rw-r--r--spec/stage_manager_spec.rb88
-rw-r--r--spec/system_manager_spec.rb67
56 files changed, 2324 insertions, 2509 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index bfef2d0..2cfd5d4 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,9 +1,9 @@
AllCops:
- TargetRubyVersion: 2.4
+ TargetRubyVersion: 2.7
Style/StringLiterals:
Enabled: true
- EnforcedStyle: double_quotes
+ EnforcedStyle: single_quotes
Style/StringLiteralsInInterpolation:
Enabled: true
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 0000000..2c9b4ef
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+2.7.3
diff --git a/CHANGELOG.mdown b/CHANGELOG.mdown
index 6f34a95..454c4b8 100644
--- a/CHANGELOG.mdown
+++ b/CHANGELOG.mdown
@@ -8,46 +8,66 @@
![Deprecated](https://img.shields.io/badge/-Deprecated-orange)
![Removed](https://img.shields.io/badge/-Removed-red)
-## [3.0.0](https://github.com/realtradam/FelFlame/releases/tag/3.0.0) - 2021-07-12
+## [4.0.0](https://github.com/realtradam/FelFlame/releases/tag/4.0.0) - 2021-12-30
+![Removed](https://img.shields.io/badge/-Removed-red)
+- Removed all ids as they were not used
+
![Changed](https://img.shields.io/badge/-Changed-yellow)
-- The Scene alias was changed from ```FelFlame::Sce``` to ```FelFlame::Scn``` as it is more intuitive.
+- Scenes now have their own priority attribute
+- Stages now sort and execute by Scenes, rather then the net Systems in the Scenes
+- Component method `.attrs` was renamed to `.to_h`
+- Renamed the `data` accessor to `._data`
+- Various arrays are automatically compacted
+
+![Added](https://img.shields.io/badge/-Added-brightgreen)
+ - Classes and Modules which used a data array now have the entire set of array methods available to their respective Classes and Modules
+- Convenience methods for accessing a single entity in a component(`@component.entity`) and accessing a single entity in a component(`@entity.component[@component_manager]`)
+ - `FelFlame::Order` class which can set the order if your Scenes and Systems
+
+ ![Fixed](https://img.shields.io/badge/-Fixed-blue)
+ - Replaced all instances of `sort_by!` with `sort_by` for compatibility with mruby
+ - Minor optimizations such as less array duplication
+
+## [3.0.0](https://github.com/realtradam/FelFlame/releases/tag/3.0.0) - 2021-07-12
+ ![Changed](https://img.shields.io/badge/-Changed-yellow)
+ - The Scene alias was changed from ```FelFlame::Sce``` to ```FelFlame::Scn``` as it is more intuitive
## [2.0.0](https://github.com/realtradam/FelFlame/releases/tag/2.0.0) - 2021-07-10
-![Changed](https://img.shields.io/badge/-Changed-yellow)
-- Entities and Components now reference each other using the objects themselves rather then their id's
-```ruby
+ ![Changed](https://img.shields.io/badge/-Changed-yellow)
+ - Entities and Components now reference each other using the objects themselves rather then their id's
+ ```ruby
# before:
[email protected][@component_manager].each do |component_id|
- # iterate over id's, usually would need to do a lookup to get the component itself
-end
+ @entity.components[@component_manager].each do |component_id|
+# iterate over id's, usually would need to do a lookup to get the component itself
+ end
# after:
[email protected][@component_manager].each do |component|
- # iterate over the components themselves! No need for lookup anymore
-end
-```
-```ruby
+ @entity.components[@component_manager].each do |component|
+# iterate over the components themselves! No need for lookup anymore
+ end
+ ```
+ ```ruby
# same for components referencing entities
# before:
[email protected] do |entity_id|
- #iterate over id's
-end
+ @component.entities.each do |entity_id|
+#iterate over id's
+ end
# after:
[email protected] do |entity|
- # directly iterate over entities themselves!
-end
-```
-
+ @component.entities.each do |entity|
+# directly iterate over entities themselves!
+ end
+ ```
+
## [1.0.2](https://github.com/realtradam/FelFlame/releases/tag/1.0.2) - 2021-07-09
-![Fixed](https://img.shields.io/badge/-Fixed-blue)
-- Stripped superflous files shrinking gem size significantly
+ ![Fixed](https://img.shields.io/badge/-Fixed-blue)
+ - Stripped superflous files shrinking gem size significantly
## [1.0.1](https://github.com/realtradam/FelFlame/releases/tag/1.0.1) - 2021-07-09
-![Fixed](https://img.shields.io/badge/-Fixed-blue)
-- Defining attributes in components are no longer allowed to overwrite methods
+ ![Fixed](https://img.shields.io/badge/-Fixed-blue)
+ - Defining attributes in components are no longer allowed to overwrite methods
## [1.0.0](https://github.com/realtradam/FelFlame/releases/tag/1.0.0) - 2021-07-09
-![Added](https://img.shields.io/badge/-Added-brightgreen)
-- Initial release
+ ![Added](https://img.shields.io/badge/-Added-brightgreen)
+ - Initial release
diff --git a/Gemfile b/Gemfile
index 57f3b06..ffcd824 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,11 +1,10 @@
# frozen_string_literal: true
-source "https://rubygems.org"
+source 'https://rubygems.org'
# Specify your gem's dependencies in felflame.gemspec
gemspec
ruby '2.7.3'
-gem "rake", "~> 13.0"
-
+gem 'rake', '~> 13.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index c25006c..7b5b5fe 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- felflame (3.0.0)
+ felflame (4.0.0)
GEM
remote: https://rubygems.org/
diff --git a/README.mdown b/README.mdown
index 45b5b35..acae578 100644
--- a/README.mdown
+++ b/README.mdown
@@ -13,48 +13,49 @@
<!-- vim-markdown-toc GFM -->
-+ [What is FelFlame?](#what-is-felflame)
-+ [What is ECS?](#what-is-ecs)
- - [Components](#components)
- - [Entities](#entities)
- - [Systems](#systems)
- - [Scenes](#scenes)
- - [Stage](#stage)
-+ [Usage](#usage)
+* [What is FelFlame?](#what-is-felflame)
+* [What is ECS?](#what-is-ecs)
+ * [Components](#components)
+ * [Entities](#entities)
+ * [Systems](#systems)
+ * [Scenes](#scenes)
+ * [Stage](#stage)
+ * [Order](#order)
+* [Usage](#usage)
* [Entities](#entities-1)
- - [Creation](#creation)
- - [Accessing](#accessing)
- - [Get ID](#get-id)
- - [Adding and Removing Components](#adding-and-removing-components)
- - [Accessing Entities' Attached Components](#accessing-entities-attached-components)
- - [Deletion](#deletion)
+ * [Creation](#creation)
+ * [Accessing](#accessing)
+ * [Adding and Removing Components](#adding-and-removing-components)
+ * [Accessing Entities' Attached Components](#accessing-entities-attached-components)
+ * [Deletion](#deletion)
* [Components](#components-1)
- - [Creating a Component Manager](#creating-a-component-manager)
- - [Creating a Component from a Component Manager](#creating-a-component-from-a-component-manager)
- - [Accessing and Getting ID](#accessing-and-getting-id)
- - [Accessing Attributes and Changing Them](#accessing-attributes-and-changing-them)
- - [Deleting Components](#deleting-components)
- - [Iterating over Components](#iterating-over-components)
- - [Accessing Components' attached Entities](#accessing-components-attached-entities)
+ * [Creating a Component Manager](#creating-a-component-manager)
+ * [Creating a Component from a Component Manager](#creating-a-component-from-a-component-manager)
+ * [Accessing](#accessing-1)
+ * [Accessing Attributes and Changing Them](#accessing-attributes-and-changing-them)
+ * [Deleting Components](#deleting-components)
+ * [Accessing Components' attached Entities](#accessing-components-attached-entities)
* [Systems](#systems-1)
- - [Creation](#creation-1)
- - [Execution](#execution)
- - [Alternative Execution](#alternative-execution)
- - [Clearing Alternative Executions](#clearing-alternative-executions)
- - [Redefinition](#redefinition)
+ * [Creation](#creation-1)
+ * [Execution](#execution)
+ * [Alternative Execution](#alternative-execution)
+ * [Clearing Alternative Executions](#clearing-alternative-executions)
+ * [Redefinition](#redefinition)
* [Scenes](#scenes-1)
- - [Creation](#creation-2)
- - [Accessing](#accessing-1)
- - [Adding Systems](#adding-systems)
- - [Removing Systems](#removing-systems)
- - [Clearing](#clearing)
- - [Execution](#execution-1)
+ * [Creation](#creation-2)
+ * [Accessing](#accessing-2)
+ * [Adding Systems](#adding-systems)
+ * [Removing Systems](#removing-systems)
+ * [Clearing](#clearing)
+ * [Execution](#execution-1)
* [Stage](#stage-1)
- - [Adding Scenes](#adding-scenes)
- - [Removing Scenes](#removing-scenes)
- - [Executing](#executing)
+ * [Adding Scenes](#adding-scenes)
+ * [Removing Scenes](#removing-scenes)
+ * [Executing](#executing)
+ * [Order](#order-1)
+ * [Setting the order](#setting-the-order)
* [Closing Notes](#closing-notes)
-+ [Contribution](#contribution)
+* [Contribution](#contribution)
<!-- vim-markdown-toc -->
@@ -85,7 +86,7 @@ Systems are where all the logic or code is kept. There is no data stored in here
By using this pattern it allows programmers to easily control what an "object" or entity can do and how much data it needs to have. It avoids the issue of inhertance as no inhertance is ever required in this system. If you need a certain entity to have a certain functionality you just add the relevant component to it, and the systems that automatically go over specific components will give your entitiy the desired functionality.
-**"But your framework also has `Scenes` and a `Stage`, what is that about?"**
+**"But your framework also has `Scenes`, `Stage`, and `Order`, what is that about?"**
---
@@ -95,13 +96,19 @@ Scenes are simply a collection or subset of Systems. This allows for an easy way
### Stage
The Stage is Scenes which are activated. This means any Scenes on the Stage are executed each frame, while the rest of the Systems are not.
+### Order
+Order is a helper class which can set the priority of Scenes and Systems.
+
---
-If all of this sounds very confusing, don't worry. A video tutorial series is in the works where I will build a game using this framework and explain every step of the way. You can also read some examples and explanations below.
# Usage
-To use FelFlame simply install the gem using `gem install felflame` or using bundler `bundle add felflame` and then require it in your project like so: `require 'felflame'`. Working outside of the gem for rendering engines that do not support the usage of gems is a planned feature in the works.
+There are 2 ways of using FelFlame. You can either `include` it as a gem in your project if your game engine supports this. The other option is to download the single file export of FelFlame and then `require_relative` this file in your project. The single file export takes all the ruby code in the various files and concatenates them into a single file so it is more portable and easy to add.
+
+To use the gem method you can do the following: install the gem using `gem install felflame` or using bundler `bundle add felflame` and then require it in your project like so: `require 'felflame'`.
+
+To use the single file export method you simply download the felflame.rb file from the [releases page on Github](https://github.com/realtradam/FelFlame/releases) and add it to your source folder and add a `require relative 'felflame.rb'` line or wherever you have placed the file to use it.
## Entities
@@ -111,29 +118,24 @@ Entities are essentially "objects" in the game world. To create a new Entity we
```ruby
@entity = FelFlame::Entities.new
```
-or if we want to add (any number of)components to it:
+or if we want to add (any number of)components to it when creating it:
```ruby
@entity = FelFlame::Entites.new(
FelFlame::Components::Health.new,
@component,
- FelFlame::Components::Armour[7]
+ FelFlame::Components::EnemyTeam.first
)
```
### Accessing
-Once components are created we can access them using their ID like so:
+Oftentimes you will not be accessing an Entity this way. Later we will shows you a more common way of accessing entities.
+If you need to you can access Entities using the `Entities` module:
```ruby
@entity = FelFlame::Entities[2]
-```
-
-### Get ID
-Entity ID's are generated starting from 0 and ascending, unless if there is a missing ID because of a deleted
-entity where a new entity will claim that ID. To get the ID of an Entity:
-
-```ruby
+@entity = FelFlame::Entities.first
+@entity = FelFlame::Entities.each # you can iterate over all entities this way. Any valid array method can be used
```
### Adding and Removing Components
@@ -145,14 +147,18 @@ We can still add or remove Components from an Entity after it has been created.
```
### Accessing Entities' Attached Components
+This is the most common way of accessing an Entity
+
When Components are added to Entities, they can be accessed from the Entity. By using a Component Manager as a key we can access an array of all components created from that Component Manager that are attached to an entity:
```ruby
[email protected][@component_manager] # => [@component1, @component2, component3]
[email protected][@component_manager] # => [@component1, @component2, @component3]
```
### Deletion
-To have all Components from an Entity removed and the Entity deleted we do the following:
+To have all Components from an Entity **removed** and the Entity deleted we do the following:
+
+NOTE: The components will **not be deleted**. They are simply **removed** from the entity and then the entity is destroyed. You must handle component deletion yourself as for example singleton components need to removed instead of deleted.
```ruby
@entity.delete
@@ -182,20 +188,19 @@ Now that we have a component manager we can make components from it like so:
@component = FelFlame::Components::Stats.new
```
-Or we can even change the defaults:
+Or we can even override the defaults when creating the component:
```ruby
@component = FelFlame::Components::Stats.new(armour: 'steel')
```
-### Accessing and Getting ID
-Just like Entities, Components have IDs.
-These IDs are only unique within the scope of their respective Component Managers.
-Here is how we can get the ID, as well as how to access a Component from its Component Manager.
+### Accessing
+You can access components using any array method.
```ruby
@component = FelFlame::Components::Stats[2]
+@component = FelFlame::Components::Stats.first
+@component = FelFlame::Components::Stats.each # you can use iterators this way
```
### Accessing Attributes and Changing Them
@@ -207,30 +212,26 @@ Here are the ways to edit attrubutes, followed by the ways to read them.
```
```ruby
@component.hp # => 95
[email protected] # => {armour: 'Leather', hp: 95}
[email protected]_h # => {armour: 'Leather', hp: 95}
```
### Deleting Components
-Deleting a Component is the same format as deleting an Entity. When a Component is deleted referenced to it such as to entities are automatically cleared.
+Deleting a Component is the same convention as deleting an Entity. When a Component is deleted referenced to it such as to entities are automatically cleared.
```ruby
@component.delete
```
-### Iterating over Components
-When you make Systems you will want to be able to iterate over all Components of the same Component Manager(for example iterating over all sprites to render them). Here is how we do that:
-
-```ruby
-FelFlame::Components::Sprites.each do |component|
- #do something with components
-end
-```
-
### Accessing Components' attached Entities
Components also keep track of what Entities are using it. To access this list we do the following:
```ruby
@component.entities # => [@entity1, @entity2, @entity3]
+
+# get the first entity attached.
+# this will throw a warning if there is more or less then
+# exactly one entity
[email protected] # => @entity
```
@@ -252,7 +253,9 @@ FelFlame::Systems::Render
```
Priority determines the order Systems should be executed, this is used for `Scenes` and the `Stage`.
The lower the number, the earlier a given System will be executed.
-E.g priority 1 will go first, priority 2 will go second, etcetera.
+E.g priority 1 will go first, priority 2 will go second, etcetera.
+
+Both Scenes and Systems have a priority. System priority will decide the order it will be called inside of a Scene, which the Scene priority will decide the order it will be called inside of the Stage.
Often we will want to execute some logic on each Component in a given Component Manager so our code might look like this:
@@ -355,7 +358,7 @@ end
Once we have all the core parts of ECS, we will want to organize our Systems. To do this we will use Scenes to group up Systems so they can quickly be enabled or disabled. Note that [Alternative Executions](#alternative-execution) will occur even if they are not part of a Scene. Here is how we make a new Scene:
```ruby
-@scene = FelFlame::Scenes.new('ExampleScene')
+@scene = FelFlame::Scenes.new('ExampleScene', priority: 5)
```
### Accessing
@@ -369,14 +372,22 @@ Just like other classes in FelFlame, the name we gave the Scene is how we access
Adding Systems is simple. We can add as many as we want. In this example we add 3 different systems:
```ruby
-FelFlame::Scenes::ExampleScene.add(FelFlame::Systems::Render, @system2, @system3)
+FelFlame::Scenes::ExampleScene.add(
+ FelFlame::Systems::Render,
+ @system2,
+ @system3
+)
```
### Removing Systems
-Removing Systems works simularly:
+Removing Systems works similarly:
```ruby
-FelFlame::Scenes::ExampleScene.remove(FelFlame::Systems::Render, @system2, @system3)
+FelFlame::Scenes::ExampleScene.remove(
+ FelFlame::Systems::Render,
+ @system2,
+ @system3
+)
```
### Clearing
@@ -398,7 +409,7 @@ The Scene will make sure that the systems are executed in the correct order base
## Stage
### Adding Scenes
-Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is active. To add a Scene we do the following:
+Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is 'active'. To add a Scene we do the following:
```ruby
FelFlame::Stage.add FelFlame::Scene::ExampleScene
@@ -412,12 +423,36 @@ FelFlame::Stage.remove FelFlame::Scene::ExampleScene
```
### Executing
-On each frame of the game we want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will make sure for you that all the Systems from all Scenes added will be executed in the correct order according to their priority. Here is how we do it:
+On each frame of the game generally we will want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will call all Scenes you added to it in the order of their priority. Here is how we do it:
```ruby
FelFlame::Stage.call
```
+## Order
+
+### Setting the order
+
+To set the order you just need to call `FelFlame::Order.sort` and pass Scenes or Systems in the parameters in the order you wish for them to execute
+
+```ruby
+FelFlame::Order.sort(
+ @system1,
+ @system2,
+ @system3
+)
+```
+
+If you want some Scenes or Systems to have the same priority then just pass them as an array:
+
+```ruby
+FelFlame::Order.sort(
+ @scene1,
+ [@scene2_1, @scene2_2],
+ @scene3
+)
+```
+
## Closing Notes
There are some methods I haven't gone over in the overview. If you want to see everything and read in more detail check out the [Documentation](https://felflame.tradam.fyi)!
diff --git a/Rakefile b/Rakefile
index edf99bc..b4ba44b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,15 +1,35 @@
# frozen_string_literal: true
-#
+
require 'rubygems'
require 'bundler/setup'
require 'rspec/core/rake_task'
require 'yard'
require_relative './codeclimate/export-coverage'
-require "bundler/gem_tasks"
-require "rubocop/rake_task"
+require 'bundler/gem_tasks'
+require 'rubocop/rake_task'
+
+task default: [:spec, :yard, 'coverage:format']
+# task default: :rubocop
+
+desc 'Export to single file'
+task :buildfile do
+ result = ''
+ main = File.read('lib/felflame.rb')
+ tmp = main.lines(chomp: true).select do |line|
+ line.include? 'require_relative '
+ end
+ tmp.each do |file|
+ file.delete_prefix!('require_relative ')
+ result += "#{File.read("lib/#{file[1, file.length - 2]}.rb")}\n"
+ end
-task :default => [:spec, :yard, 'coverage:format']
-#task default: :rubocop
+ result += main.lines.reject do |line|
+ line.include? 'require_relative '
+ end.join
+
+ `mkdir pkg`
+ File.write('pkg/felflame.rb', result)
+end
RuboCop::RakeTask.new
@@ -31,15 +51,15 @@ YARD::Rake::YardocTask.new do |t|
t.stats_options = ['--list-undoc']
end
-#Rake::TestTask.new do |t|
+# Rake::TestTask.new do |t|
# t.pattern = "tests/**/*_test.rb"
-#end
+# end
RSpec::Core::RakeTask.new :spec
# For installing FelPacks
-#Gem::Specification.find_all.each do |a_gem|
+# Gem::Specification.find_all.each do |a_gem|
# next unless a_gem.name.include? 'felpack-'
#
# Dir.glob("#{a_gem.gem_dir}/lib/#{a_gem.name.gsub('-', '/')}/tasks/*.rake").each { |r| load r }
-#end
+# end
diff --git a/bin/console b/bin/console
index c0dca2c..9e87c14 100755
--- a/bin/console
+++ b/bin/console
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
-require "bundler/setup"
-require "felflame"
+require 'bundler/setup'
+require 'felflame'
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
@@ -11,5 +11,5 @@ require "felflame"
# require "pry"
# Pry.start
-require "irb"
+require 'irb'
IRB.start(__FILE__)
diff --git a/codeclimate/env.rb b/codeclimate/env.rb
index 0a0ad43..25bae9e 100644
--- a/codeclimate/env.rb
+++ b/codeclimate/env.rb
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
ENV['CC_TEST_REPORTER_ID'] = '48d1c389052ea205cb4d72b05f7606fc53a9b5def70c2bfdd957efb73657d32c'
diff --git a/codeclimate/export-coverage.rb b/codeclimate/export-coverage.rb
index 7a63acd..74b0cbd 100644
--- a/codeclimate/export-coverage.rb
+++ b/codeclimate/export-coverage.rb
@@ -1,8 +1,9 @@
-require_relative 'env'
+# frozen_string_literal: true
+require_relative 'env'
class ReportCoverage
- class <<self
+ class << self
def format
puts
puts 'Formatting Coverage...'
diff --git a/deprecated/components/00_renderable.rb b/deprecated/components/00_renderable.rb
index 1d34fbb..32c93b6 100644
--- a/deprecated/components/00_renderable.rb
+++ b/deprecated/components/00_renderable.rb
@@ -1,19 +1,19 @@
-FelFlame::Components.new('Renderable', z: 0)
-=begin
-class Components
- # If an entity can be rendered on screen
- class Renderable < Helper::BaseComponent
- attr_accessor :z
-
- def initialize
- @z = 0
- end
+# frozen_string_literal: true
- def set(**opts)
- opts.each do |key, value|
- self.send "#{key}=", value
- end
- end
- end
-end
-=end
+FelFlame::Components.new('Renderable', z: 0)
+# class Components
+# # If an entity can be rendered on screen
+# class Renderable < Helper::BaseComponent
+# attr_accessor :z
+#
+# def initialize
+# @z = 0
+# end
+#
+# def set(**opts)
+# opts.each do |key, value|
+# self.send "#{key}=", value
+# end
+# end
+# end
+# end
diff --git a/deprecated/components/01_sprite.rb b/deprecated/components/01_sprite.rb
index c02a51b..4ae6713 100644
--- a/deprecated/components/01_sprite.rb
+++ b/deprecated/components/01_sprite.rb
@@ -1,57 +1,56 @@
+# frozen_string_literal: true
FelFlame::Components.new('Sprite', :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b,
- :source_x, :source_y, :source_w, :source_h,
- :tile_x, :tile_y, :tile_w, :tile_h,
- :flip_horizontally, :flip_vertically,
- :angle_anchor_x, :angle_anchor_y, primative_marker: :sprite)
+ :source_x, :source_y, :source_w, :source_h,
+ :tile_x, :tile_y, :tile_w, :tile_h,
+ :flip_horizontally, :flip_vertically,
+ :angle_anchor_x, :angle_anchor_y, primative_marker: :sprite)
-#Components::Sprite.define_method('primative_marker') do
+# Components::Sprite.define_method('primative_marker') do
# :sprite
-#end
+# end
-=begin
-class Components
- # If an entity can be rendered on screen
- class Sprite < Helper::BaseComponent
-
- attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b,
- :source_x, :source_y, :source_w, :source_h,
- :tile_x, :tile_y, :tile_w, :tile_h,
- :flip_horizontally, :flip_vertically,
- :angle_anchor_x, :angle_anchor_y
-
- def set(x: @x, y: @y, w: @w, h: @h, path: @path, angle: @angle, a: @a, r: @r, g: @g, b: @b,
- source_x: @source_x, source_y: @source_y, source_w: @source_w, source_h: @source_h,
- tile_x: @tile_x, tile_y: @tile_y, tile_w: @tile_w, tile_h: @tile_h,
- flip_horizontally: @flip_horizontally, flip_vertically: @flip_vertically,
- angle_anchor_x: @angle_anchor_x, angle_anchor_y: @angle_anchor_y)
- {x: @x = x,
- y: @y = y,
- w: @w = w,
- h: @h = h,
- path: @path = path,
- angle: @angle = angle,
- a: @a = a,
- r: @r = r,
- g: @g = g,
- b: @b = b,
- source_x: @source_x = source_x,
- source_y: @source_y = source_y,
- source_w: @source_w = source_w,
- source_h: @source_h = source_h,
- tile_x: @tile_x = tile_x,
- tile_y: @tile_y = tile_y,
- tile_w: @tile_w = tile_w,
- tile_h: @tile_h = tile_h,
- flip_horizontally: @flip_horizontally = flip_horizontally,
- flip_vertically: @flip_vertically = flip_vertically,
- angle_anchor_x: @angle_anchor_x = angle_anchor_x,
- angle_anchor_y: @angle_anchor_y = angle_anchor_y}
- end
-
- def primative_marker
- :sprite
- end
- end
-end
-=end
+# class Components
+# # If an entity can be rendered on screen
+# class Sprite < Helper::BaseComponent
+#
+# attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b,
+# :source_x, :source_y, :source_w, :source_h,
+# :tile_x, :tile_y, :tile_w, :tile_h,
+# :flip_horizontally, :flip_vertically,
+# :angle_anchor_x, :angle_anchor_y
+#
+# def set(x: @x, y: @y, w: @w, h: @h, path: @path, angle: @angle, a: @a, r: @r, g: @g, b: @b,
+# source_x: @source_x, source_y: @source_y, source_w: @source_w, source_h: @source_h,
+# tile_x: @tile_x, tile_y: @tile_y, tile_w: @tile_w, tile_h: @tile_h,
+# flip_horizontally: @flip_horizontally, flip_vertically: @flip_vertically,
+# angle_anchor_x: @angle_anchor_x, angle_anchor_y: @angle_anchor_y)
+# {x: @x = x,
+# y: @y = y,
+# w: @w = w,
+# h: @h = h,
+# path: @path = path,
+# angle: @angle = angle,
+# a: @a = a,
+# r: @r = r,
+# g: @g = g,
+# b: @b = b,
+# source_x: @source_x = source_x,
+# source_y: @source_y = source_y,
+# source_w: @source_w = source_w,
+# source_h: @source_h = source_h,
+# tile_x: @tile_x = tile_x,
+# tile_y: @tile_y = tile_y,
+# tile_w: @tile_w = tile_w,
+# tile_h: @tile_h = tile_h,
+# flip_horizontally: @flip_horizontally = flip_horizontally,
+# flip_vertically: @flip_vertically = flip_vertically,
+# angle_anchor_x: @angle_anchor_x = angle_anchor_x,
+# angle_anchor_y: @angle_anchor_y = angle_anchor_y}
+# end
+#
+# def primative_marker
+# :sprite
+# end
+# end
+# end
diff --git a/deprecated/components/03_player_control.rb b/deprecated/components/03_player_control.rb
index f48b155..6414547 100644
--- a/deprecated/components/03_player_control.rb
+++ b/deprecated/components/03_player_control.rb
@@ -1,26 +1,25 @@
+# frozen_string_literal: true
FelFlame::Components.new :PlayerControl, north: 'up', south: 'down', east: 'right',
- west: 'left', interact: 'space', menu: 'enter'
-=begin
-class Components
- # Gives control(keyboard or otherwise) over an object
- class PlayerControl < Helper::BaseComponent
- attr_accessor :north, :south, :east, :west, :interact, :menu
-
- def initialize
- @north = 'up'
- @south = 'down'
- @east = 'right'
- @west = 'left'
- @interact = 'space'
- @menu = 'enter'
- end
-
- def set(**opts)
- opts.each do |key, value|
- send "#{key}=", value
- end
- end
- end
-end
-=end
+ west: 'left', interact: 'space', menu: 'enter'
+# class Components
+# # Gives control(keyboard or otherwise) over an object
+# class PlayerControl < Helper::BaseComponent
+# attr_accessor :north, :south, :east, :west, :interact, :menu
+#
+# def initialize
+# @north = 'up'
+# @south = 'down'
+# @east = 'right'
+# @west = 'left'
+# @interact = 'space'
+# @menu = 'enter'
+# end
+#
+# def set(**opts)
+# opts.each do |key, value|
+# send "#{key}=", value
+# end
+# end
+# end
+# end
diff --git a/deprecated/components/04_map.rb b/deprecated/components/04_map.rb
index 7700e9f..5d110f0 100644
--- a/deprecated/components/04_map.rb
+++ b/deprecated/components/04_map.rb
@@ -1,7 +1,8 @@
+# frozen_string_literal: true
+
class Components
# dragonruby label wrapper
class Map < Helper::BaseComponent
-
attr_accessor :json_name, :json, :x, :y, :tilewidth, :tileheight, :a, :r, :g, :b
def set(json_name: @json_name, x: @x, y: @y, tilewidth: @tilewidth,
diff --git a/deprecated/components/05_interactable.rb b/deprecated/components/05_interactable.rb
index 636a216..bee91f6 100644
--- a/deprecated/components/05_interactable.rb
+++ b/deprecated/components/05_interactable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Components
# If an entity can be rendered on screen
class Interactable < Helper::BaseComponent
@@ -9,7 +11,7 @@ class Components
def set(**opts)
opts.each do |key, value|
- self.send "#{key}=", value
+ send "#{key}=", value
end
end
end
diff --git a/deprecated/components/06_collidable.rb b/deprecated/components/06_collidable.rb
index 76ce51e..4fde638 100644
--- a/deprecated/components/06_collidable.rb
+++ b/deprecated/components/06_collidable.rb
@@ -1,11 +1,9 @@
+# frozen_string_literal: true
+
class Components
# If an entity can be rendered on screen
class Collidable < Helper::BaseComponent
- class <<self
- def add(entity_id)
- super(entity_id)
- #add to grid?
- end
+ class << self
end
attr_accessor :grid
@@ -15,7 +13,7 @@ class Components
def set(**opts)
opts.each do |key, value|
- self.send "#{key}=", value
+ send "#{key}=", value
end
end
end
diff --git a/deprecated/components/07_battle.rb b/deprecated/components/07_battle.rb
index b4ef622..996c03c 100644
--- a/deprecated/components/07_battle.rb
+++ b/deprecated/components/07_battle.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Components
class Battle < Helper::Level
end
diff --git a/deprecated/components/07_indoor.rb b/deprecated/components/07_indoor.rb
index e409da8..762c239 100644
--- a/deprecated/components/07_indoor.rb
+++ b/deprecated/components/07_indoor.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Components
class Indoor < Helper::Level
end
diff --git a/deprecated/components/07_overworld.rb b/deprecated/components/07_overworld.rb
index 55ab38a..cea11f5 100644
--- a/deprecated/components/07_overworld.rb
+++ b/deprecated/components/07_overworld.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Components
class Overworld < Helper::Level
attr_accessor :x, :y
@@ -9,7 +11,7 @@ class Components
def set(**opts)
opts.each do |key, value|
- self.send "#{key}=", value
+ send "#{key}=", value
end
end
end
diff --git a/deprecated/components/debug_singleton.rb b/deprecated/components/debug_singleton.rb
index f298172..e667191 100644
--- a/deprecated/components/debug_singleton.rb
+++ b/deprecated/components/debug_singleton.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class Components
# If an entity can be rendered on screen
class DebugSingleton
- class <<self
+ class << self
@data = false
attr_accessor :data
diff --git a/deprecated/helpers/00_tileset.rb b/deprecated/helpers/00_tileset.rb
index c4293cb..9d727f9 100644
--- a/deprecated/helpers/00_tileset.rb
+++ b/deprecated/helpers/00_tileset.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Coverage Ignored because the functionality of this
# code will not be used for the core of FelFlame.
# It will most likely be released as a seperate package
@@ -9,39 +11,39 @@ class Helper
# If any are missing then it will load them from files
@json_data = {}
- class <<self
+ class << self
attr_accessor :json_data
def get_json_tiles(json_name, hitbox: false)
- unless hitbox
- return nil if json_name == 'hitbox' && !Components::DebugSingleton.data
- end
+ return nil if !hitbox && (json_name == 'hitbox' && !Components::DebugSingleton.data)
- if self.json_data[json_name].nil?
- self.json_data[json_name] = $gtk.parse_json_file "assets/json/#{json_name}.json"
- raise Exception.new "#{json_name} is null and not loaded. Cannot get json tile" if self.json_data[json_name].nil?
+ if json_data[json_name].nil?
+ json_data[json_name] = $gtk.parse_json_file "assets/json/#{json_name}.json"
+ raise StandardError, "#{json_name} is null and not loaded. Cannot get json tile" if json_data[json_name].nil?
- if self.json_data[json_name]['type'] == 'map' #json_name.split("_").first == 'map'
- self.json_data[json_name]['tilesets'].each do |tileset|
+ if json_data[json_name]['type'] == 'map' # json_name.split("_").first == 'map'
+ json_data[json_name]['tilesets'].each do |tileset|
tileset = Helper.get_json_tiles(tileset['source'].split('/').last.delete_suffix('.tsx'))
# download tileset here
# $gtk.args.gtk.http_get 'https://mysite.net/#{tileset['name']}.png'
end
end
end
- self.json_data[json_name]
+ json_data[json_name]
end
def get_tile(json_name:, tile_index:)
if json_name == 'hitbox' && !Components::DebugSingleton.data
return tile_index - 1 if tile_index > 1
+
return {}
end
- json_tiles = self.get_json_tiles(json_name)
- raise Exception.new "Error, json file not a tileset" unless json_tiles['type'] == 'tileset'
+ json_tiles = get_json_tiles(json_name)
+ raise StandardError, 'Error, json file not a tileset' unless json_tiles['type'] == 'tileset'
return tile_index - json_tiles['tilecount'] if tile_index > json_tiles['tilecount']
- source_height_tiles = (tile_index.to_i / json_tiles['columns'].to_i).to_i# * json_tiles['tileheight']
+
+ source_height_tiles = (tile_index.to_i / json_tiles['columns'].to_i).to_i # * json_tiles['tileheight']
{ w: json_tiles['tilewidth'],
h: json_tiles['tileheight'],
path: json_tiles['image'].split('mygame/').last.delete('\\'),
diff --git a/deprecated/helpers/01_component.rb b/deprecated/helpers/01_component.rb
index 2065d0c..12cce09 100644
--- a/deprecated/helpers/01_component.rb
+++ b/deprecated/helpers/01_component.rb
@@ -1,74 +1,67 @@
+# frozen_string_literal: true
+
class FelFlame
class Helper
+ # # Unused:
+ # class Level < FelFlame::Helper::ComponentManager
+ # class <<self
+ # def data
+ # @data ||= { add: [], remove: [], grid: FelFlame::Helper::Array2D.new }
+ # end
+ #
+ # def add(entity_id)
+ # super
+ # data[:add].push entity_id
+ # end
+ #
+ # def remove(entity_id)
+ # data[:remove].push entity_id
+ # super
+ # end
+ # end
+ # end
+ # class Array2D < Array
+ # def [](val)
+ # unless val.nil?
+ # return self[val] = [] if super.nil?
+ # end
+ # super
+ # end
+ # end
+ # class ArrayOfHashes < Array
+ # def [](val)
+ # unless val.nil?
+ # return self[val] = {} if super.nil?
+ # end
+ # super
+ # end
+ # end
-=begin
- # Unused:
- class Level < FelFlame::Helper::ComponentManager
- class <<self
- def data
- @data ||= { add: [], remove: [], grid: FelFlame::Helper::Array2D.new }
- end
-
- def add(entity_id)
- super
- data[:add].push entity_id
- end
-
- def remove(entity_id)
- data[:remove].push entity_id
- super
- end
- end
- end
-=end
-=begin
- class Array2D < Array
- def [](val)
- unless val.nil?
- return self[val] = [] if super.nil?
- end
- super
- end
- end
-=end
-=begin
- class ArrayOfHashes < Array
- def [](val)
- unless val.nil?
- return self[val] = {} if super.nil?
- end
- super
- end
- end
-=end
-
-=begin
- module ComponentHelper
- class <<self
- def up? char
- char == char.upcase
- end
-
- def down? char
- char == char.downcase
- end
-
- def underscore(input)
- output = input[0].downcase
- (1...(input.length - 1)).each do |iter|
- if down?(input[iter]) && up?(input[iter + 1])
- output += "#{input[iter].downcase}_"
- elsif up?(input[iter - 1]) && up?(input[iter]) && down?(input[iter + 1])
- output += "_#{input[iter].downcase}"
- else
- output += input[iter].downcase
- end
- end
- output += input[-1].downcase unless input.length == 1
- output
- end
- end
- end
-=end
+ # module ComponentHelper
+ # class <<self
+ # def up? char
+ # char == char.upcase
+ # end
+ #
+ # def down? char
+ # char == char.downcase
+ # end
+ #
+ # def underscore(input)
+ # output = input[0].downcase
+ # (1...(input.length - 1)).each do |iter|
+ # if down?(input[iter]) && up?(input[iter + 1])
+ # output += "#{input[iter].downcase}_"
+ # elsif up?(input[iter - 1]) && up?(input[iter]) && down?(input[iter + 1])
+ # output += "_#{input[iter].downcase}"
+ # else
+ # output += input[iter].downcase
+ # end
+ # end
+ # output += input[-1].downcase unless input.length == 1
+ # output
+ # end
+ # end
+ # end
end
end
diff --git a/deprecated/systems/00_update_levels.rb b/deprecated/systems/00_update_levels.rb
index 6f3a056..5805123 100644
--- a/deprecated/systems/00_update_levels.rb
+++ b/deprecated/systems/00_update_levels.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Systems
class UpdateLevels
@co = Components::Overworld
@@ -6,7 +8,7 @@ class Systems
@co.data[:add].delete(id)
if !(Components::Sprite.id & Entity.signatures[id]).zero?
@co.data[:grid][@co.data[id].x][@co.data[id].y] = {} if @co.data[:grid][@co.data[id].x][@co.data[id].y].nil?
- #@co.data[:grid][@co.data[id].x][@co.data[id].y].merge!({ player: true })
+ # @co.data[:grid][@co.data[id].x][@co.data[id].y].merge!({ player: true })
puts @co.data[:grid][@co.data[id].x][@co.data[id].y].inspect
elsif !(Components::Map.id & Entity.signatures[id]).zero?
if Components::Map.data[id].json['tilesets'].last['source'].split('/').last.delete('\\').delete_suffix('.tsx') == 'hitbox'
diff --git a/deprecated/systems/10_player.rb b/deprecated/systems/10_player.rb
index 307731a..ae8564d 100644
--- a/deprecated/systems/10_player.rb
+++ b/deprecated/systems/10_player.rb
@@ -1,39 +1,41 @@
+# frozen_string_literal: true
+
class Systems
class Player
@co = Components::Overworld
def self.run
Components::PlayerControl.data.each do |id, data|
- puts6 "Right: #{@co.data[:grid][@co.data[id].x+1][@co.data[id].y]}"
- puts6 "Left #{@co.data[:grid][@co.data[id].x-1][@co.data[id].y]}"
- puts6 "Down #{@co.data[:grid][@co.data[id].x][@co.data[id].y+1]}"
- puts6 "Up #{@co.data[:grid][@co.data[id].x][@co.data[id].y-1]}"
- #puts6 @co.data[:grid][@co.data[id].x + 1][@co.data[id].y][:hitbox].nil?
+ puts6 "Right: #{@co.data[:grid][@co.data[id].x + 1][@co.data[id].y]}"
+ puts6 "Left #{@co.data[:grid][@co.data[id].x - 1][@co.data[id].y]}"
+ puts6 "Down #{@co.data[:grid][@co.data[id].x][@co.data[id].y + 1]}"
+ puts6 "Up #{@co.data[:grid][@co.data[id].x][@co.data[id].y - 1]}"
+ # puts6 @co.data[:grid][@co.data[id].x + 1][@co.data[id].y][:hitbox].nil?
- if !(Components::Sprite.id & Entity.signatures[id]).zero?
- if $gtk.args.inputs.keyboard.key_down.send(data.north) &&\
- (@co.data[:grid][@co.data[id].x][@co.data[id].y - 1].nil? ||\
- @co.data[:grid][@co.data[id].x][@co.data[id].y - 1][:hitbox].nil?)
+ unless (Components::Sprite.id & Entity.signatures[id]).zero?
+ if $gtk.args.inputs.keyboard.key_down.send(data.north) && \
+ (@co.data[:grid][@co.data[id].x][@co.data[id].y - 1].nil? || \
+ @co.data[:grid][@co.data[id].x][@co.data[id].y - 1][:hitbox].nil?)
Components::Sprite.data[id].y -= 64
@co.data[id].y -= 1
- elsif $gtk.args.inputs.keyboard.key_down.send(data.south) &&\
- (@co.data[:grid][@co.data[id].x][@co.data[id].y + 1].nil? ||\
- @co.data[:grid][@co.data[id].x][@co.data[id].y + 1][:hitbox].nil?)
+ elsif $gtk.args.inputs.keyboard.key_down.send(data.south) && \
+ (@co.data[:grid][@co.data[id].x][@co.data[id].y + 1].nil? || \
+ @co.data[:grid][@co.data[id].x][@co.data[id].y + 1][:hitbox].nil?)
Components::Sprite.data[id].y += 64
@co.data[id].y += 1
- elsif $gtk.args.inputs.keyboard.key_down.send(data.east) &&\
- (@co.data[:grid][@co.data[id].x + 1][@co.data[id].y].nil? ||\
- @co.data[:grid][@co.data[id].x + 1][@co.data[id].y][:hitbox].nil?)
+ elsif $gtk.args.inputs.keyboard.key_down.send(data.east) && \
+ (@co.data[:grid][@co.data[id].x + 1][@co.data[id].y].nil? || \
+ @co.data[:grid][@co.data[id].x + 1][@co.data[id].y][:hitbox].nil?)
Components::Sprite.data[id].x += 64
@co.data[id].x += 1
- elsif $gtk.args.inputs.keyboard.key_down.send(data.west) &&\
- (@co.data[:grid][@co.data[id].x - 1][@co.data[id].y].nil? || @co.data[:grid][@co.data[id].x - 1][@co.data[id].y][:hitbox].nil?)
+ elsif $gtk.args.inputs.keyboard.key_down.send(data.west) && \
+ (@co.data[:grid][@co.data[id].x - 1][@co.data[id].y].nil? || @co.data[:grid][@co.data[id].x - 1][@co.data[id].y][:hitbox].nil?)
Components::Sprite.data[id].x -= 64
@co.data[id].x -= 1
end
- #Components::Sprite.data[id].y -= 64 if $gtk.args.inputs.keyboard.key_down.send(data.north)
- #Components::Sprite.data[id].y += 64 if $gtk.args.inputs.keyboard.key_down.send(data.south)
- #Components::Sprite.data[id].x += 64 if $gtk.args.inputs.keyboard.key_down.send(data.east)
- #Components::Sprite.data[id].x -= 64 if $gtk.args.inputs.keyboard.key_down.send(data.west)
+ # Components::Sprite.data[id].y -= 64 if $gtk.args.inputs.keyboard.key_down.send(data.north)
+ # Components::Sprite.data[id].y += 64 if $gtk.args.inputs.keyboard.key_down.send(data.south)
+ # Components::Sprite.data[id].x += 64 if $gtk.args.inputs.keyboard.key_down.send(data.east)
+ # Components::Sprite.data[id].x -= 64 if $gtk.args.inputs.keyboard.key_down.send(data.west)
end
end
end
diff --git a/deprecated/systems/99_render.rb b/deprecated/systems/99_render.rb
index c71c6fc..dc1092e 100644
--- a/deprecated/systems/99_render.rb
+++ b/deprecated/systems/99_render.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class Systems
class Render
def self.run
- Components::Renderable.data.sort_by { |v| v[1].z }.each do |key, data|
+ Components::Renderable.data.sort_by { |v| v[1].z }.each do |key, _data|
if !(Components::Sprite.id & Entity.signatures[key]).zero?
$gtk.args.outputs.sprites << Components::Sprite.data[key].set
elsif !(Components::Label.id & Entity.signatures[key]).zero?
@@ -11,21 +13,29 @@ class Systems
layer['chunks'].each do |chunk|
chunk['data'].each_slice(chunk['width']).with_index do |row, row_index|
row.each_with_index do |tile, column_index|
- unless tile.zero?
- iter = 0
- loop do
- tile = Helper.get_tile(json_name: Components::Map.data[key].json['tilesets'][iter]['source'].split('/').last.delete('\\').delete_suffix('.tsx'), tile_index: tile)
- break if tile.is_a?(Hash)
- raise Exception.new "#{Components::Map.data[key].json['json_name']} not valid map, exceeded tile range" if (iter += 1) >= Components::Map.data[key].json['tilesets'].count
- end
- unless tile.empty?
- tile[:x] = Components::Map.data[key].x + (Components::Map.data[key].tilewidth * column_index) + chunk['x']
- tile[:y] = Components::Map.data[key].y + (Components::Map.data[key].tileheight * row_index) + chunk['y']
- tile[:w] = Components::Map.data[key].tilewidth
- tile[:h] = Components::Map.data[key].tileheight
- $gtk.args.outputs.sprites << tile
+ next if tile.zero?
+
+ iter = 0
+ loop do
+ tile = Helper.get_tile(
+ json_name: Components::Map.data[key].json['tilesets'][iter]['source'].split('/').last.delete('\\').delete_suffix('.tsx'), tile_index: tile
+ )
+ break if tile.is_a?(Hash)
+
+ if (iter += 1) >= Components::Map.data[key].json['tilesets'].count
+ raise StandardError,
+ "#{Components::Map.data[key].json["json_name"]} not valid map, exceeded tile range"
end
end
+ next if tile.empty?
+
+ tile[:x] =
+ Components::Map.data[key].x + (Components::Map.data[key].tilewidth * column_index) + chunk['x']
+ tile[:y] =
+ Components::Map.data[key].y + (Components::Map.data[key].tileheight * row_index) + chunk['y']
+ tile[:w] = Components::Map.data[key].tilewidth
+ tile[:h] = Components::Map.data[key].tileheight
+ $gtk.args.outputs.sprites << tile
end
end
end
diff --git a/docs/FelFlame.html b/docs/FelFlame.html
index 16bb6f9..439094e 100644
--- a/docs/FelFlame.html
+++ b/docs/FelFlame.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
- Class: FelFlame
+ Module: FelFlame
&mdash; Documentation by YARD 0.9.26
@@ -59,29 +59,13 @@
<div class="clear"></div>
</div>
- <div id="content"><h1>Class: FelFlame
+ <div id="content"><h1>Module: FelFlame
</h1>
<div class="box_info">
- <dl>
- <dt>Inherits:</dt>
- <dd>
- <span class="inheritName">Object</span>
-
- <ul class="fullTree">
- <li>Object</li>
-
- <li class="next">FelFlame</li>
-
- </ul>
- <a href="#" class="inheritanceTree">show all</a>
-
- </dd>
- </dl>
-
@@ -95,7 +79,7 @@
<dl>
<dt>Defined in:</dt>
<dd>lib/felflame.rb<span class="defines">,<br />
- lib/felflame/scene_manager.rb,<br /> lib/felflame/stage_manager.rb,<br /> lib/felflame/entity_manager.rb,<br /> lib/felflame/system_manager.rb,<br /> lib/felflame/component_manager.rb</span>
+ lib/felflame/order.rb,<br /> lib/felflame/scene_manager.rb,<br /> lib/felflame/stage_manager.rb,<br /> lib/felflame/entity_manager.rb,<br /> lib/felflame/system_manager.rb,<br /> lib/felflame/component_manager.rb</span>
</dd>
</dl>
@@ -116,9 +100,11 @@
<p class="children">
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span>, <span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span>, <span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span>
+
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="FelFlame/ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span>, <span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span>, <span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span>, <span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span>, <span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span>, <span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span>
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="FelFlame/ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span>, <span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span>, <span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span>, <span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span>
</p>
@@ -151,7 +137,7 @@
<div class="docstring">
<div class="discussion">
-<p>An alias for <span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></p>
+<p>An alias for <span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></p>
</div>
@@ -161,7 +147,7 @@
</div>
</dt>
- <dd><pre class="code"><span class='const'>FelFlame</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span></pre></dd>
+ <dd><pre class="code"><span class='const'>FelFlame</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span></pre></dd>
<dt id="Sys-constant" class="">Sys =
<div class="docstring">
@@ -199,7 +185,23 @@
<div class="docstring">
<div class="discussion">
-<p>An alias for <span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></p>
+<p>An alias for <span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div>
+ </dt>
+ <dd><pre class="code"><span class='const'>FelFlame</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span></pre></dd>
+
+ <dt id="Odr-constant" class="">Odr =
+ <div class="docstring">
+ <div class="discussion">
+ <dl class="rdoc-list note-list"><dt>An alias for {FelFlame
+<dd></dd></dl>
</div>
@@ -209,7 +211,7 @@
</div>
</dt>
- <dd><pre class="code"><span class='const'>FelFlame</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span></pre></dd>
+ <dd><pre class="code"><span class='const'>FelFlame</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span></span></pre></dd>
</dl>
@@ -287,15 +289,15 @@
<pre class="lines">
-15
-16
-17</pre>
+18
+19
+20</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame.rb', line 15</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame.rb', line 18</span>
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
- <span class='const'><span class='object_link'><a href="" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="FelFlame/Stage.html#call-class_method" title="FelFlame::Stage.call (method)">call</a></span></span>
+ <span class='const'><span class='object_link'><a href="" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="FelFlame/Stage.html#call-class_method" title="FelFlame::Stage.call (method)">call</a></span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -307,7 +309,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/ComponentManager.html b/docs/FelFlame/ComponentManager.html
index 1da6816..19891af 100644
--- a/docs/FelFlame/ComponentManager.html
+++ b/docs/FelFlame/ComponentManager.html
@@ -37,7 +37,7 @@
<div id="menu">
<a href="../_index.html">Index (C)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span>
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
&raquo;
<span class="title">ComponentManager</span>
@@ -102,7 +102,7 @@
<h2>Overview</h2><div class="docstring">
<div class="discussion">
-<p>Component Managers are what is used to create individual components which can be attached to entities. When a Component is created from a Component Manager that has accessors given to it, you can set or get the values of those accessors using standard ruby message sending (e.g <tt>@component.var = 5</tt>), or by using the <span class='object_link'><a href="#attrs-instance_method" title="FelFlame::ComponentManager#attrs (method)">#attrs</a></span> and <span class='object_link'><a href="#update_attrs-instance_method" title="FelFlame::ComponentManager#update_attrs (method)">#update_attrs</a></span> methods instead.</p>
+<p>Component Managers are what is used to create individual components which can be attached to entities. When a Component is created from a Component Manager that has accessors given to it, you can set or get the values of those accessors using standard ruby message sending (e.g <tt>@component.var = 5</tt>), or by using the <span class='object_link'><a href="#to_h-instance_method" title="FelFlame::ComponentManager#to_h (method)">#to_h</a></span> and <span class='object_link'><a href="#update_attrs-instance_method" title="FelFlame::ComponentManager#update_attrs (method)">#update_attrs</a></span> methods instead.</p>
</div>
@@ -270,35 +270,6 @@
<li class="public ">
<span class="summary_signature">
- <a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> &#x21d2; Integer </a>
-
-
-
- </span>
-
-
-
-
- <span class="note title readonly">readonly</span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Holds the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span> of a component.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
<a href="#removal_triggers-instance_method" title="#removal_triggers (instance method)">#<strong>removal_triggers</strong> &#x21d2; Array&lt;System&gt; </a>
@@ -332,63 +303,6 @@
<h2>
- Class Method Summary
- <small><a href="#" class="summary_toggle">collapse</a></small>
- </h2>
-
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#[]-class_method" title="[] (class method)">.<strong>[]</strong>(component_id) &#x21d2; Component </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Gets a Component from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span>.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Enumerator </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Iterates over all components within the component manager.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
- <h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
@@ -398,31 +312,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#attr_changed_trigger_systems-instance_method" title="#attr_changed_trigger_systems (instance method)">#<strong>attr_changed_trigger_systems</strong>(attr) &#x21d2; Boolean </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Execute systems that have been added to execute on variable change.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#attrs-instance_method" title="#attrs (instance method)">#<strong>attrs</strong> &#x21d2; Hash&lt;Symbol, Value&gt; </a>
+ <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong> &#x21d2; Boolean </a>
@@ -437,7 +327,7 @@
<span class="summary_desc"><div class='inline'>
-<p>A hash, where all the keys are attributes linked to their respective values.</p>
+<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its data.</p>
</div></span>
</li>
@@ -446,7 +336,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong> &#x21d2; Boolean </a>
+ <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> &#x21d2; Array&lt;Component&gt; </a>
@@ -461,7 +351,7 @@
<span class="summary_desc"><div class='inline'>
-<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span> and data.</p>
+<p>Entities that have this component.</p>
</div></span>
</li>
@@ -470,7 +360,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> &#x21d2; Array&lt;Integer&gt; </a>
+ <a href="#entity-instance_method" title="#entity (instance method)">#<strong>entity</strong> &#x21d2; Component </a>
@@ -485,7 +375,7 @@
<span class="summary_desc"><div class='inline'>
-<p>A list of entity ids that are linked to the component.</p>
+<p>A single entity.</p>
</div></span>
</li>
@@ -520,7 +410,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#to_i-instance_method" title="#to_i (instance method)">#<strong>to_i</strong> &#x21d2; Integer </a>
+ <a href="#to_h-instance_method" title="#to_h (instance method)">#<strong>to_h</strong> &#x21d2; Hash&lt;Symbol, Value&gt; </a>
@@ -535,7 +425,7 @@
<span class="summary_desc"><div class='inline'>
-<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID Reader</a></span>.</p>
+<p>A hash, where all the keys are attributes storing their respective values.</p>
</div></span>
</li>
@@ -617,47 +507,37 @@
<pre class="lines">
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122</pre>
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 104</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 132</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span>
<span class='comment'># Prepare the object
</span> <span class='comment'># (this is a function created with metaprogramming
-</span> <span class='comment'># in FelFlame::Components
+</span> <span class='comment'># in FelFlame::Components)
</span> <span class='id identifier rubyid_set_defaults'>set_defaults</span>
- <span class='comment'># Generate ID
-</span> <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span>
- <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='kw'>if</span> <span class='id identifier rubyid_new_id'>new_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_new_id'>new_id</span>
-
<span class='comment'># Fill params
</span> <span class='id identifier rubyid_attrs'>attrs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
<span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span>
<span class='kw'>end</span>
<span class='comment'># Save Component
-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_new_id'>new_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span>
+</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -710,12 +590,12 @@
<pre class="lines">
-136
-137
-138</pre>
+180
+181
+182</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 136</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 180</span>
<span class='kw'>def</span> <span class='id identifier rubyid_addition_triggers'>addition_triggers</span>
<span class='ivar'>@addition_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -766,12 +646,12 @@
<pre class="lines">
-152
-153
-154</pre>
+196
+197
+198</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 152</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 196</span>
<span class='kw'>def</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span>
<span class='ivar'>@attr_triggers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -822,12 +702,12 @@
<pre class="lines">
-144
-145
-146</pre>
+188
+189
+190</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 144</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 188</span>
<span class='kw'>def</span> <span class='id identifier rubyid_removal_triggers'>removal_triggers</span>
<span class='ivar'>@removal_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -883,12 +763,12 @@
<pre class="lines">
-81
-82
-83</pre>
+109
+110
+111</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 81</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 109</span>
<span class='kw'>def</span> <span class='id identifier rubyid_addition_triggers'>addition_triggers</span>
<span class='ivar'>@addition_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -939,12 +819,12 @@
<pre class="lines">
-97
-98
-99</pre>
+125
+126
+127</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 97</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 125</span>
<span class='kw'>def</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span>
<span class='ivar'>@attr_triggers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -955,62 +835,6 @@
</div>
- <span id="id=-instance_method"></span>
- <div class="method_details ">
- <h3 class="signature " id="id-instance_method">
-
- #<strong>id</strong> &#x21d2; <tt>Integer</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Holds the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span> of a component. The <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span> is only unique within the scope of the component manager it was created from.</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Integer</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-63
-64
-65</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 63</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
- <span class='ivar'>@id</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-
<span id="removal_triggers=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="removal_triggers-instance_method">
@@ -1051,12 +875,12 @@
<pre class="lines">
-89
-90
-91</pre>
+117
+118
+119</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 89</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 117</span>
<span class='kw'>def</span> <span class='id identifier rubyid_removal_triggers'>removal_triggers</span>
<span class='ivar'>@removal_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -1069,157 +893,14 @@
</div>
- <div id="class_method_details" class="method_details_list">
- <h2>Class Method Details</h2>
-
-
- <div class="method_details first">
- <h3 class="signature first" id="[]-class_method">
-
- .<strong>[]</strong>(component_id) &#x21d2; <tt>Component</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Gets a Component from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span>. Usage is simular to how an Array lookup works.</p>
-
-
- </div>
-</div>
-<div class="tags">
-
- <div class="examples">
- <p class="tag_title">Examples:</p>
-
-
- <pre class="example code"><code><span class='comment'># this gets the &#39;Health&#39; Component with ID 7
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='lbracket'>[</span><span class='int'>7</span><span class='rbracket'>]</span></code></pre>
-
- </div>
-<p class="tag_title">Parameters:</p>
-<ul class="param">
-
- <li>
-
- <span class='name'>component_id</span>
-
-
- <span class='type'>(<tt>Integer</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Component</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'>
-<p>Returns the Component that uses the given unique <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span>, nil if there is no Component associated with the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span></p>
-</div>
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-169
-170
-171</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 169</span>
-
-<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rbracket'>]</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- <div class="method_details ">
- <h3 class="signature " id="each-class_method">
-
- .<strong>each</strong>(&amp;block) &#x21d2; <tt>Enumerator</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Iterates over all components within the component manager. Special Enumerable methods like <code>map</code> or <code>each_with_index</code> are not implemented</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Enumerator</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-176
-177
-178</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 176</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- </div>
-
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
- <h3 class="signature first" id="attr_changed_trigger_systems-instance_method">
+ <h3 class="signature first" id="delete-instance_method">
- #<strong>attr_changed_trigger_systems</strong>(attr) &#x21d2; <tt>Boolean</tt>
+ #<strong>delete</strong> &#x21d2; <tt>Boolean</tt>
@@ -1228,7 +909,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Execute systems that have been added to execute on variable change</p>
+<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its data.</p>
</div>
@@ -1247,7 +928,7 @@
&mdash;
<div class='inline'>
-<p><code>true</code></p>
+<p><code>true</code>.</p>
</div>
</li>
@@ -1260,26 +941,34 @@
<pre class="lines">
-203
-204
-205
-206
-207
-208
-209
-210
-211</pre>
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 203</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 247</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_attr_changed_trigger_systems'>attr_changed_trigger_systems</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
- <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
-
- <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span> <span class='op'>|=</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
-
- <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:priority</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:call</span><span class='rparen'>)</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
+ <span class='id identifier rubyid_addition_triggers'>addition_triggers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_system'>system</span><span class='op'>|</span>
+ <span class='id identifier rubyid_system'>system</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='label'>component_or_manager:</span> <span class='kw'>self</span>
+ <span class='kw'>end</span>
+ <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_reverse_each'>reverse_each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_entity'>entity</span><span class='op'>|</span>
+ <span class='id identifier rubyid_entity'>entity</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span> <span class='kw'>self</span>
+ <span class='kw'>end</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid__data'>_data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
+ <span class='id identifier rubyid_instance_variables'>instance_variables</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='op'>|</span>
+ <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -1288,9 +977,9 @@
</div>
<div class="method_details ">
- <h3 class="signature " id="attrs-instance_method">
+ <h3 class="signature " id="entities-instance_method">
- #<strong>attrs</strong> &#x21d2; <tt>Hash&lt;Symbol, Value&gt;</tt>
+ #<strong>entities</strong> &#x21d2; <tt>Array&lt;Component&gt;</tt>
@@ -1299,7 +988,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Returns A hash, where all the keys are attributes linked to their respective values.</p>
+<p>Entities that have this component</p>
</div>
@@ -1312,14 +1001,9 @@
<li>
- <span class='type'>(<tt>Hash&lt;Symbol, Value&gt;</tt>)</span>
-
+ <span class='type'>(<tt>Array&lt;Component&gt;</tt>)</span>
- &mdash;
- <div class='inline'>
-<p>A hash, where all the keys are attributes linked to their respective values.</p>
-</div>
</li>
@@ -1331,23 +1015,15 @@
<pre class="lines">
-235
-236
-237
-238
-239
-240
-241</pre>
+209
+210
+211</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 235</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 209</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_attrs'>attrs</span>
- <span class='id identifier rubyid_return_hash'>return_hash</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variables'>instance_variables</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_final'>final</span><span class='op'>|</span>
- <span class='id identifier rubyid_final'>final</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_delete_prefix'>delete_prefix</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>@</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
- <span class='kw'>end</span>
- <span class='id identifier rubyid_return_hash'>return_hash</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:attr_triggers</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_return_hash'>return_hash</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_entities'>entities</span>
+ <span class='ivar'>@entities</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -1355,9 +1031,9 @@
</div>
<div class="method_details ">
- <h3 class="signature " id="delete-instance_method">
+ <h3 class="signature " id="entity-instance_method">
- #<strong>delete</strong> &#x21d2; <tt>Boolean</tt>
+ #<strong>entity</strong> &#x21d2; <tt>Component</tt>
@@ -1366,7 +1042,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span> and data.</p>
+<p>A single entity. Use this if you expect the component to only belong to one entity and you want to access it.</p>
</div>
@@ -1379,14 +1055,9 @@
<li>
- <span class='type'>(<tt>Boolean</tt>)</span>
-
+ <span class='type'>(<tt>Component</tt>)</span>
- &mdash;
- <div class='inline'>
-<p><code>true</code>.</p>
-</div>
</li>
@@ -1405,38 +1076,18 @@
219
220
221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232</pre>
+222</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 215</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
- <span class='id identifier rubyid_addition_triggers'>addition_triggers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_system'>system</span><span class='op'>|</span>
- <span class='id identifier rubyid_system'>system</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='label'>component_or_manager:</span> <span class='kw'>self</span>
- <span class='kw'>end</span>
- <span class='comment'># This needs to be cloned because indices get deleted as
-</span> <span class='comment'># the remove command is called, breaking the loop if it
-</span> <span class='comment'># wasn&#39;t referencing a clone(will get Nil errors)
-</span> <span class='id identifier rubyid_iter'>iter</span> <span class='op'>=</span> <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:clone</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_iter'>iter</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_entity'>entity</span><span class='op'>|</span>
- <span class='comment'>#FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil?
-</span> <span class='id identifier rubyid_entity'>entity</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span> <span class='kw'>self</span>
- <span class='kw'>end</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
- <span class='id identifier rubyid_instance_variables'>instance_variables</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='op'>|</span>
- <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_entity'>entity</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
+ <span class='const'>Warning</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This component belongs to NO entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;</span> <span class='int'>1</span>
+ <span class='const'>Warning</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This component belongs to MANY entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
- <span class='kw'>true</span>
+ <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -1444,9 +1095,9 @@
</div>
<div class="method_details ">
- <h3 class="signature " id="entities-instance_method">
+ <h3 class="signature " id="to_h-instance_method">
- #<strong>entities</strong> &#x21d2; <tt>Array&lt;Integer&gt;</tt>
+ #<strong>to_h</strong> &#x21d2; <tt>Hash&lt;Symbol, Value&gt;</tt>
@@ -1455,7 +1106,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>A list of entity ids that are linked to the component</p>
+<p>Returns A hash, where all the keys are attributes storing their respective values.</p>
</div>
@@ -1468,63 +1119,14 @@
<li>
- <span class='type'>(<tt>Array&lt;Integer&gt;</tt>)</span>
+ <span class='type'>(<tt>Hash&lt;Symbol, Value&gt;</tt>)</span>
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-189
-190
-191</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 189</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_entities'>entities</span>
- <span class='ivar'>@entities</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- <div class="method_details ">
- <h3 class="signature " id="to_i-instance_method">
-
- #<strong>to_i</strong> &#x21d2; <tt>Integer</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID Reader</a></span></p>
-
-
- </div>
+ &mdash;
+ <div class='inline'>
+<p>A hash, where all the keys are attributes storing their respective values.</p>
</div>
-<div class="tags">
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Integer</tt>)</span>
-
-
</li>
@@ -1536,15 +1138,23 @@
<pre class="lines">
-183
-184
-185</pre>
+262
+263
+264
+265
+266
+267
+268</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 183</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 262</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
- <span class='id identifier rubyid_id'>id</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span>
+ <span class='id identifier rubyid_return_hash'>return_hash</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variables'>instance_variables</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_final'>final</span><span class='op'>|</span>
+ <span class='id identifier rubyid_final'>final</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_delete_prefix'>delete_prefix</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>@</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+ <span class='id identifier rubyid_return_hash'>return_hash</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:attr_triggers</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_return_hash'>return_hash</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -1595,14 +1205,14 @@
<pre class="lines">
-195
-196
-197
-198
-199</pre>
+226
+227
+228
+229
+230</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 195</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 226</span>
<span class='kw'>def</span> <span class='id identifier rubyid_update_attrs'>update_attrs</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
@@ -1619,7 +1229,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Components.html b/docs/FelFlame/Components.html
index a44ec31..be924da 100644
--- a/docs/FelFlame/Components.html
+++ b/docs/FelFlame/Components.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
- Class: FelFlame::Components
+ Module: FelFlame::Components
&mdash; Documentation by YARD 0.9.26
@@ -37,7 +37,7 @@
<div id="menu">
<a href="../_index.html">Index (C)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span>
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
&raquo;
<span class="title">Components</span>
@@ -59,37 +59,16 @@
<div class="clear"></div>
</div>
- <div id="content"><h1>Class: FelFlame::Components
+ <div id="content"><h1>Module: FelFlame::Components
</h1>
<div class="box_info">
- <dl>
- <dt>Inherits:</dt>
- <dd>
- <span class="inheritName">Object</span>
-
- <ul class="fullTree">
- <li>Object</li>
-
- <li class="next">FelFlame::Components</li>
-
- </ul>
- <a href="#" class="inheritanceTree">show all</a>
-
- </dd>
- </dl>
-
- <dl>
- <dt>Extended by:</dt>
- <dd>Enumerable</dd>
- </dl>
-
@@ -109,7 +88,7 @@
<h2>Overview</h2><div class="docstring">
<div class="discussion">
-<p>Creates component managers and allows accessing them them under the <span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span> namespace as Constants</p>
+<p>Creates component managers and allows accessing them them under the <span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span> namespace as Constants. You can use array methods directly on this class to access Component Managers.</p>
<p>To see how component managers are used please look at the <span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span> documentation.</p>
@@ -137,30 +116,6 @@
<li class="public ">
<span class="summary_signature">
- <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Enumerator </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Iterate over all existing component managers.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
<a href="#new-class_method" title="new (class method)">.<strong>new</strong>(component_name, *attrs, **attrs_with_defaults) &#x21d2; ComponentManager </a>
@@ -186,68 +141,13 @@
-
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
- <h3 class="signature first" id="each-class_method">
-
- .<strong>each</strong>(&amp;block) &#x21d2; <tt>Enumerator</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Iterate over all existing component managers. You also call other enumerable methods instead of each, such as <code>each_with_index</code> or <code>select</code></p>
-
-
- </div>
-</div>
-<div class="tags">
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Enumerator</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-51
-52
-53</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 51</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_constants'>constants</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- <div class="method_details ">
- <h3 class="signature " id="new-class_method">
+ <h3 class="signature first" id="new-class_method">
.<strong>new</strong>(component_name, *attrs, **attrs_with_defaults) &#x21d2; <tt><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></tt>
@@ -273,7 +173,7 @@
</span><span class='comment'># while max and current are nil until set.
</span><span class='comment'># When you make a new component using this component manager
</span><span class='comment'># these are the values and accessors it will have.
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Health</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='symbol'>:max</span><span class='comma'>,</span> <span class='symbol'>:current</span><span class='comma'>,</span> <span class='label'>color:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>red</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span></code></pre>
+</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Health</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='symbol'>:max</span><span class='comma'>,</span> <span class='symbol'>:current</span><span class='comma'>,</span> <span class='label'>color:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>red</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
@@ -349,7 +249,6 @@
<pre class="lines">
-19
20
21
22
@@ -377,39 +276,42 @@
44
45
46
-47</pre>
+47
+48
+49</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 19</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 20</span>
<span class='kw'>def</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_attrs'>attrs</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_attrs_with_defaults'>attrs_with_defaults</span><span class='rparen'>)</span>
- <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span>
<span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>NameError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Component Manager &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_component_name'>component_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39; is already defined</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
-
- <span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='comma'>,</span> <span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='comma'>,</span> <span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_update_const_cache'>update_const_cache</span>
<span class='id identifier rubyid_attrs'>attrs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
- <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_method_defined?'>method_defined?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_method_defined?'>method_defined?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NameError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The attribute name \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; is already a method</span><span class='tstring_end'>&quot;</span></span>
+ <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_method_defined?'>method_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_method_defined?'>method_defined?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NameError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The attribute name \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; is already a method</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='id identifier rubyid_attr'>attr</span>
+
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='id identifier rubyid_attr'>attr</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_attrs_with_defaults'>attrs_with_defaults</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='comma'>,</span> <span class='id identifier rubyid__default'>_default</span><span class='op'>|</span>
<span class='id identifier rubyid_attrs_with_defaults'>attrs_with_defaults</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid__default'>_default</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='id identifier rubyid_attr'>attr</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='id identifier rubyid_attr'>attr</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
<span class='id identifier rubyid_attr_changed_trigger_systems'>attr_changed_trigger_systems</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_equal?'>equal?</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
<span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:set_defaults</span><span class='rparen'>)</span> <span class='kw'>do</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:set_defaults</span><span class='rparen'>)</span> <span class='kw'>do</span>
<span class='id identifier rubyid_attrs_with_defaults'>attrs_with_defaults</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='comma'>,</span> <span class='id identifier rubyid_default'>default</span><span class='op'>|</span>
<span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_default'>default</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -421,7 +323,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Entities.html b/docs/FelFlame/Entities.html
index 9d10529..37a9d84 100644
--- a/docs/FelFlame/Entities.html
+++ b/docs/FelFlame/Entities.html
@@ -37,7 +37,7 @@
<div id="menu">
<a href="../_index.html">Index (E)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span>
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
&raquo;
<span class="title">Entities</span>
@@ -85,11 +85,6 @@
- <dl>
- <dt>Extended by:</dt>
- <dd>Enumerable</dd>
- </dl>
-
@@ -109,7 +104,7 @@
<h2>Overview</h2><div class="docstring">
<div class="discussion">
-<p>Creates and manages Entities. Allows accessing Entities using their <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID</a></span>. Entities are just collections of Components.</p>
+<p>Creates and manages Entities. Entities are just collections of Components. You can use array methods directly on this class to access Entities.</p>
</div>
@@ -121,46 +116,12 @@
- <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> &#x21d2; Integer </a>
-
-
-
- </span>
-
-
-
-
- <span class="note title readonly">readonly</span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Holds the unique ID of this entity.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
<h2>
- Class Method Summary
+ Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
@@ -169,31 +130,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#[]-class_method" title="[] (class method)">.<strong>[]</strong>(entity_id) &#x21d2; Entity </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Gets an Entity from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">unique ID</a></span>.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Enumerator </a>
+ <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) &#x21d2; Boolean </a>
@@ -208,25 +145,16 @@
<span class="summary_desc"><div class='inline'>
-<p>Iterates over all entities.</p>
+<p>Add any number components to the Entity.</p>
</div></span>
</li>
- </ul>
-
- <h2>
- Instance Method Summary
- <small><a href="#" class="summary_toggle">collapse</a></small>
- </h2>
-
- <ul class="summary">
-
<li class="public ">
<span class="summary_signature">
- <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) &#x21d2; Boolean </a>
+ <a href="#component-instance_method" title="#component (instance method)">#<strong>component</strong>(manager = nil) &#x21d2; Component </a>
@@ -241,7 +169,7 @@
<span class="summary_desc"><div class='inline'>
-<p>Add any number components to the Entity.</p>
+<p>A single component from a component manager.</p>
</div></span>
</li>
@@ -265,7 +193,7 @@
<span class="summary_desc"><div class='inline'>
-<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the <span class='object_link'><a href="ComponentManager.html#id-instance_method" title="FelFlame::ComponentManager#id (method)">IDs</a></span> of the components attached to this entity.</p>
+<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the the components attached to this entity.</p>
</div></span>
</li>
@@ -289,7 +217,7 @@
<span class="summary_desc"><div class='inline'>
-<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID</a></span> and data.</p>
+<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its data.</p>
</div></span>
</li>
@@ -345,35 +273,10 @@
</li>
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#to_i-instance_method" title="#to_i (instance method)">#<strong>to_i</strong> &#x21d2; Integer </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID reader</a></span>.</p>
-</div></span>
-
-</li>
-
-
</ul>
-
- <div id="constructor_details" class="method_details_list">
+<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
@@ -402,7 +305,7 @@
<span class='name'>components</span>
- <span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (class)">Components</a></span></tt>)</span>
+ <span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (module)">Components</a></span></tt>)</span>
@@ -422,31 +325,19 @@
<pre class="lines">
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26</pre>
+8
+9
+10
+11
+12</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 16</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 8</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components'>components</span><span class='rparen'>)</span>
- <span class='comment'># Assign new unique ID
-</span> <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:nil?</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='kw'>if</span> <span class='id identifier rubyid_new_id'>new_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_new_id'>new_id</span>
-
<span class='comment'># Add each component
</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components'>components</span><span class='rparen'>)</span>
-
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid__data'>_data</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -455,76 +346,15 @@
</div>
- <div id="instance_attr_details" class="attr_details">
- <h2>Instance Attribute Details</h2>
-
-
- <span id="id=-instance_method"></span>
- <div class="method_details first">
- <h3 class="signature first" id="id-instance_method">
-
- #<strong>id</strong> &#x21d2; <tt>Integer</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Holds the unique ID of this entity</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Integer</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-5
-6
-7</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 5</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
- <span class='ivar'>@id</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- </div>
-
-
- <div id="class_method_details" class="method_details_list">
- <h2>Class Method Details</h2>
+ <div id="instance_method_details" class="method_details_list">
+ <h2>Instance Method Details</h2>
<div class="method_details first">
- <h3 class="signature first" id="[]-class_method">
+ <h3 class="signature first" id="add-instance_method">
- .<strong>[]</strong>(entity_id) &#x21d2; <tt>Entity</tt>
+ #<strong>add</strong>(*components_to_add) &#x21d2; <tt>Boolean</tt>
@@ -533,33 +363,29 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Gets an Entity from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">unique ID</a></span>. Usage is simular to how an Array lookup works</p>
+<p>Add any number components to the Entity.</p>
</div>
</div>
<div class="tags">
-
- <div class="examples">
- <p class="tag_title">Examples:</p>
-
-
- <pre class="example code"><code><span class='comment'># This gets the Entity with ID 7
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='lbracket'>[</span><span class='int'>7</span><span class='rbracket'>]</span></code></pre>
-
- </div>
-<p class="tag_title">Parameters:</p>
+ <p class="tag_title">Parameters:</p>
<ul class="param">
<li>
- <span class='name'>entity_id</span>
+ <span class='name'>components_to_add</span>
- <span class='type'>(<tt>Integer</tt>)</span>
+ <span class='type'>(<tt>Component</tt>)</span>
+ &mdash;
+ <div class='inline'>
+<p>Any number of components created from any component manager</p>
+</div>
+
</li>
</ul>
@@ -570,13 +396,13 @@
<li>
- <span class='type'>(<tt>Entity</tt>)</span>
+ <span class='type'>(<tt>Boolean</tt>)</span>
&mdash;
<div class='inline'>
-<p>returns the Entity that uses the given unique ID, nil if there is no Entity associated with the given ID</p>
+<p><code>true</code></p>
</div>
</li>
@@ -589,15 +415,37 @@
<pre class="lines">
-116
-117
-118</pre>
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 116</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 57</span>
-<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_entity_id'>entity_id</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_entity_id'>entity_id</span><span class='rbracket'>]</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components_to_add'>components_to_add</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_components_to_add'>components_to_add</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+ <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='rbracket'>]</span>
+ <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
+ <span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span>
+ <span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_component'>component</span>
+ <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_component'>component</span>
+ <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
+ <span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+ <span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -605,9 +453,9 @@
</div>
<div class="method_details ">
- <h3 class="signature " id="each-class_method">
+ <h3 class="signature " id="component-instance_method">
- .<strong>each</strong>(&amp;block) &#x21d2; <tt>Enumerator</tt>
+ #<strong>component</strong>(manager = nil) &#x21d2; <tt>Component</tt>
@@ -616,87 +464,38 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Iterates over all entities. The data is compacted so that means index does not correlate to ID. You also call other enumerable methods instead of each, such as <code>each_with_index</code> or <code>select</code></p>
+<p>A single component from a component manager. Use this if you expect the component to only belong to one entity and you want to access it. Access the component using either parameter notation or array notation. Array notation is conventional for better readablility.</p>
</div>
</div>
<div class="tags">
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Enumerator</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-123
-124
-125</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 123</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- </div>
-
- <div id="instance_method_details" class="method_details_list">
- <h2>Instance Method Details</h2>
-
+ <div class="examples">
+ <p class="tag_title">Examples:</p>
- <div class="method_details first">
- <h3 class="signature first" id="add-instance_method">
-
- #<strong>add</strong>(*components_to_add) &#x21d2; <tt>Boolean</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
+
+ <pre class="example code"><code><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_component'>component</span><span class='lbracket'>[</span><span class='ivar'>@component_manager</span><span class='rbracket'>]</span> <span class='comment'># array notation(the standard)
+</span><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_component'>component</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span> <span class='comment'># method notation</span></code></pre>
-<p>Add any number components to the Entity.</p>
-
-
</div>
-</div>
-<div class="tags">
- <p class="tag_title">Parameters:</p>
+<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
- <span class='name'>components_to_add</span>
+ <span class='name'>manager</span>
- <span class='type'>(<tt>Component</tt>)</span>
+ <span class='type'>(<tt><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></tt>)</span>
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
+
&mdash;
<div class='inline'>
-<p>Any number of components created from any component manager</p>
+<p>If you pass nil you can then use array notation to access the same value.</p>
</div>
</li>
@@ -709,14 +508,9 @@
<li>
- <span class='type'>(<tt>Boolean</tt>)</span>
-
+ <span class='type'>(<tt>Component</tt>)</span>
- &mdash;
- <div class='inline'>
-<p><code>true</code></p>
-</div>
</li>
@@ -728,37 +522,37 @@
<pre class="lines">
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70</pre>
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 57</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components_to_add'>components_to_add</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_components_to_add'>components_to_add</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
- <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='rbracket'>]</span>
- <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
- <span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span>
- <span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_component'>component</span>
- <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_component'>component</span>
- <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
- <span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 26</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_component'>component</span><span class='lparen'>(</span><span class='id identifier rubyid_manager'>manager</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_manager'>manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_component_redirect'>component_redirect</span><span class='period'>.</span><span class='id identifier rubyid_entity'>entity</span> <span class='op'>=</span> <span class='kw'>self</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_component_redirect'>component_redirect</span>
+ <span class='kw'>else</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_manager'>manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This entity(</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>) doesnt have any components of this type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_manager'>manager</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_manager'>manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;</span> <span class='int'>1</span>
+ <span class='const'>Warning</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This entity has MANY of this component but you called the method that is intended for having a single of this component type.\nYou may have a bug in your logic.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
+
+ <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_manager'>manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
<span class='kw'>end</span>
- <span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -777,7 +571,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the <span class='object_link'><a href="ComponentManager.html#id-instance_method" title="FelFlame::ComponentManager#id (method)">IDs</a></span> of the components attached to this entity.</p>
+<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the the components attached to this entity.</p>
</div>
@@ -804,12 +598,12 @@
<pre class="lines">
-30
-31
-32</pre>
+16
+17
+18</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 30</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 16</span>
<span class='kw'>def</span> <span class='id identifier rubyid_components'>components</span>
<span class='ivar'>@components</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -831,7 +625,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID</a></span> and data.</p>
+<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its data.</p>
</div>
@@ -863,7 +657,6 @@
<pre class="lines">
-42
43
44
45
@@ -876,17 +669,16 @@
52</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 42</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 43</span>
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
- <span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component_manager'>component_manager</span><span class='comma'>,</span> <span class='id identifier rubyid_component_array'>component_array</span><span class='op'>|</span>
- <span class='id identifier rubyid_component_array'>component_array</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
+ <span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__component_manager'>_component_manager</span><span class='comma'>,</span> <span class='id identifier rubyid_component_array'>component_array</span><span class='op'>|</span>
+ <span class='id identifier rubyid_component_array'>component_array</span><span class='period'>.</span><span class='id identifier rubyid_reverse_each'>reverse_each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid__data'>_data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
<span class='ivar'>@components</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
- <span class='ivar'>@id</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -965,7 +757,8 @@
91
92
93
-94</pre>
+94
+95</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 87</span>
@@ -975,6 +768,7 @@
<span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:removal_triggers</span> <span class='kw'>if</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='kw'>self</span>
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
<span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span>
+ <span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>end</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
@@ -983,66 +777,12 @@
</table>
</div>
- <div class="method_details ">
- <h3 class="signature " id="to_i-instance_method">
-
- #<strong>to_i</strong> &#x21d2; <tt>Integer</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID reader</a></span></p>
-
-
- </div>
-</div>
-<div class="tags">
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Integer</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-36
-37
-38</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 36</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
- <span class='id identifier rubyid_id'>id</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
</div>
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Order.html b/docs/FelFlame/Order.html
new file mode 100644
index 0000000..832e16f
--- /dev/null
+++ b/docs/FelFlame/Order.html
@@ -0,0 +1,251 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>
+ Module: FelFlame::Order
+
+ &mdash; Documentation by YARD 0.9.26
+
+</title>
+
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
+
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
+
+<script type="text/javascript">
+ pathId = "FelFlame::Order";
+ relpath = '../';
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div class="nav_wrap">
+ <iframe id="nav" src="../class_list.html?1"></iframe>
+ <div id="resizer"></div>
+ </div>
+
+ <div id="main" tabindex="-1">
+ <div id="header">
+ <div id="menu">
+
+ <a href="../_index.html">Index (O)</a> &raquo;
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
+ &raquo;
+ <span class="title">Order</span>
+
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="../class_list.html">
+
+ <svg width="24" height="24">
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
+ </svg>
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <div id="content"><h1>Module: FelFlame::Order
+
+
+
+</h1>
+<div class="box_info">
+
+
+
+
+
+
+
+
+
+
+
+ <dl>
+ <dt>Defined in:</dt>
+ <dd>lib/felflame.rb<span class="defines">,<br />
+ lib/felflame/order.rb</span>
+</dd>
+ </dl>
+
+</div>
+
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+
+<p>Sets the priority of a list of Systems or Scenes for you in the order you pass them to this class.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div>
+
+
+
+
+
+
+
+ <h2>
+ Class Method Summary
+ <small><a href="#" class="summary_toggle">collapse</a></small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#sort-class_method" title="sort (class method)">.<strong>sort</strong>(*sortables) &#x21d2; Boolean </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Sets the priority of all items passed into this method according to the order they were passed.</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+
+
+ <div id="class_method_details" class="method_details_list">
+ <h2>Class Method Details</h2>
+
+
+ <div class="method_details first">
+ <h3 class="signature first" id="sort-class_method">
+
+ .<strong>sort</strong>(*sortables) &#x21d2; <tt>Boolean</tt>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Sets the priority of all items passed into this method according to the order they were passed. If an array is one of the elements then it will give all of those elements in the array the same priority.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>sortables</span>
+
+
+ <span class='type'>(<tt>(<span class='object_link'><a href="Systems.html" title="FelFlame::Systems (class)">Systems</a></span> and Array&lt;<span class='object_link'><a href="Systems.html" title="FelFlame::Systems (class)">Systems</a></span>&gt;) or (<span class='object_link'><a href="Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span> and Array&lt;<span class='object_link'><a href="Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span>&gt;)</tt>)</span>
+
+
+
+ </li>
+
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Boolean</tt>)</span>
+
+
+
+ &mdash;
+ <div class='inline'>
+<p><code>true</code>.</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/felflame/order.rb', line 11</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_sortables'>sortables</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_sortables'>sortables</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sorted'>sorted</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_sorted'>sorted</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='symbol'>:priority</span>
+ <span class='id identifier rubyid_sorted'>sorted</span><span class='period'>.</span><span class='id identifier rubyid_priority'>priority</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
+ <span class='kw'>else</span>
+ <span class='id identifier rubyid_sorted'>sorted</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
+ <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_priority'>priority</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+ <span class='kw'>true</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+</div>
+
+ <div id="footer">
+ Generated on Mon Jan 3 08:23:04 2022 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.9.26 (ruby-2.7.3).
+</div>
+
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/docs/FelFlame/Scenes.html b/docs/FelFlame/Scenes.html
index 41e369e..68f4ece 100644
--- a/docs/FelFlame/Scenes.html
+++ b/docs/FelFlame/Scenes.html
@@ -37,7 +37,7 @@
<div id="menu">
<a href="../_index.html">Index (S)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span>
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
&raquo;
<span class="title">Scenes</span>
@@ -104,9 +104,7 @@
<h2>Overview</h2><div class="docstring">
<div class="discussion">
-<p>Creates and manages Scenes. Scenes are collections of Systems, and execute all the Systems when called upon.</p>
-
-<p>TODO: Improve Scenes overview</p>
+<p>Creates and manages Scenes. Scenes are collections of Systems, and execute all the Systems when called upon. Any scenes you create are accessable under the <span class='object_link'><a href="" title="FelFlame::Scenes (class)">Scenes</a></span> namespace as Constants.</p>
</div>
@@ -124,7 +122,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#const_name-instance_method" title="#const_name (instance method)">#<strong>const_name</strong> &#x21d2; Object </a>
+ <a href="#priority-instance_method" title="#priority (instance method)">#<strong>priority</strong> &#x21d2; Object </a>
@@ -133,8 +131,6 @@
- <span class="note title readonly">readonly</span>
-
@@ -144,7 +140,7 @@
<span class="summary_desc"><div class='inline'>
-<p>The Constant name assigned to this Scene.</p>
+<p>How early this Scene should be executed in a list of Scenes.</p>
</div></span>
</li>
@@ -267,7 +263,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name) &#x21d2; Scenes </a>
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name, priority: 0) &#x21d2; Scenes </a>
@@ -308,7 +304,7 @@
<span class="summary_desc"><div class='inline'>
-<p>Removes any number of SystemS from this Scene.</p>
+<p>Removes any number of Systems from this Scene.</p>
</div></span>
</li>
@@ -323,7 +319,7 @@
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
- #<strong>initialize</strong>(name) &#x21d2; <tt><span class='object_link'><a href="" title="FelFlame::Scenes (class)">Scenes</a></span></tt>
+ #<strong>initialize</strong>(name, priority: 0) &#x21d2; <tt><span class='object_link'><a href="" title="FelFlame::Scenes (class)">Scenes</a></span></tt>
@@ -366,17 +362,17 @@
<pre class="lines">
-14
-15
-16
-17</pre>
+22
+23
+24
+25</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 14</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 22</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span>
- <span class='ivar'>@const_name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>0</span><span class='rparen'>)</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_priority'>priority</span> <span class='op'>=</span> <span class='id identifier rubyid_priority'>priority</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -389,11 +385,11 @@
<h2>Instance Attribute Details</h2>
- <span id=""></span>
+ <span id="priority=-instance_method"></span>
<div class="method_details first">
- <h3 class="signature first" id="const_name-instance_method">
+ <h3 class="signature first" id="priority-instance_method">
- #<strong>const_name</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
+ #<strong>priority</strong> &#x21d2; <tt>Object</tt>
@@ -402,7 +398,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>The Constant name assigned to this Scene</p>
+<p>How early this Scene should be executed in a list of Scenes</p>
</div>
@@ -416,15 +412,15 @@
<pre class="lines">
-4
-5
-6</pre>
+12
+13
+14</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 4</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 12</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_const_name'>const_name</span>
- <span class='ivar'>@const_name</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_priority'>priority</span>
+ <span class='ivar'>@priority</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -472,12 +468,12 @@
<pre class="lines">
-21
-22
-23</pre>
+29
+30
+31</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 21</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 29</span>
<span class='kw'>def</span> <span class='id identifier rubyid_systems'>systems</span>
<span class='ivar'>@systems</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -538,20 +534,24 @@
<pre class="lines">
-34
-35
-36
-37
-38
-39</pre>
+42
+43
+44
+45
+46
+47
+48
+49</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 34</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 42</span>
<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_systems_to_add'>systems_to_add</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_systems'>systems</span> <span class='op'>|=</span> <span class='id identifier rubyid_systems_to_add'>systems_to_add</span>
- <span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_sort_by!'>sort_by!</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:priority</span><span class='rparen'>)</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_update_systems_list'>update_systems_list</span> <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_scenes'><span class='object_link'><a href="Stage.html#scenes-class_method" title="FelFlame::Stage.scenes (method)">scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='kw'>self</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_systems'>systems</span> <span class='op'>=</span> <span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:priority</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_systems_to_add'>systems_to_add</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_system'>system</span><span class='op'>|</span>
+ <span class='id identifier rubyid_system'>system</span><span class='period'>.</span><span class='id identifier rubyid_scenes'>scenes</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
+ <span class='kw'>end</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -603,13 +603,13 @@
<pre class="lines">
-27
-28
-29
-30</pre>
+35
+36
+37
+38</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 27</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 35</span>
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
<span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:call</span><span class='rparen'>)</span>
@@ -664,19 +664,25 @@
<pre class="lines">
-52
-53
-54
-55
-56</pre>
+60
+61
+62
+63
+64
+65
+66
+67</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 52</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 60</span>
<span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span>
+ <span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_system'>system</span><span class='op'>|</span>
+ <span class='id identifier rubyid_system'>system</span><span class='period'>.</span><span class='id identifier rubyid_scenes'>scenes</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
+ <span class='kw'>end</span>
<span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_update_systems_list'>update_systems_list</span> <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_scenes'><span class='object_link'><a href="Stage.html#scenes-class_method" title="FelFlame::Stage.scenes (method)">scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='kw'>self</span>
- <span class='kw'>true</span>
+ <span class='comment'># FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
+</span> <span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -695,7 +701,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Removes any number of SystemS from this Scene</p>
+<p>Removes any number of Systems from this Scene</p>
</div>
@@ -727,20 +733,16 @@
<pre class="lines">
-43
-44
-45
-46
-47
-48</pre>
+53
+54
+55
+56</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 43</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 53</span>
<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_systems_to_remove'>systems_to_remove</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_systems'>systems</span> <span class='op'>-=</span> <span class='id identifier rubyid_systems_to_remove'>systems_to_remove</span>
- <span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_sort_by!'>sort_by!</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:priority</span><span class='rparen'>)</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_update_systems_list'>update_systems_list</span> <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_scenes'><span class='object_link'><a href="Stage.html#scenes-class_method" title="FelFlame::Stage.scenes (method)">scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='kw'>self</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -753,7 +755,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Stage.html b/docs/FelFlame/Stage.html
index 65fe2f4..7dd9b26 100644
--- a/docs/FelFlame/Stage.html
+++ b/docs/FelFlame/Stage.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
- Class: FelFlame::Stage
+ Module: FelFlame::Stage
&mdash; Documentation by YARD 0.9.26
@@ -37,7 +37,7 @@
<div id="menu">
<a href="../_index.html">Index (S)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span>
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
&raquo;
<span class="title">Stage</span>
@@ -59,29 +59,13 @@
<div class="clear"></div>
</div>
- <div id="content"><h1>Class: FelFlame::Stage
+ <div id="content"><h1>Module: FelFlame::Stage
</h1>
<div class="box_info">
- <dl>
- <dt>Inherits:</dt>
- <dd>
- <span class="inheritName">Object</span>
-
- <ul class="fullTree">
- <li>Object</li>
-
- <li class="next">FelFlame::Stage</li>
-
- </ul>
- <a href="#" class="inheritanceTree">show all</a>
-
- </dd>
- </dl>
-
@@ -104,7 +88,7 @@
<h2>Overview</h2><div class="docstring">
<div class="discussion">
-<p>Stores Scenes which you want to execute on each frame. When called upon will execute all Systems in the Scenes in the Stage and will execute them according to their priority order.</p>
+<p>Stores Scenes you add to it which you want to execute on each frame. When called upon will execute all Systems in the Scenes in the Stage and will execute them according to their priority order.</p>
</div>
@@ -305,12 +289,12 @@
<pre class="lines">
-58
-59
-60</pre>
+42
+43
+44</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 58</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 42</span>
<span class='kw'>def</span> <span class='id identifier rubyid_scenes'>scenes</span>
<span class='ivar'>@scenes</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -371,24 +355,18 @@
<pre class="lines">
-11
-12
13
14
15
16
-17
-18</pre>
+17</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 11</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 13</span>
<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_scenes_to_add'>scenes_to_add</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_scenes'>scenes</span> <span class='op'>|=</span> <span class='id identifier rubyid_scenes_to_add'>scenes_to_add</span>
- <span class='id identifier rubyid_scenes_to_add'>scenes_to_add</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_scene'>scene</span><span class='op'>|</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_systems'>systems</span> <span class='op'>|=</span> <span class='id identifier rubyid_scene'>scene</span><span class='period'>.</span><span class='id identifier rubyid_systems'>systems</span>
- <span class='kw'>end</span>
- <span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_sort_by!'>sort_by!</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:priority</span><span class='rparen'>)</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_scenes'>scenes</span> <span class='op'>=</span> <span class='id identifier rubyid_scenes'>scenes</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:priority</span><span class='rparen'>)</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -408,7 +386,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Executes one frame of the game. This executes all the Systems in the Scenes added to the Stage. Systems that exist in two or more different Scenes will still only get executed once.</p>
+<p>Executes one frame of the game. This executes all the Scenes added to the Stage in order of their priority.</p>
</div>
@@ -440,16 +418,16 @@
<pre class="lines">
-51
-52
-53
-54</pre>
+35
+36
+37
+38</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 51</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 35</span>
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
- <span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:call</span><span class='rparen'>)</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_scenes'>scenes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:call</span><span class='rparen'>)</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -501,18 +479,16 @@
<pre class="lines">
-43
-44
-45
-46
-47</pre>
+28
+29
+30
+31</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 43</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 28</span>
<span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span>
- <span class='id identifier rubyid_systems'>systems</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
- <span class='id identifier rubyid_scenes'>scenes</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_scenes'>scenes</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -564,18 +540,16 @@
<pre class="lines">
+21
22
23
-24
-25
-26</pre>
+24</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 22</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/stage_manager.rb', line 21</span>
<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_scenes_to_remove'>scenes_to_remove</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_scenes'>scenes</span> <span class='op'>-=</span> <span class='id identifier rubyid_scenes_to_remove'>scenes_to_remove</span>
- <span class='id identifier rubyid_update_systems_list'>update_systems_list</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
</td>
@@ -588,7 +562,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Systems.html b/docs/FelFlame/Systems.html
index f0f8d56..d2fb24f 100644
--- a/docs/FelFlame/Systems.html
+++ b/docs/FelFlame/Systems.html
@@ -37,7 +37,7 @@
<div id="menu">
<a href="../_index.html">Index (S)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span>
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
&raquo;
<span class="title">Systems</span>
@@ -85,11 +85,6 @@
- <dl>
- <dt>Extended by:</dt>
- <dd>Enumerable</dd>
- </dl>
-
@@ -109,9 +104,7 @@
<h2>Overview</h2><div class="docstring">
<div class="discussion">
-<p>Creates an manages Systems. Systems are the logic of the game and do not contain any data within them.</p>
-
-<p>TODO: Improve Systems overview</p>
+<p>Creates and manages Systems. Systems are the logic of the game and do not contain any data within them. Any systems you create are accessable under the <span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span> namespace as Constants. You can use array methods directly on this class to access Systems.</p>
</div>
@@ -187,7 +180,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#const_name-instance_method" title="#const_name (instance method)">#<strong>const_name</strong> &#x21d2; Object </a>
+ <a href="#priority-instance_method" title="#priority (instance method)">#<strong>priority</strong> &#x21d2; Object </a>
@@ -196,8 +189,6 @@
- <span class="note title readonly">readonly</span>
-
@@ -207,7 +198,7 @@
<span class="summary_desc"><div class='inline'>
-<p>The Constant name assigned to this System.</p>
+<p>How early this System should be executed in a list of Systems.</p>
</div></span>
</li>
@@ -216,7 +207,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#priority-instance_method" title="#priority (instance method)">#<strong>priority</strong> &#x21d2; Object </a>
+ <a href="#removal_triggers-instance_method" title="#removal_triggers (instance method)">#<strong>removal_triggers</strong> &#x21d2; Array&lt;Component&gt; </a>
@@ -225,6 +216,8 @@
+ <span class="note title readonly">readonly</span>
+
@@ -234,7 +227,7 @@
<span class="summary_desc"><div class='inline'>
-<p>How early this System should be executed in a list of Systems.</p>
+<p>Stores references to components or their managers that trigger this component when a component or component from that manager is removed from an entity.</p>
</div></span>
</li>
@@ -243,7 +236,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#removal_triggers-instance_method" title="#removal_triggers (instance method)">#<strong>removal_triggers</strong> &#x21d2; Array&lt;Component&gt; </a>
+ <a href="#scenes-instance_method" title="#scenes (instance method)">#<strong>scenes</strong> &#x21d2; Object </a>
@@ -252,8 +245,6 @@
- <span class="note title readonly">readonly</span>
-
@@ -262,9 +253,7 @@
- <span class="summary_desc"><div class='inline'>
-<p>Stores references to components or their managers that trigger this component when a component or component from that manager is removed from an entity.</p>
-</div></span>
+ <span class="summary_desc"><div class='inline'></div></span>
</li>
@@ -285,7 +274,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Enumerator </a>
+ <a href="#const_cache-class_method" title="const_cache (class method)">.<strong>const_cache</strong> &#x21d2; Object </a>
@@ -300,7 +289,7 @@
<span class="summary_desc"><div class='inline'>
-<p>Iterate over all Systems, sorted by their priority.</p>
+<p>Stores the systems in <span class='object_link'><a href="Components.html" title="FelFlame::Components (module)">Components</a></span>.</p>
</div></span>
</li>
@@ -488,8 +477,7 @@
</ul>
-
- <div id="constructor_details" class="method_details_list">
+<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
@@ -515,8 +503,8 @@
<p class="tag_title">Examples:</p>
- <pre class="example code"><code><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>PassiveHeal</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='op'>-</span><span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>PassiveHeal</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='op'>-</span><span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_hp'>hp</span> <span class='op'>+=</span> <span class='int'>5</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
@@ -586,21 +574,23 @@
<pre class="lines">
-71
-72
-73
-74
-75
-76</pre>
+115
+116
+117
+118
+119
+120
+121</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 71</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 115</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span>
- <span class='ivar'>@const_name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span>
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_update_const_cache'>update_const_cache</span>
<span class='ivar'>@priority</span> <span class='op'>=</span> <span class='id identifier rubyid_priority'>priority</span>
<span class='ivar'>@block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
+ <span class='ivar'>@scenes</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -653,12 +643,12 @@
<pre class="lines">
-24
-25
-26</pre>
+35
+36
+37</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 24</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 35</span>
<span class='kw'>def</span> <span class='id identifier rubyid_addition_triggers'>addition_triggers</span>
<span class='ivar'>@addition_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -709,12 +699,12 @@
<pre class="lines">
-42
-43
-44</pre>
+52
+53
+54</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 42</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 52</span>
<span class='kw'>def</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span>
<span class='ivar'>@attr_triggers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -725,49 +715,6 @@
</div>
- <span id=""></span>
- <div class="method_details ">
- <h3 class="signature " id="const_name-instance_method">
-
- #<strong>const_name</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>The Constant name assigned to this System</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-7
-8
-9</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 7</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_const_name'>const_name</span>
- <span class='ivar'>@const_name</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-
<span id="priority=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="priority-instance_method">
@@ -795,12 +742,12 @@
<pre class="lines">
-4
-5
-6</pre>
+6
+7
+8</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 4</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 6</span>
<span class='kw'>def</span> <span class='id identifier rubyid_priority'>priority</span>
<span class='ivar'>@priority</span>
@@ -851,12 +798,12 @@
<pre class="lines">
-33
-34
-35</pre>
+44
+45
+46</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 33</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 44</span>
<span class='kw'>def</span> <span class='id identifier rubyid_removal_triggers'>removal_triggers</span>
<span class='ivar'>@removal_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -866,6 +813,38 @@
</table>
</div>
+
+ <span id="scenes=-instance_method"></span>
+ <div class="method_details ">
+ <h3 class="signature " id="scenes-instance_method">
+
+ #<strong>scenes</strong> &#x21d2; <tt>Object</tt>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+19
+20
+21</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 19</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_scenes'>scenes</span>
+ <span class='ivar'>@scenes</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
</div>
@@ -874,9 +853,9 @@
<div class="method_details first">
- <h3 class="signature first" id="each-class_method">
+ <h3 class="signature first" id="const_cache-class_method">
- .<strong>each</strong>(&amp;block) &#x21d2; <tt>Enumerator</tt>
+ .<strong>const_cache</strong> &#x21d2; <tt>Object</tt>
@@ -885,26 +864,13 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Iterate over all Systems, sorted by their priority. You also call other enumerable methods instead of each, such as <code>each_with_index</code> or <code>select</code></p>
+<p>Stores the systems in <span class='object_link'><a href="Components.html" title="FelFlame::Components (module)">Components</a></span>. This is needed because calling `FelFlame::Components.constants` will not let you iterate over the value of the constants but will instead give you an array of symbols. This caches the convertion of those symbols to the actual value of the constants</p>
</div>
</div>
<div class="tags">
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Enumerator</tt>)</span>
-
-
-
- </li>
-
-</ul>
</div><table class="source_code">
<tr>
@@ -912,15 +878,15 @@
<pre class="lines">
-51
-52
-53</pre>
+63
+64
+65</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 51</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 63</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_constants'>constants</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sym'>sym</span><span class='op'>|</span> <span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:priority</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_const_cache'>const_cache</span>
+ <span class='ivar'>@const_cache</span> <span class='op'>||</span> <span class='id identifier rubyid_update_const_cache'>update_const_cache</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -959,12 +925,12 @@
<pre class="lines">
-79
-80
-81</pre>
+124
+125
+126</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 79</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 124</span>
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
<span class='ivar'>@block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
@@ -998,19 +964,19 @@
<pre class="example code"><code><span class='comment'># To clear all triggers that execute this system when a component is added:
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span>
+</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span>
<span class='comment'># Same as above but for when a component is removed instead
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:removal_triggers</span>
+</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:removal_triggers</span>
<span class='comment'># Same as above but for when a component has a certain attribute changed
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:attr_triggers</span>
+</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:attr_triggers</span>
<span class='comment'># Clear a trigger from a specific component
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='op'>::</span><span class='const'>ExampleComponent</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
+</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='op'>::</span><span class='const'>ExampleComponent</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
<span class='comment'># Clear a trigger from a specific component manager
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='op'>::</span><span class='const'>ExampleComponent</span>
+</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='op'>::</span><span class='const'>ExampleComponent</span>
<span class='comment'># Clear the trigger that executes a system when the &#39;:example_attr&#39; is changes
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:attr_triggers</span><span class='comma'>,</span> <span class='symbol'>:example_attr</span></code></pre>
+</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:attr_triggers</span><span class='comma'>,</span> <span class='symbol'>:example_attr</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
@@ -1077,52 +1043,6 @@
<pre class="lines">
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
157
158
159
@@ -1143,22 +1063,67 @@
174
175
176
-177</pre>
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 111</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 157</span>
<span class='kw'>def</span> <span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_trigger_types'>trigger_types</span><span class='comma'>,</span> <span class='label'>component_or_manager:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='symbol'>:removal_triggers</span><span class='comma'>,</span> <span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
+ <span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>=</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'> </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='symbol'>:attr_triggers</span>
- <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:addition_triggers</span><span class='comma'>,</span>
- <span class='symbol'>:removal_triggers</span><span class='comma'>,</span>
- <span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
+ <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'>
+ </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'>
+ </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='comment'>#remove all attrs
-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='comma'>,</span> <span class='id identifier rubyid_attrs'>attrs</span><span class='op'>|</span>
+ <span class='comment'># remove all attrs
+</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='comma'>,</span> <span class='id identifier rubyid_attrs'>attrs</span><span class='op'>|</span>
<span class='id identifier rubyid_attrs'>attrs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
@@ -1167,49 +1132,48 @@
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>end</span>
<span class='kw'>else</span>
- <span class='comment'>#remove attrs relevant to comp_or_man
-</span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
+ <span class='comment'># remove attrs relevant to comp_or_man
+</span> <span class='kw'>unless</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+ <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
<span class='kw'>end</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
+ <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
- <span class='kw'>else</span>
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='symbol'>:removal_triggers</span><span class='comma'>,</span> <span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
- <span class='comment'>#remove attr
-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='comma'>,</span> <span class='id identifier rubyid_attrs'>attrs</span><span class='op'>|</span>
- <span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:addition_triggers</span><span class='comma'>,</span>
- <span class='symbol'>:removal_triggers</span><span class='comma'>,</span>
- <span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span><span class='rparen'>)</span>
- <span class='kw'>else</span>
- <span class='comment'>#remove attr from component_or_manager
-</span> <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='symbol'>:removal_triggers</span><span class='comma'>,</span> <span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
- <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
+ <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'> </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
+ <span class='comment'># remove attr
+</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='comma'>,</span> <span class='id identifier rubyid__attrs'>_attrs</span><span class='op'>|</span>
+ <span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
<span class='kw'>end</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>-=</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='kw'>end</span>
+ <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'>
+ </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'>
+ </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</span>
+ <span class='kw'>else</span>
+ <span class='comment'># remove attr from component_or_manager
+</span> <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'> </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attr'>attr</span><span class='op'>|</span>
+ <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+
+ <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
+ <span class='kw'>end</span>
+ <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>-=</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='kw'>unless</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
- <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>&amp;</span> <span class='lbracket'>[</span><span class='symbol'>:removal_triggers</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='op'>|</span>
+ <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>&amp;</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>addition_triggers</span><span class='tstring_end'>]</span></span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='op'>|</span>
<span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='comment'>#remove all removal triggers
-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_trigger'>trigger</span><span class='op'>|</span>
+ <span class='comment'># remove all removal triggers
+</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_trigger'>trigger</span><span class='op'>|</span>
<span class='id identifier rubyid_trigger'>trigger</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
<span class='kw'>end</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>else</span>
- <span class='comment'>#remove removal trigger relevant to comp/man
-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span>
+ <span class='comment'># remove removal trigger relevant to comp/man
+</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span>
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
@@ -1266,12 +1230,12 @@
<pre class="lines">
-84
-85
-86</pre>
+130
+131
+132</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 84</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 130</span>
<span class='kw'>def</span> <span class='id identifier rubyid_redefine'>redefine</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='ivar'>@block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
@@ -1345,14 +1309,14 @@
<pre class="lines">
-182
-183
-184
-185
-186</pre>
+227
+228
+229
+230
+231</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 182</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 227</span>
<span class='kw'>def</span> <span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_addition_triggers'>addition_triggers</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span>
@@ -1408,22 +1372,22 @@
<pre class="lines">
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211</pre>
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 199</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 244</span>
<span class='kw'>def</span> <span class='id identifier rubyid_trigger_when_is_changed'>trigger_when_is_changed</span><span class='lparen'>(</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
@@ -1431,10 +1395,10 @@
<span class='kw'>else</span>
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
- <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+ <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
<span class='kw'>else</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
+ <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
<span class='kw'>true</span>
<span class='kw'>end</span></pre>
@@ -1507,14 +1471,14 @@
<pre class="lines">
-191
-192
-193
-194
-195</pre>
+236
+237
+238
+239
+240</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 191</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 236</span>
<span class='kw'>def</span> <span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_removal_triggers'>removal_triggers</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span>
@@ -1531,7 +1495,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/Felflame_.html b/docs/Felflame_.html
index 498cc3e..c748359 100644
--- a/docs/Felflame_.html
+++ b/docs/Felflame_.html
@@ -117,7 +117,7 @@
</div>
</dt>
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>3.0.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>4.0.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
</dl>
@@ -133,7 +133,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/_index.html b/docs/_index.html
index 70180bc..3a4b9fb 100644
--- a/docs/_index.html
+++ b/docs/_index.html
@@ -88,7 +88,7 @@
</li>
<li>
- <span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span>
+ <span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span>
<small>(FelFlame)</small>
@@ -118,7 +118,7 @@
<ul>
<li>
- <span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span>
+ <span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span>
</li>
@@ -131,6 +131,21 @@
</ul>
+ <ul id="alpha_O" class="alpha">
+ <li class="letter">O</li>
+ <ul>
+
+ <li>
+ <span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span>
+
+ <small>(FelFlame)</small>
+
+ </li>
+
+ </ul>
+ </ul>
+
+
<ul id="alpha_S" class="alpha">
<li class="letter">S</li>
<ul>
@@ -143,7 +158,7 @@
</li>
<li>
- <span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span>
+ <span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span>
<small>(FelFlame)</small>
@@ -168,7 +183,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:03 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/class_list.html b/docs/class_list.html
index 8d7b4f0..8275577 100644
--- a/docs/class_list.html
+++ b/docs/class_list.html
@@ -43,7 +43,7 @@
<ul id="full_list" class="class">
<li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
-<li id='object_FelFlame' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span> &lt; Object<small class='search_info'>Top Level Namespace</small></div><ul><li id='object_FelFlame::ComponentManager' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Components' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Entities' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Scenes' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Stage' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Systems' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li></ul></li><li id='object_Felflame' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Felflame_.html" title="Felflame (module)">Felflame</a></span><small class='search_info'>Top Level Namespace</small></div></li>
+<li id='object_FelFlame' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_FelFlame::ComponentManager' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Components' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span><small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Entities' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Order' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span><small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Scenes' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Stage' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span><small class='search_info'>FelFlame</small></div></li><li id='object_FelFlame::Systems' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span> &lt; Object<small class='search_info'>FelFlame</small></div></li></ul></li><li id='object_Felflame' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Felflame_.html" title="Felflame (module)">Felflame</a></span><small class='search_info'>Top Level Namespace</small></div></li>
</ul>
</div>
diff --git a/docs/file.README.html b/docs/file.README.html
index b856937..f62e0db 100644
--- a/docs/file.README.html
+++ b/docs/file.README.html
@@ -57,7 +57,9 @@
<div class="clear"></div>
</div>
- <div id="content"><div id='filecontents'><p><img src="https://filestorage.catgirls.rodeo/images/felflame-logo-smaller-text.png" alt="FelFlame"></p>
+ <div id="content"><div id='filecontents'><p><img src="https://raw.githubusercontent.com/realtradam/FelFlame/master/logos/felflame-logo-text.png" alt="FelFlame"></p>
+
+<!-- ![FelFlame](https://filestorage.catgirls.rodeo/images/felflame-logo-smaller-text.png) -->
<p><a href="https://codeclimate.com/github/realtradam/FelFlame/maintainability"><img src="https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/maintainability" alt="Maintainability"></a>
<a href="https://codeclimate.com/github/realtradam/FelFlame/test_coverage"><img src="https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/test_coverage" alt="Test Coverage"></a>
@@ -74,11 +76,12 @@
<ul>
<li><a href="#what-is-felflame">What is FelFlame?</a></li>
<li><a href="#what-is-ecs">What is ECS?</a>
- - <a href="#components">Components</a>
- - <a href="#entities">Entities</a>
- - <a href="#systems">Systems</a>
- - <a href="#scenes">Scenes</a>
- - <a href="#stage">Stage</a></li>
+ * <a href="#components">Components</a>
+ * <a href="#entities">Entities</a>
+ * <a href="#systems">Systems</a>
+ * <a href="#scenes">Scenes</a>
+ * <a href="#stage">Stage</a>
+ * <a href="#order">Order</a></li>
<li><a href="#usage">Usage</a>
<ul>
@@ -87,7 +90,6 @@
<ul>
<li><a href="#creation">Creation</a></li>
<li><a href="#accessing">Accessing</a></li>
-<li><a href="#get-id">Get ID</a></li>
<li><a href="#adding-and-removing-components">Adding and Removing Components</a></li>
<li><a href="#accessing-entities-attached-components">Accessing Entities&#39; Attached Components</a></li>
<li><a href="#deletion">Deletion</a></li>
@@ -97,10 +99,9 @@
<ul>
<li><a href="#creating-a-component-manager">Creating a Component Manager</a></li>
<li><a href="#creating-a-component-from-a-component-manager">Creating a Component from a Component Manager</a></li>
-<li><a href="#accessing-and-getting-id">Accessing and Getting ID</a></li>
+<li><a href="#accessing-1">Accessing</a></li>
<li><a href="#accessing-attributes-and-changing-them">Accessing Attributes and Changing Them</a></li>
<li><a href="#deleting-components">Deleting Components</a></li>
-<li><a href="#iterating-over-components">Iterating over Components</a></li>
<li><a href="#accessing-components-attached-entities">Accessing Components&#39; attached Entities</a></li>
</ul></li>
<li><a href="#systems-1">Systems</a>
@@ -116,7 +117,7 @@
<ul>
<li><a href="#creation-2">Creation</a></li>
-<li><a href="#accessing-1">Accessing</a></li>
+<li><a href="#accessing-2">Accessing</a></li>
<li><a href="#adding-systems">Adding Systems</a></li>
<li><a href="#removing-systems">Removing Systems</a></li>
<li><a href="#clearing">Clearing</a></li>
@@ -129,6 +130,11 @@
<li><a href="#removing-scenes">Removing Scenes</a></li>
<li><a href="#executing">Executing</a></li>
</ul></li>
+<li><a href="#order-1">Order</a>
+
+<ul>
+<li><a href="#setting-the-order">Setting the order</a></li>
+</ul></li>
<li><a href="#closing-notes">Closing Notes</a></li>
</ul></li>
<li><a href="#contribution">Contribution</a></li>
@@ -143,7 +149,7 @@
<ol>
<li><strong>Engine Agnostic:</strong> FelFlame has been designed to be rendering engine agnostic as long as the target rendering engine is written in Ruby. This means that this framework can be dropped into existing rendering engines such as <a href="http://www.ruby2d.com">Ruby2D</a> or <a href="https://dragonruby.org/toolkit/game">DRGTK</a> with little modifications.</li>
<li><strong>Easily Extensible:</strong> FelFlame has been designed such that extensions to its capabilities can be easily added. Extensions such as rendering engine wrappers, premade systems, premade components, etcetera can be easily coded and then distributed as gems.</li>
-<li><strong>Priciple of (My) Least Astonishment:</strong> I want to develop games using a language and framework I love and makes sense to me, inspired by the <a href="https://en.wikipedia.org/wiki/Ruby_(programming_language)#Philosophy">Philosophy of the creator of Ruby</a>.</li>
+<li><strong>Principle of (My) Least Astonishment:</strong> I want to develop games using a language and framework I love and makes sense to me, inspired by the <a href="https://en.wikipedia.org/wiki/Ruby_(programming_language)#Philosophy">Philosophy of the creator of Ruby</a>.</li>
</ol>
<h1 id="what-is-ecs">What is ECS?</h1>
@@ -169,7 +175,7 @@ ECS stands for Entity, Component, and System.</p>
<p>By using this pattern it allows programmers to easily control what an &quot;object&quot; or entity can do and how much data it needs to have. It avoids the issue of inhertance as no inhertance is ever required in this system. If you need a certain entity to have a certain functionality you just add the relevant component to it, and the systems that automatically go over specific components will give your entitiy the desired functionality. </p>
-<p><strong>&quot;But your framework also has <code>Scenes</code> and a <code>Stage</code>, what is that about?&quot;</strong> </p>
+<p><strong>&quot;But your framework also has <code>Scenes</code>, <code>Stage</code>, and <code>Order</code>, what is that about?&quot;</strong> </p>
<hr>
@@ -181,13 +187,19 @@ ECS stands for Entity, Component, and System.</p>
<p>The Stage is Scenes which are activated. This means any Scenes on the Stage are executed each frame, while the rest of the Systems are not.</p>
-<hr>
+<h3 id="order">Order</h3>
-<p>If all of this sounds very confusing, don&#39;t worry. A video tutorial series is in the works where I will build a game using this framework and explain every step of the way. You can also read some examples and explanations below.</p>
+<p>Order is a helper class which can set the priority of Scenes and Systems.</p>
+
+<hr>
<h1 id="usage">Usage</h1>
-<p>To use FelFlame simply install the gem using <code>gem install felflame</code> or using bundler <code>bundle add felflame</code> and then require it in your project like so: <code>require &#39;felflame&#39;</code>. Working outside of the gem for rendering engines that do not support the usage of gems is a planned feature in the works.</p>
+<p>There are 2 ways of using FelFlame. You can either <code>include</code> it as a gem in your project if your game engine supports this. The other option is to download the single file export of FelFlame and then <code>require_relative</code> this file in your project. The single file export takes all the ruby code in the various files and concatenates them into a single file so it is more portable and easy to add.</p>
+
+<p>To use the gem method you can do the following: install the gem using <code>gem install felflame</code> or using bundler <code>bundle add felflame</code> and then require it in your project like so: <code>require &#39;felflame&#39;</code>.</p>
+
+<p>To use the single file export method you simply download the felflame.rb file from the <a href="https://github.com/realtradam/FelFlame/releases">releases page on Github</a> and add it to your source folder and add a <code>require relative &#39;felflame.rb&#39;</code> line or wherever you have placed the file to use it.</p>
<h2 id="entities">Entities</h2>
@@ -195,32 +207,27 @@ ECS stands for Entity, Component, and System.</p>
<p>Entities are essentially &quot;objects&quot; in the game world. To create a new Entity we do the following:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Entities.html#initialize-instance_method" title="FelFlame::Entities#initialize (method)">new</a></span></span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Entities.html#initialize-instance_method" title="FelFlame::Entities#initialize (method)">new</a></span></span>
</code></pre>
-<p>or if we want to add (any number of)components to it:</p>
+<p>or if we want to add (any number of)components to it when creating it:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Entites</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
- <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Entites</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span>
<span class='ivar'>@component</span><span class='comma'>,</span>
- <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Armour</span><span class='lbracket'>[</span><span class='int'>7</span><span class='rbracket'>]</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>EnemyTeam</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
<span class='rparen'>)</span>
</code></pre>
<h3 id="accessing">Accessing</h3>
-<p>Once components are created we can access them using their ID like so:</p>
-
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
-</code></pre>
-
-<h3 id="get-id">Get ID</h3>
-
-<p>Entity ID&#39;s are generated starting from 0 and ascending, unless if there is a missing ID because of a deleted
-entity where a new entity will claim that ID. To get the ID of an Entity:</p>
+<p>Oftentimes you will not be accessing an Entity this way. Later we will shows you a more common way of accessing entities.
+If you need to you can access Entities using the <code>Entities</code> module:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
-</code></pre>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
+<span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
+<span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='comment'># you can iterate over all entities this way. Any valid array method can be used
+</span></code></pre>
<h3 id="adding-and-removing-components">Adding and Removing Components</h3>
@@ -232,14 +239,18 @@ entity where a new entity will claim that ID. To get the ID of an Entity:</p>
<h3 id="accessing-entities-attached-components">Accessing Entities&#39; Attached Components</h3>
+<p>This is the most common way of accessing an Entity</p>
+
<p>When Components are added to Entities, they can be accessed from the Entity. By using a Component Manager as a key we can access an array of all components created from that Component Manager that are attached to an entity:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='ivar'>@component_manager</span><span class='rbracket'>]</span> <span class='comment'># =&gt; [@component1, @component2, component3]
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='ivar'>@component_manager</span><span class='rbracket'>]</span> <span class='comment'># =&gt; [@component1, @component2, @component3]
</span></code></pre>
<h3 id="deletion">Deletion</h3>
-<p>To have all Components from an Entity removed and the Entity deleted we do the following:</p>
+<p>To have all Components from an Entity <strong>removed</strong> and the Entity deleted we do the following:</p>
+
+<p>NOTE: The components will <strong>not be deleted</strong>. They are simply <strong>removed</strong> from the entity and then the entity is destroyed. You must handle component deletion yourself as for example singleton components need to removed instead of deleted.</p>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
</code></pre>
@@ -251,7 +262,7 @@ entity where a new entity will claim that ID. To get the ID of an Entity:</p>
<p>Components are where all the data is stored. The data is stored in variables or accessors in each component.
These accessors and their defaults are configured when a component manager is created, like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component_manager</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Components.html#new-class_method" title="FelFlame::Components.new (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Stats</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='symbol'>:armour</span><span class='comma'>,</span> <span class='label'>hp:</span> <span class='int'>100</span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component_manager</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Components.html#new-class_method" title="FelFlame::Components.new (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Stats</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='symbol'>:armour</span><span class='comma'>,</span> <span class='label'>hp:</span> <span class='int'>100</span><span class='rparen'>)</span>
</code></pre>
<p>In this example we created a component manager called &quot;Stats&quot;.
@@ -265,22 +276,21 @@ When defining attributes symbols should be used.</p>
<p>Now that we have a component manager we can make components from it like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
</code></pre>
-<p>Or we can even change the defaults:</p>
+<p>Or we can even override the defaults when creating the component:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>armour:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>steel</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>armour:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>steel</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
</code></pre>
-<h3 id="accessing-and-getting-id">Accessing and Getting ID</h3>
+<h3 id="accessing">Accessing</h3>
-<p>Just like Entities, Components have IDs.
-These IDs are only unique within the scope of their respective Component Managers.
-Here is how we can get the ID, as well as how to access a Component from its Component Manager.</p>
+<p>You can access components using any array method.</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
-<span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='comment'># =&gt; 2
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
+<span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
+<span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='comment'># you can use iterators this way
</span></code></pre>
<h3 id="accessing-attributes-and-changing-them">Accessing Attributes and Changing Them</h3>
@@ -293,30 +303,26 @@ Here are the ways to edit attrubutes, followed by the ways to read them.</p>
</code></pre>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_hp'>hp</span> <span class='comment'># =&gt; 95
-</span><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_attrs'>attrs</span> <span class='comment'># =&gt; {armour: &#39;Leather&#39;, hp: 95}
+</span><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span> <span class='comment'># =&gt; {armour: &#39;Leather&#39;, hp: 95}
</span></code></pre>
<h3 id="deleting-components">Deleting Components</h3>
-<p>Deleting a Component is the same format as deleting an Entity. When a Component is deleted referenced to it such as to entities are automatically cleared.</p>
+<p>Deleting a Component is the same convention as deleting an Entity. When a Component is deleted referenced to it such as to entities are automatically cleared.</p>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
</code></pre>
-<h3 id="iterating-over-components">Iterating over Components</h3>
-
-<p>When you make Systems you will want to be able to iterate over all Components of the same Component Manager(for example iterating over all sprites to render them). Here is how we do that:</p>
-
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Sprites</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
- <span class='comment'>#do something with components
-</span><span class='kw'>end</span>
-</code></pre>
-
<h3 id="accessing-components-attached-entities">Accessing Components&#39; attached Entities</h3>
<p>Components also keep track of what Entities are using it. To access this list we do the following:</p>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span> <span class='comment'># =&gt; [@entity1, @entity2, @entity3]
+</span>
+<span class='comment'># get the first entity attached.
+</span><span class='comment'># this will throw a warning if there is more or less then
+</span><span class='comment'># exactly one entity
+</span><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_entity'>entity</span> <span class='comment'># =&gt; @entity
</span></code></pre>
<h2 id="systems">Systems</h2>
@@ -325,24 +331,26 @@ Here are the ways to edit attrubutes, followed by the ways to read them.</p>
<p>We can create Systems like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
<span class='comment'># Code and Logic
</span><span class='kw'>end</span>
</code></pre>
<p>The name we assign is how we can access the System, like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span>
</code></pre>
<p>Priority determines the order Systems should be executed, this is used for <code>Scenes</code> and the <code>Stage</code>.
The lower the number, the earlier a given System will be executed.
-E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
+E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
+
+<p>Both Scenes and Systems have a priority. System priority will decide the order it will be called inside of a Scene, which the Scene priority will decide the order it will be called inside of the Stage.</p>
<p>Often we will want to execute some logic on each Component in a given Component Manager so our code might look like this:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
- <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Sprites</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Sprites</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
<span class='comment'># do something with these components
</span> <span class='kw'>end</span>
<span class='kw'>end</span>
@@ -352,7 +360,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>After we create a System, it won&#39;t do anything on its own until we tell it to. Here is how:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
</code></pre>
<p>Sometimes you might want to manually activate a System, but the more common way to have Systems be triggered is to use Scenes and the Stage or the alternative ways of execution.</p>
@@ -362,25 +370,25 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>Sometimes you want a System to automatically trigger when a special even happens. FelFlame can keep track of when a Component is added, removed, or when an attribute is changed and then execute Systems linked to these events. Here is how to create these links:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># When this Component is added to an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
<span class='comment'># When this Component is removed from an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
<span class='comment'># When this Component&#39;s health attribute is changed, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<p>If we want these triggers to happen for all Components that belong to specific Component Manager then we can do that instead:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># When a Component from this Component Manager is added to an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
<span class='comment'># When a Component from this Component Manager is removed from an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
<span class='comment'># When this Component&#39;s health attribute from this Component Manager is changed, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<p>We can create any number of these links between Systems, Components, and Component Manangers as we like, simply call the method again with our other Components and Component Managers</p>
@@ -390,41 +398,41 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>If we wish to remove these links that we created, we can do that using the follwing function in any of the following ways:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># clears ALL triggers with this system
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span>
<span class='comment'># clears ALL triggers with this Component Manager
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_added&#39; for this Component
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_removed&#39; for this Component
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_is_set&#39; for this Component specifically for the health attribute
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<p>Likewise we can do the same with Component Managers:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># clears ALL triggers with this Component
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_added&#39; for this Component Manager
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_removed&#39; for this Component Manager
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_is_set&#39; for this Component Manager specifically for the health attribute
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<h3 id="redefinition">Redefinition</h3>
<p>If we wanted to change what code or logic a given System executes, we could do that with:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_redefine'>redefine</span> <span class='kw'>do</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_redefine'>redefine</span> <span class='kw'>do</span>
<span class='comment'># Some new logic or code
</span><span class='kw'>end</span>
</code></pre>
@@ -435,28 +443,36 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>Once we have all the core parts of ECS, we will want to organize our Systems. To do this we will use Scenes to group up Systems so they can quickly be enabled or disabled. Note that <a href="#alternative-execution">Alternative Executions</a> will occur even if they are not part of a Scene. Here is how we make a new Scene:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Scenes.html#initialize-instance_method" title="FelFlame::Scenes#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ExampleScene</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Scenes.html#initialize-instance_method" title="FelFlame::Scenes#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ExampleScene</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>5</span><span class='rparen'>)</span>
</code></pre>
<h3 id="accessing">Accessing</h3>
<p>Just like other classes in FelFlame, the name we gave the Scene is how we access it:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span>
</code></pre>
<h3 id="adding-systems">Adding Systems</h3>
<p>Adding Systems is simple. We can add as many as we want. In this example we add 3 different systems:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span> <span class='ivar'>@system2</span><span class='comma'>,</span> <span class='ivar'>@system3</span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span>
+ <span class='ivar'>@system2</span><span class='comma'>,</span>
+ <span class='ivar'>@system3</span>
+<span class='rparen'>)</span>
</code></pre>
<h3 id="removing-systems">Removing Systems</h3>
-<p>Removing Systems works simularly:</p>
+<p>Removing Systems works similarly:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span> <span class='ivar'>@system2</span><span class='comma'>,</span> <span class='ivar'>@system3</span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span>
+ <span class='ivar'>@system2</span><span class='comma'>,</span>
+ <span class='ivar'>@system3</span>
+<span class='rparen'>)</span>
</code></pre>
<h3 id="clearing">Clearing</h3>
@@ -479,23 +495,45 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<h3 id="adding-scenes">Adding Scenes</h3>
-<p>Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is active. To add a Scene we do the following:</p>
+<p>Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is &#39;active&#39;. To add a Scene we do the following:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_add'><span class='object_link'><a href="FelFlame/Stage.html#add-class_method" title="FelFlame::Stage.add (method)">add</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_add'><span class='object_link'><a href="FelFlame/Stage.html#add-class_method" title="FelFlame::Stage.add (method)">add</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
</code></pre>
<h3 id="removing-scenes">Removing Scenes</h3>
<p>Likewise we can remove Scenes:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_remove'><span class='object_link'><a href="FelFlame/Stage.html#remove-class_method" title="FelFlame::Stage.remove (method)">remove</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_remove'><span class='object_link'><a href="FelFlame/Stage.html#remove-class_method" title="FelFlame::Stage.remove (method)">remove</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
</code></pre>
<h3 id="executing">Executing</h3>
-<p>On each frame of the game we want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will make sure for you that all the Systems from all Scenes added will be executed in the correct order according to their priority. Here is how we do it:</p>
+<p>On each frame of the game generally we will want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will call all Scenes you added to it in the order of their priority. Here is how we do it:</p>
+
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="FelFlame/Stage.html#call-class_method" title="FelFlame::Stage.call (method)">call</a></span></span>
+</code></pre>
+
+<h2 id="order">Order</h2>
+
+<h3 id="setting-the-order">Setting the order</h3>
+
+<p>To set the order you just need to call <code>FelFlame::Order.sort</code> and pass Scenes or Systems in the parameters in the order you wish for them to execute</p>
+
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sort'><span class='object_link'><a href="FelFlame/Order.html#sort-class_method" title="FelFlame::Order.sort (method)">sort</a></span></span><span class='lparen'>(</span>
+ <span class='ivar'>@system1</span><span class='comma'>,</span>
+ <span class='ivar'>@system2</span><span class='comma'>,</span>
+ <span class='ivar'>@system3</span>
+<span class='rparen'>)</span>
+</code></pre>
+
+<p>If you want some Scenes or Systems to have the same priority then just pass them as an array:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="FelFlame/Stage.html#call-class_method" title="FelFlame::Stage.call (method)">call</a></span></span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sort'><span class='object_link'><a href="FelFlame/Order.html#sort-class_method" title="FelFlame::Order.sort (method)">sort</a></span></span><span class='lparen'>(</span>
+ <span class='ivar'>@scene1</span><span class='comma'>,</span>
+ <span class='lbracket'>[</span><span class='ivar'>@scene2_1</span><span class='comma'>,</span> <span class='ivar'>@scene2_2</span><span class='rbracket'>]</span><span class='comma'>,</span>
+ <span class='ivar'>@scene3</span>
+<span class='rparen'>)</span>
</code></pre>
<h2 id="closing-notes">Closing Notes</h2>
@@ -512,7 +550,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
</div></div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:03 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/index.html b/docs/index.html
index 14d70c2..83af15a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -57,7 +57,9 @@
<div class="clear"></div>
</div>
- <div id="content"><div id='filecontents'><p><img src="https://filestorage.catgirls.rodeo/images/felflame-logo-smaller-text.png" alt="FelFlame"></p>
+ <div id="content"><div id='filecontents'><p><img src="https://raw.githubusercontent.com/realtradam/FelFlame/master/logos/felflame-logo-text.png" alt="FelFlame"></p>
+
+<!-- ![FelFlame](https://filestorage.catgirls.rodeo/images/felflame-logo-smaller-text.png) -->
<p><a href="https://codeclimate.com/github/realtradam/FelFlame/maintainability"><img src="https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/maintainability" alt="Maintainability"></a>
<a href="https://codeclimate.com/github/realtradam/FelFlame/test_coverage"><img src="https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/test_coverage" alt="Test Coverage"></a>
@@ -74,11 +76,12 @@
<ul>
<li><a href="#what-is-felflame">What is FelFlame?</a></li>
<li><a href="#what-is-ecs">What is ECS?</a>
- - <a href="#components">Components</a>
- - <a href="#entities">Entities</a>
- - <a href="#systems">Systems</a>
- - <a href="#scenes">Scenes</a>
- - <a href="#stage">Stage</a></li>
+ * <a href="#components">Components</a>
+ * <a href="#entities">Entities</a>
+ * <a href="#systems">Systems</a>
+ * <a href="#scenes">Scenes</a>
+ * <a href="#stage">Stage</a>
+ * <a href="#order">Order</a></li>
<li><a href="#usage">Usage</a>
<ul>
@@ -87,7 +90,6 @@
<ul>
<li><a href="#creation">Creation</a></li>
<li><a href="#accessing">Accessing</a></li>
-<li><a href="#get-id">Get ID</a></li>
<li><a href="#adding-and-removing-components">Adding and Removing Components</a></li>
<li><a href="#accessing-entities-attached-components">Accessing Entities&#39; Attached Components</a></li>
<li><a href="#deletion">Deletion</a></li>
@@ -97,10 +99,9 @@
<ul>
<li><a href="#creating-a-component-manager">Creating a Component Manager</a></li>
<li><a href="#creating-a-component-from-a-component-manager">Creating a Component from a Component Manager</a></li>
-<li><a href="#accessing-and-getting-id">Accessing and Getting ID</a></li>
+<li><a href="#accessing-1">Accessing</a></li>
<li><a href="#accessing-attributes-and-changing-them">Accessing Attributes and Changing Them</a></li>
<li><a href="#deleting-components">Deleting Components</a></li>
-<li><a href="#iterating-over-components">Iterating over Components</a></li>
<li><a href="#accessing-components-attached-entities">Accessing Components&#39; attached Entities</a></li>
</ul></li>
<li><a href="#systems-1">Systems</a>
@@ -116,7 +117,7 @@
<ul>
<li><a href="#creation-2">Creation</a></li>
-<li><a href="#accessing-1">Accessing</a></li>
+<li><a href="#accessing-2">Accessing</a></li>
<li><a href="#adding-systems">Adding Systems</a></li>
<li><a href="#removing-systems">Removing Systems</a></li>
<li><a href="#clearing">Clearing</a></li>
@@ -129,6 +130,11 @@
<li><a href="#removing-scenes">Removing Scenes</a></li>
<li><a href="#executing">Executing</a></li>
</ul></li>
+<li><a href="#order-1">Order</a>
+
+<ul>
+<li><a href="#setting-the-order">Setting the order</a></li>
+</ul></li>
<li><a href="#closing-notes">Closing Notes</a></li>
</ul></li>
<li><a href="#contribution">Contribution</a></li>
@@ -143,7 +149,7 @@
<ol>
<li><strong>Engine Agnostic:</strong> FelFlame has been designed to be rendering engine agnostic as long as the target rendering engine is written in Ruby. This means that this framework can be dropped into existing rendering engines such as <a href="http://www.ruby2d.com">Ruby2D</a> or <a href="https://dragonruby.org/toolkit/game">DRGTK</a> with little modifications.</li>
<li><strong>Easily Extensible:</strong> FelFlame has been designed such that extensions to its capabilities can be easily added. Extensions such as rendering engine wrappers, premade systems, premade components, etcetera can be easily coded and then distributed as gems.</li>
-<li><strong>Priciple of (My) Least Astonishment:</strong> I want to develop games using a language and framework I love and makes sense to me, inspired by the <a href="https://en.wikipedia.org/wiki/Ruby_(programming_language)#Philosophy">Philosophy of the creator of Ruby</a>.</li>
+<li><strong>Principle of (My) Least Astonishment:</strong> I want to develop games using a language and framework I love and makes sense to me, inspired by the <a href="https://en.wikipedia.org/wiki/Ruby_(programming_language)#Philosophy">Philosophy of the creator of Ruby</a>.</li>
</ol>
<h1 id="what-is-ecs">What is ECS?</h1>
@@ -169,7 +175,7 @@ ECS stands for Entity, Component, and System.</p>
<p>By using this pattern it allows programmers to easily control what an &quot;object&quot; or entity can do and how much data it needs to have. It avoids the issue of inhertance as no inhertance is ever required in this system. If you need a certain entity to have a certain functionality you just add the relevant component to it, and the systems that automatically go over specific components will give your entitiy the desired functionality. </p>
-<p><strong>&quot;But your framework also has <code>Scenes</code> and a <code>Stage</code>, what is that about?&quot;</strong> </p>
+<p><strong>&quot;But your framework also has <code>Scenes</code>, <code>Stage</code>, and <code>Order</code>, what is that about?&quot;</strong> </p>
<hr>
@@ -181,13 +187,19 @@ ECS stands for Entity, Component, and System.</p>
<p>The Stage is Scenes which are activated. This means any Scenes on the Stage are executed each frame, while the rest of the Systems are not.</p>
-<hr>
+<h3 id="order">Order</h3>
-<p>If all of this sounds very confusing, don&#39;t worry. A video tutorial series is in the works where I will build a game using this framework and explain every step of the way. You can also read some examples and explanations below.</p>
+<p>Order is a helper class which can set the priority of Scenes and Systems.</p>
+
+<hr>
<h1 id="usage">Usage</h1>
-<p>To use FelFlame simply install the gem using <code>gem install felflame</code> or using bundler <code>bundle add felflame</code> and then require it in your project like so: <code>require &#39;felflame&#39;</code>. Working outside of the gem for rendering engines that do not support the usage of gems is a planned feature in the works.</p>
+<p>There are 2 ways of using FelFlame. You can either <code>include</code> it as a gem in your project if your game engine supports this. The other option is to download the single file export of FelFlame and then <code>require_relative</code> this file in your project. The single file export takes all the ruby code in the various files and concatenates them into a single file so it is more portable and easy to add.</p>
+
+<p>To use the gem method you can do the following: install the gem using <code>gem install felflame</code> or using bundler <code>bundle add felflame</code> and then require it in your project like so: <code>require &#39;felflame&#39;</code>.</p>
+
+<p>To use the single file export method you simply download the felflame.rb file from the <a href="https://github.com/realtradam/FelFlame/releases">releases page on Github</a> and add it to your source folder and add a <code>require relative &#39;felflame.rb&#39;</code> line or wherever you have placed the file to use it.</p>
<h2 id="entities">Entities</h2>
@@ -195,32 +207,27 @@ ECS stands for Entity, Component, and System.</p>
<p>Entities are essentially &quot;objects&quot; in the game world. To create a new Entity we do the following:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Entities.html#initialize-instance_method" title="FelFlame::Entities#initialize (method)">new</a></span></span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Entities.html#initialize-instance_method" title="FelFlame::Entities#initialize (method)">new</a></span></span>
</code></pre>
-<p>or if we want to add (any number of)components to it:</p>
+<p>or if we want to add (any number of)components to it when creating it:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Entites</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
- <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Entites</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span>
<span class='ivar'>@component</span><span class='comma'>,</span>
- <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Armour</span><span class='lbracket'>[</span><span class='int'>7</span><span class='rbracket'>]</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>EnemyTeam</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
<span class='rparen'>)</span>
</code></pre>
<h3 id="accessing">Accessing</h3>
-<p>Once components are created we can access them using their ID like so:</p>
-
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
-</code></pre>
-
-<h3 id="get-id">Get ID</h3>
-
-<p>Entity ID&#39;s are generated starting from 0 and ascending, unless if there is a missing ID because of a deleted
-entity where a new entity will claim that ID. To get the ID of an Entity:</p>
+<p>Oftentimes you will not be accessing an Entity this way. Later we will shows you a more common way of accessing entities.
+If you need to you can access Entities using the <code>Entities</code> module:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
-</code></pre>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
+<span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
+<span class='ivar'>@entity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Entities.html" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='comment'># you can iterate over all entities this way. Any valid array method can be used
+</span></code></pre>
<h3 id="adding-and-removing-components">Adding and Removing Components</h3>
@@ -232,14 +239,18 @@ entity where a new entity will claim that ID. To get the ID of an Entity:</p>
<h3 id="accessing-entities-attached-components">Accessing Entities&#39; Attached Components</h3>
+<p>This is the most common way of accessing an Entity</p>
+
<p>When Components are added to Entities, they can be accessed from the Entity. By using a Component Manager as a key we can access an array of all components created from that Component Manager that are attached to an entity:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='ivar'>@component_manager</span><span class='rbracket'>]</span> <span class='comment'># =&gt; [@component1, @component2, component3]
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='ivar'>@component_manager</span><span class='rbracket'>]</span> <span class='comment'># =&gt; [@component1, @component2, @component3]
</span></code></pre>
<h3 id="deletion">Deletion</h3>
-<p>To have all Components from an Entity removed and the Entity deleted we do the following:</p>
+<p>To have all Components from an Entity <strong>removed</strong> and the Entity deleted we do the following:</p>
+
+<p>NOTE: The components will <strong>not be deleted</strong>. They are simply <strong>removed</strong> from the entity and then the entity is destroyed. You must handle component deletion yourself as for example singleton components need to removed instead of deleted.</p>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
</code></pre>
@@ -251,7 +262,7 @@ entity where a new entity will claim that ID. To get the ID of an Entity:</p>
<p>Components are where all the data is stored. The data is stored in variables or accessors in each component.
These accessors and their defaults are configured when a component manager is created, like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component_manager</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Components.html#new-class_method" title="FelFlame::Components.new (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Stats</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='symbol'>:armour</span><span class='comma'>,</span> <span class='label'>hp:</span> <span class='int'>100</span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component_manager</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Components.html#new-class_method" title="FelFlame::Components.new (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Stats</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='symbol'>:armour</span><span class='comma'>,</span> <span class='label'>hp:</span> <span class='int'>100</span><span class='rparen'>)</span>
</code></pre>
<p>In this example we created a component manager called &quot;Stats&quot;.
@@ -265,22 +276,21 @@ When defining attributes symbols should be used.</p>
<p>Now that we have a component manager we can make components from it like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
</code></pre>
-<p>Or we can even change the defaults:</p>
+<p>Or we can even override the defaults when creating the component:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>armour:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>steel</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>armour:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>steel</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
</code></pre>
-<h3 id="accessing-and-getting-id">Accessing and Getting ID</h3>
+<h3 id="accessing">Accessing</h3>
-<p>Just like Entities, Components have IDs.
-These IDs are only unique within the scope of their respective Component Managers.
-Here is how we can get the ID, as well as how to access a Component from its Component Manager.</p>
+<p>You can access components using any array method.</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
-<span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='comment'># =&gt; 2
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
+<span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
+<span class='ivar'>@component</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Stats</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='comment'># you can use iterators this way
</span></code></pre>
<h3 id="accessing-attributes-and-changing-them">Accessing Attributes and Changing Them</h3>
@@ -293,30 +303,26 @@ Here are the ways to edit attrubutes, followed by the ways to read them.</p>
</code></pre>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_hp'>hp</span> <span class='comment'># =&gt; 95
-</span><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_attrs'>attrs</span> <span class='comment'># =&gt; {armour: &#39;Leather&#39;, hp: 95}
+</span><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span> <span class='comment'># =&gt; {armour: &#39;Leather&#39;, hp: 95}
</span></code></pre>
<h3 id="deleting-components">Deleting Components</h3>
-<p>Deleting a Component is the same format as deleting an Entity. When a Component is deleted referenced to it such as to entities are automatically cleared.</p>
+<p>Deleting a Component is the same convention as deleting an Entity. When a Component is deleted referenced to it such as to entities are automatically cleared.</p>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
</code></pre>
-<h3 id="iterating-over-components">Iterating over Components</h3>
-
-<p>When you make Systems you will want to be able to iterate over all Components of the same Component Manager(for example iterating over all sprites to render them). Here is how we do that:</p>
-
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Sprites</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
- <span class='comment'>#do something with components
-</span><span class='kw'>end</span>
-</code></pre>
-
<h3 id="accessing-components-attached-entities">Accessing Components&#39; attached Entities</h3>
<p>Components also keep track of what Entities are using it. To access this list we do the following:</p>
<pre class="code ruby"><code class="ruby"><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span> <span class='comment'># =&gt; [@entity1, @entity2, @entity3]
+</span>
+<span class='comment'># get the first entity attached.
+</span><span class='comment'># this will throw a warning if there is more or less then
+</span><span class='comment'># exactly one entity
+</span><span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_entity'>entity</span> <span class='comment'># =&gt; @entity
</span></code></pre>
<h2 id="systems">Systems</h2>
@@ -325,24 +331,26 @@ Here are the ways to edit attrubutes, followed by the ways to read them.</p>
<p>We can create Systems like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
<span class='comment'># Code and Logic
</span><span class='kw'>end</span>
</code></pre>
<p>The name we assign is how we can access the System, like so:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span>
</code></pre>
<p>Priority determines the order Systems should be executed, this is used for <code>Scenes</code> and the <code>Stage</code>.
The lower the number, the earlier a given System will be executed.
-E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
+E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
+
+<p>Both Scenes and Systems have a priority. System priority will decide the order it will be called inside of a Scene, which the Scene priority will decide the order it will be called inside of the Stage.</p>
<p>Often we will want to execute some logic on each Component in a given Component Manager so our code might look like this:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
- <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Sprites</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Render</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Components.html" title="FelFlame::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Sprites</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
<span class='comment'># do something with these components
</span> <span class='kw'>end</span>
<span class='kw'>end</span>
@@ -352,7 +360,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>After we create a System, it won&#39;t do anything on its own until we tell it to. Here is how:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
</code></pre>
<p>Sometimes you might want to manually activate a System, but the more common way to have Systems be triggered is to use Scenes and the Stage or the alternative ways of execution.</p>
@@ -362,25 +370,25 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>Sometimes you want a System to automatically trigger when a special even happens. FelFlame can keep track of when a Component is added, removed, or when an attribute is changed and then execute Systems linked to these events. Here is how to create these links:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># When this Component is added to an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
<span class='comment'># When this Component is removed from an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
<span class='comment'># When this Component&#39;s health attribute is changed, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<p>If we want these triggers to happen for all Components that belong to specific Component Manager then we can do that instead:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># When a Component from this Component Manager is added to an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
<span class='comment'># When a Component from this Component Manager is removed from an Entity, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
<span class='comment'># When this Component&#39;s health attribute from this Component Manager is changed, this System will be called
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_trigger_when_is_set'>trigger_when_is_set</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<p>We can create any number of these links between Systems, Components, and Component Manangers as we like, simply call the method again with our other Components and Component Managers</p>
@@ -390,41 +398,41 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>If we wish to remove these links that we created, we can do that using the follwing function in any of the following ways:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># clears ALL triggers with this system
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span>
<span class='comment'># clears ALL triggers with this Component Manager
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_added&#39; for this Component
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_removed&#39; for this Component
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_is_set&#39; for this Component specifically for the health attribute
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<p>Likewise we can do the same with Component Managers:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># clears ALL triggers with this Component
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_added&#39; for this Component Manager
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:added</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_removed&#39; for this Component Manager
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:removed</span><span class='rparen'>)</span>
<span class='comment'># clear the &#39;trigger_when_is_set&#39; for this Component Manager specifically for the health attribute
-</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
+</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='comma'>,</span> <span class='symbol'>:is_set</span><span class='comma'>,</span> <span class='symbol'>:health</span><span class='rparen'>)</span>
</code></pre>
<h3 id="redefinition">Redefinition</h3>
<p>If we wanted to change what code or logic a given System executes, we could do that with:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_redefine'>redefine</span> <span class='kw'>do</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>PassiveRegen</span><span class='period'>.</span><span class='id identifier rubyid_redefine'>redefine</span> <span class='kw'>do</span>
<span class='comment'># Some new logic or code
</span><span class='kw'>end</span>
</code></pre>
@@ -435,28 +443,36 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<p>Once we have all the core parts of ECS, we will want to organize our Systems. To do this we will use Scenes to group up Systems so they can quickly be enabled or disabled. Note that <a href="#alternative-execution">Alternative Executions</a> will occur even if they are not part of a Scene. Here is how we make a new Scene:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Scenes.html#initialize-instance_method" title="FelFlame::Scenes#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ExampleScene</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FelFlame/Scenes.html#initialize-instance_method" title="FelFlame::Scenes#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ExampleScene</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>5</span><span class='rparen'>)</span>
</code></pre>
<h3 id="accessing">Accessing</h3>
<p>Just like other classes in FelFlame, the name we gave the Scene is how we access it:</p>
-<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span>
+<pre class="code ruby"><code class="ruby"><span class='ivar'>@scene</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span>
</code></pre>
<h3 id="adding-systems">Adding Systems</h3>
<p>Adding Systems is simple. We can add as many as we want. In this example we add 3 different systems:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span> <span class='ivar'>@system2</span><span class='comma'>,</span> <span class='ivar'>@system3</span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span>
+ <span class='ivar'>@system2</span><span class='comma'>,</span>
+ <span class='ivar'>@system3</span>
+<span class='rparen'>)</span>
</code></pre>
<h3 id="removing-systems">Removing Systems</h3>
-<p>Removing Systems works simularly:</p>
+<p>Removing Systems works similarly:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span> <span class='ivar'>@system2</span><span class='comma'>,</span> <span class='ivar'>@system3</span><span class='rparen'>)</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Scenes.html" title="FelFlame::Scenes (class)">Scenes</a></span></span><span class='op'>::</span><span class='const'>ExampleScene</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span>
+ <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Systems.html" title="FelFlame::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>Render</span><span class='comma'>,</span>
+ <span class='ivar'>@system2</span><span class='comma'>,</span>
+ <span class='ivar'>@system3</span>
+<span class='rparen'>)</span>
</code></pre>
<h3 id="clearing">Clearing</h3>
@@ -479,23 +495,45 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
<h3 id="adding-scenes">Adding Scenes</h3>
-<p>Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is active. To add a Scene we do the following:</p>
+<p>Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is &#39;active&#39;. To add a Scene we do the following:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_add'><span class='object_link'><a href="FelFlame/Stage.html#add-class_method" title="FelFlame::Stage.add (method)">add</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_add'><span class='object_link'><a href="FelFlame/Stage.html#add-class_method" title="FelFlame::Stage.add (method)">add</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
</code></pre>
<h3 id="removing-scenes">Removing Scenes</h3>
<p>Likewise we can remove Scenes:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_remove'><span class='object_link'><a href="FelFlame/Stage.html#remove-class_method" title="FelFlame::Stage.remove (method)">remove</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_remove'><span class='object_link'><a href="FelFlame/Stage.html#remove-class_method" title="FelFlame::Stage.remove (method)">remove</a></span></span> <span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'>Scene</span><span class='op'>::</span><span class='const'>ExampleScene</span>
</code></pre>
<h3 id="executing">Executing</h3>
-<p>On each frame of the game we want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will make sure for you that all the Systems from all Scenes added will be executed in the correct order according to their priority. Here is how we do it:</p>
+<p>On each frame of the game generally we will want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will call all Scenes you added to it in the order of their priority. Here is how we do it:</p>
+
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (module)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="FelFlame/Stage.html#call-class_method" title="FelFlame::Stage.call (method)">call</a></span></span>
+</code></pre>
+
+<h2 id="order">Order</h2>
+
+<h3 id="setting-the-order">Setting the order</h3>
+
+<p>To set the order you just need to call <code>FelFlame::Order.sort</code> and pass Scenes or Systems in the parameters in the order you wish for them to execute</p>
+
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sort'><span class='object_link'><a href="FelFlame/Order.html#sort-class_method" title="FelFlame::Order.sort (method)">sort</a></span></span><span class='lparen'>(</span>
+ <span class='ivar'>@system1</span><span class='comma'>,</span>
+ <span class='ivar'>@system2</span><span class='comma'>,</span>
+ <span class='ivar'>@system3</span>
+<span class='rparen'>)</span>
+</code></pre>
+
+<p>If you want some Scenes or Systems to have the same priority then just pass them as an array:</p>
-<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Stage.html" title="FelFlame::Stage (class)">Stage</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="FelFlame/Stage.html#call-class_method" title="FelFlame::Stage.call (method)">call</a></span></span>
+<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FelFlame/Order.html" title="FelFlame::Order (module)">Order</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sort'><span class='object_link'><a href="FelFlame/Order.html#sort-class_method" title="FelFlame::Order.sort (method)">sort</a></span></span><span class='lparen'>(</span>
+ <span class='ivar'>@scene1</span><span class='comma'>,</span>
+ <span class='lbracket'>[</span><span class='ivar'>@scene2_1</span><span class='comma'>,</span> <span class='ivar'>@scene2_2</span><span class='rbracket'>]</span><span class='comma'>,</span>
+ <span class='ivar'>@scene3</span>
+<span class='rparen'>)</span>
</code></pre>
<h2 id="closing-notes">Closing Notes</h2>
@@ -512,7 +550,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
</div></div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:03 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/method_list.html b/docs/method_list.html
index 4071d1b..5f38f92 100644
--- a/docs/method_list.html
+++ b/docs/method_list.html
@@ -46,22 +46,6 @@
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Entities.html#[]-class_method" title="FelFlame::Entities.[] (method)">[]</a></span>
- <small>FelFlame::Entities</small>
- </div>
- </li>
-
-
- <li class="even ">
- <div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#[]-class_method" title="FelFlame::ComponentManager.[] (method)">[]</a></span>
- <small>FelFlame::ComponentManager</small>
- </div>
- </li>
-
-
- <li class="odd ">
- <div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#add-instance_method" title="FelFlame::Scenes#add (method)">#add</a></span>
<small>FelFlame::Scenes</small>
</div>
@@ -110,31 +94,15 @@
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#attr_changed_trigger_systems-instance_method" title="FelFlame::ComponentManager#attr_changed_trigger_systems (method)">#attr_changed_trigger_systems</a></span>
- <small>FelFlame::ComponentManager</small>
- </div>
- </li>
-
-
- <li class="even ">
- <div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#attr_triggers-instance_method" title="FelFlame::Systems#attr_triggers (method)">#attr_triggers</a></span>
<small>FelFlame::Systems</small>
</div>
</li>
- <li class="odd ">
- <div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#attr_triggers-instance_method" title="FelFlame::ComponentManager#attr_triggers (method)">#attr_triggers</a></span>
- <small>FelFlame::ComponentManager</small>
- </div>
- </li>
-
-
<li class="even ">
<div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#attr_triggers-class_method" title="FelFlame::ComponentManager.attr_triggers (method)">attr_triggers</a></span>
+ <span class='object_link'><a href="FelFlame/ComponentManager.html#attr_triggers-instance_method" title="FelFlame::ComponentManager#attr_triggers (method)">#attr_triggers</a></span>
<small>FelFlame::ComponentManager</small>
</div>
</li>
@@ -142,7 +110,7 @@
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#attrs-instance_method" title="FelFlame::ComponentManager#attrs (method)">#attrs</a></span>
+ <span class='object_link'><a href="FelFlame/ComponentManager.html#attr_triggers-class_method" title="FelFlame::ComponentManager.attr_triggers (method)">attr_triggers</a></span>
<small>FelFlame::ComponentManager</small>
</div>
</li>
@@ -206,7 +174,7 @@
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Entities.html#components-instance_method" title="FelFlame::Entities#components (method)">#components</a></span>
+ <span class='object_link'><a href="FelFlame/Entities.html#component-instance_method" title="FelFlame::Entities#component (method)">#component</a></span>
<small>FelFlame::Entities</small>
</div>
</li>
@@ -214,15 +182,15 @@
<li class="even ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Scenes.html#const_name-instance_method" title="FelFlame::Scenes#const_name (method)">#const_name</a></span>
- <small>FelFlame::Scenes</small>
+ <span class='object_link'><a href="FelFlame/Entities.html#components-instance_method" title="FelFlame::Entities#components (method)">#components</a></span>
+ <small>FelFlame::Entities</small>
</div>
</li>
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Systems.html#const_name-instance_method" title="FelFlame::Systems#const_name (method)">#const_name</a></span>
+ <span class='object_link'><a href="FelFlame/Systems.html#const_cache-class_method" title="FelFlame::Systems.const_cache (method)">const_cache</a></span>
<small>FelFlame::Systems</small>
</div>
</li>
@@ -246,38 +214,6 @@
<li class="even ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Entities.html#each-class_method" title="FelFlame::Entities.each (method)">each</a></span>
- <small>FelFlame::Entities</small>
- </div>
- </li>
-
-
- <li class="odd ">
- <div class="item">
- <span class='object_link'><a href="FelFlame/Systems.html#each-class_method" title="FelFlame::Systems.each (method)">each</a></span>
- <small>FelFlame::Systems</small>
- </div>
- </li>
-
-
- <li class="even ">
- <div class="item">
- <span class='object_link'><a href="FelFlame/Components.html#each-class_method" title="FelFlame::Components.each (method)">each</a></span>
- <small>FelFlame::Components</small>
- </div>
- </li>
-
-
- <li class="odd ">
- <div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#each-class_method" title="FelFlame::ComponentManager.each (method)">each</a></span>
- <small>FelFlame::ComponentManager</small>
- </div>
- </li>
-
-
- <li class="even ">
- <div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#entities-instance_method" title="FelFlame::ComponentManager#entities (method)">#entities</a></span>
<small>FelFlame::ComponentManager</small>
</div>
@@ -286,21 +222,13 @@
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Entities.html#id-instance_method" title="FelFlame::Entities#id (method)">#id</a></span>
- <small>FelFlame::Entities</small>
- </div>
- </li>
-
-
- <li class="even ">
- <div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#id-instance_method" title="FelFlame::ComponentManager#id (method)">#id</a></span>
+ <span class='object_link'><a href="FelFlame/ComponentManager.html#entity-instance_method" title="FelFlame::ComponentManager#entity (method)">#entity</a></span>
<small>FelFlame::ComponentManager</small>
</div>
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#initialize-instance_method" title="FelFlame::Scenes#initialize (method)">#initialize</a></span>
<small>FelFlame::Scenes</small>
@@ -308,7 +236,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Entities.html#initialize-instance_method" title="FelFlame::Entities#initialize (method)">#initialize</a></span>
<small>FelFlame::Entities</small>
@@ -316,7 +244,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#initialize-instance_method" title="FelFlame::Systems#initialize (method)">#initialize</a></span>
<small>FelFlame::Systems</small>
@@ -324,7 +252,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#initialize-instance_method" title="FelFlame::ComponentManager#initialize (method)">#initialize</a></span>
<small>FelFlame::ComponentManager</small>
@@ -332,7 +260,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Components.html#new-class_method" title="FelFlame::Components.new (method)">new</a></span>
<small>FelFlame::Components</small>
@@ -340,6 +268,14 @@
</li>
+ <li class="odd ">
+ <div class="item">
+ <span class='object_link'><a href="FelFlame/Scenes.html#priority-instance_method" title="FelFlame::Scenes#priority (method)">#priority</a></span>
+ <small>FelFlame::Scenes</small>
+ </div>
+ </li>
+
+
<li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#priority-instance_method" title="FelFlame::Systems#priority (method)">#priority</a></span>
@@ -414,37 +350,45 @@
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Scenes.html#systems-instance_method" title="FelFlame::Scenes#systems (method)">#systems</a></span>
- <small>FelFlame::Scenes</small>
+ <span class='object_link'><a href="FelFlame/Systems.html#scenes-instance_method" title="FelFlame::Systems#scenes (method)">#scenes</a></span>
+ <small>FelFlame::Systems</small>
</div>
</li>
<li class="even ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Entities.html#to_i-instance_method" title="FelFlame::Entities#to_i (method)">#to_i</a></span>
- <small>FelFlame::Entities</small>
+ <span class='object_link'><a href="FelFlame/Order.html#sort-class_method" title="FelFlame::Order.sort (method)">sort</a></span>
+ <small>FelFlame::Order</small>
</div>
</li>
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#to_i-instance_method" title="FelFlame::ComponentManager#to_i (method)">#to_i</a></span>
- <small>FelFlame::ComponentManager</small>
+ <span class='object_link'><a href="FelFlame/Scenes.html#systems-instance_method" title="FelFlame::Scenes#systems (method)">#systems</a></span>
+ <small>FelFlame::Scenes</small>
</div>
</li>
<li class="even ">
<div class="item">
+ <span class='object_link'><a href="FelFlame/ComponentManager.html#to_h-instance_method" title="FelFlame::ComponentManager#to_h (method)">#to_h</a></span>
+ <small>FelFlame::ComponentManager</small>
+ </div>
+ </li>
+
+
+ <li class="odd ">
+ <div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#trigger_when_added-instance_method" title="FelFlame::Systems#trigger_when_added (method)">#trigger_when_added</a></span>
<small>FelFlame::Systems</small>
</div>
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#trigger_when_is_changed-instance_method" title="FelFlame::Systems#trigger_when_is_changed (method)">#trigger_when_is_changed</a></span>
<small>FelFlame::Systems</small>
@@ -452,7 +396,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#trigger_when_removed-instance_method" title="FelFlame::Systems#trigger_when_removed (method)">#trigger_when_removed</a></span>
<small>FelFlame::Systems</small>
@@ -460,7 +404,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#update_attrs-instance_method" title="FelFlame::ComponentManager#update_attrs (method)">#update_attrs</a></span>
<small>FelFlame::ComponentManager</small>
diff --git a/docs/top-level-namespace.html b/docs/top-level-namespace.html
index 38ed71e..cc16af8 100644
--- a/docs/top-level-namespace.html
+++ b/docs/top-level-namespace.html
@@ -82,12 +82,10 @@
<p class="children">
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Felflame_.html" title="Felflame (module)">Felflame</a></span>
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span>, <span class='object_link'><a href="Felflame_.html" title="Felflame (module)">Felflame</a></span>
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span>
-
</p>
@@ -103,7 +101,7 @@
<div class="docstring">
<div class="discussion">
-<p>An alias for <span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></p>
+<p>An alias for <span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></p>
</div>
@@ -113,7 +111,7 @@
</div>
</dt>
- <dd><pre class="code"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span></pre></dd>
+ <dd><pre class="code"><span class='const'><span class='object_link'><a href="FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span></pre></dd>
</dl>
@@ -129,7 +127,7 @@
</div>
<div id="footer">
- Generated on Mon Jul 12 18:28:27 2021 by
+ Generated on Mon Jan 3 08:23:04 2022 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/felflame.gemspec b/felflame.gemspec
index a0f8c7b..6f26e6f 100644
--- a/felflame.gemspec
+++ b/felflame.gemspec
@@ -1,44 +1,44 @@
# frozen_string_literal: true
-require_relative "lib/felflame/version"
+require_relative 'lib/felflame/version'
Gem::Specification.new do |spec|
- spec.name = "felflame"
+ spec.name = 'felflame'
spec.version = Felflame::VERSION
- spec.authors = ["Tradam"]
- spec.email = ["[email protected]"]
+ spec.authors = ['Tradam']
+ spec.email = ['[email protected]']
- spec.summary = "The Engine Agnostic ECS Ruby Framework"
- #spec.description = "TODO: Write a longer description or delete this line."
- spec.homepage = "https://felflame.tradam.fyi"
- spec.license = "MIT"
- spec.required_ruby_version = ">= 2.4.0"
+ spec.summary = 'The Engine Agnostic ECS Ruby Framework'
+ # spec.description = "TODO: Write a longer description or delete this line."
+ spec.homepage = 'https://felflame.tradam.fyi'
+ spec.license = 'MIT'
+ spec.required_ruby_version = '>= 2.4.0'
- #spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
- spec.metadata["homepage_uri"] = spec.homepage
- spec.metadata["source_code_uri"] = "https://github.com/realtradam/FelFlame"
- #spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
+ spec.metadata['homepage_uri'] = spec.homepage
+ spec.metadata['source_code_uri'] = 'https://github.com/realtradam/FelFlame'
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|deprecated|codeclimate|logos)/}) }
end
- spec.bindir = "exe"
+ spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
- spec.require_paths = ["lib"]
+ spec.require_paths = ['lib']
# Uncomment to register a new dependency of your gem
# spec.add_dependency "example-gem", "~> 1.0"
- spec.add_development_dependency 'minitest-reporters', '~> 1.4', '>= 1.4.3'#, require: false
+ spec.add_development_dependency 'minitest-reporters', '~> 1.4', '>= 1.4.3' # , require: false
+ spec.add_development_dependency 'redcarpet', '~> 3.5', '>= 3.5.1' # , require: false
spec.add_development_dependency 'rspec', '~> 3.10'
- spec.add_development_dependency 'simplecov', '~> 0.21.2'#, require: false
- spec.add_development_dependency 'simplecov-console', '~> 0.9.1'
- spec.add_development_dependency 'simplecov_json_formatter', '~> 0.1.3'#, require: false
- spec.add_development_dependency 'redcarpet', '~> 3.5', '>= 3.5.1'#, require: false
- spec.add_development_dependency 'yard', '~> 0.9.26'#, require: false
spec.add_development_dependency 'rubocop', '~> 1.7'
+ spec.add_development_dependency 'simplecov', '~> 0.21.2' # , require: false
+ spec.add_development_dependency 'simplecov-console', '~> 0.9.1'
+ spec.add_development_dependency 'simplecov_json_formatter', '~> 0.1.3' # , require: false
+ spec.add_development_dependency 'yard', '~> 0.9.26' # , require: false
# For more information and examples about making a new gem, checkout our
# guide at: https://bundler.io/guides/creating_gem.html
diff --git a/lib/felflame.rb b/lib/felflame.rb
index cf58990..21a6eaf 100644
--- a/lib/felflame.rb
+++ b/lib/felflame.rb
@@ -1,14 +1,17 @@
+# frozen_string_literal: true
+
require_relative 'felflame/entity_manager'
require_relative 'felflame/component_manager'
require_relative 'felflame/system_manager'
require_relative 'felflame/scene_manager'
require_relative 'felflame/stage_manager'
+require_relative 'felflame/order'
-require_relative "felflame/version"
+require_relative 'felflame/version'
# The FelFlame namespace where all its functionality resides under.
-class FelFlame
- class <<self
+module FelFlame
+ class << self
# :nocov:
# An alias for {FelFlame::Stage.call}. It executes a single frame in the game.
@@ -18,26 +21,28 @@ class FelFlame
# :nocov:
end
- # Creates and manages Entities. Allows accessing Entities using their {FelFlame::Entities#id ID}. Entities are just collections of Components.
+ # Creates and manages Entities. Entities are just collections of Components.
+ # You can use array methods directly on this class to access Entities.
class Entities; end
- # Creates component managers and allows accessing them them under the {FelFlame::Components} namespace as Constants
+ # Creates component managers and allows accessing them them under the {FelFlame::Components} namespace as Constants.
+ # You can use array methods directly on this class to access Component Managers.
#
# To see how component managers are used please look at the {FelFlame::ComponentManager} documentation.
- class Components; end
+ module Components; end
- # Creates an manages Systems. Systems are the logic of the game and do not contain any data within them.
- #
- # TODO: Improve Systems overview
+ # Creates and manages Systems. Systems are the logic of the game and do not contain any data within them. Any systems you create are accessable under the {FelFlame::Systems} namespace as Constants.
+ # You can use array methods directly on this class to access Systems.
class Systems; end
- # Creates and manages Scenes. Scenes are collections of Systems, and execute all the Systems when called upon.
- #
- # TODO: Improve Scenes overview
+ # Creates and manages Scenes. Scenes are collections of Systems, and execute all the Systems when called upon. Any scenes you create are accessable under the {FelFlame::Scenes} namespace as Constants.
class Scenes; end
- # Stores Scenes which you want to execute on each frame. When called upon will execute all Systems in the Scenes in the Stage and will execute them according to their priority order.
- class Stage; end
+ # Stores Scenes you add to it which you want to execute on each frame. When called upon will execute all Systems in the Scenes in the Stage and will execute them according to their priority order.
+ module Stage; end
+
+ # Sets the priority of a list of Systems or Scenes for you in the order you pass them to this class.
+ module Order; end
end
# An alias for {FelFlame}
@@ -57,3 +62,6 @@ FF::Scn = FelFlame::Scenes
# An alias for {FelFlame::Stage}
FF::Stg = FelFlame::Stage
+
+# An alias for {FelFlame::
+FF::Odr = FelFlame::Order
diff --git a/lib/felflame/component_manager.rb b/lib/felflame/component_manager.rb
index 43932d2..6ac7463 100644
--- a/lib/felflame/component_manager.rb
+++ b/lib/felflame/component_manager.rb
@@ -1,8 +1,9 @@
-class FelFlame
- class Components
+# frozen_string_literal: true
+
+module FelFlame
+ module Components
@component_map = []
- class <<self
- include Enumerable
+ class << self
# Creates a new {FelFlame::ComponentManager component manager}.
#
# @example
@@ -21,13 +22,14 @@ class FelFlame
raise(NameError.new, "Component Manager '#{component_name}' is already defined")
end
-
const_set(component_name, Class.new(FelFlame::ComponentManager) {})
+ update_const_cache
attrs.each do |attr|
- if FelFlame::Components.const_get(component_name).method_defined?("#{attr}") || FelFlame::Components.const_get(component_name).method_defined?("#{attr}=")
- raise NameError.new "The attribute name \"#{attr}\" is already a method"
+ if FelFlame::Components.const_get(component_name).method_defined?(attr.to_s) || FelFlame::Components.const_get(component_name).method_defined?("#{attr}=")
+ raise NameError, "The attribute name \"#{attr}\" is already a method"
end
+
FelFlame::Components.const_get(component_name).attr_accessor attr
end
attrs_with_defaults.each do |attr, _default|
@@ -46,28 +48,54 @@ class FelFlame
FelFlame::Components.const_get(component_name)
end
- # Iterate over all existing component managers. You also call other enumerable methods instead of each, such as +each_with_index+ or +select+
- # @return [Enumerator]
- def each(&block)
- constants.each(&block)
+ # Stores the components managers in {FelFlame::Components}. This
+ # is needed because calling `FelFlame::Components.constants`
+ # will not let you iterate over the value of the constants
+ # but will instead give you an array of symbols. This caches
+ # the convertion of those symbols to the actual value of the
+ # constants
+ # @!visibility private
+ def const_cache
+ @const_cache || update_const_cache
+ end
+
+ # Updates the array that stores the constants.
+ # Used internally by FelFlame
+ # @!visibility private
+ def update_const_cache
+ @const_cache = constants.map do |constant|
+ const_get constant
+ end
+ end
+
+ # Forwards undefined methods to the array of constants
+ # if the array can handle the request. Otherwise tells
+ # the programmer their code errored
+ # @!visibility private
+ def respond_to_missing?(method, *)
+ if const_cache.respond_to? method
+ true
+ else
+ super
+ end
+ end
+
+ # Makes component module behave like arrays with additional
+ # methods for managing the array
+ # @!visibility private
+ def method_missing(method, *args, **kwargs, &block)
+ if const_cache.respond_to? method
+ const_cache.send(method, *args, **kwargs, &block)
+ else
+ super
+ end
end
end
end
# Component Managers are what is used to create individual components which can be attached to entities.
- # When a Component is created from a Component Manager that has accessors given to it, you can set or get the values of those accessors using standard ruby message sending (e.g [email protected] = 5+), or by using the {#attrs} and {#update_attrs} methods instead.
+ # When a Component is created from a Component Manager that has accessors given to it, you can set or get the values of those accessors using standard ruby message sending (e.g [email protected] = 5+), or by using the {#to_h} and {#update_attrs} methods instead.
class ComponentManager
-
- # Holds the {id unique ID} of a component. The {id ID} is only unique within the scope of the component manager it was created from.
- # @return [Integer]
- attr_reader :id
-
- # A seperate attr_writer was made for documentation readability reasons.
- # Yard will list attr_reader is readonly which is my intention.
- # This value needs to be changable as it is set by other functions.
- # @!visibility private
- attr_writer :id
-
# Allows overwriting the storage of triggers, such as for clearing.
# This method should generally only need to be used internally and
# not by a game developer.
@@ -104,24 +132,40 @@ class FelFlame
def initialize(**attrs)
# Prepare the object
# (this is a function created with metaprogramming
- # in FelFlame::Components
+ # in FelFlame::Components)
set_defaults
- # Generate ID
- new_id = self.class.data.find_index { |i| i.nil? }
- new_id = self.class.data.size if new_id.nil?
- @id = new_id
-
# Fill params
attrs.each do |key, value|
send "#{key}=", value
end
# Save Component
- self.class.data[new_id] = self
+ self.class.push self
end
- class <<self
+ class << self
+ # Makes component managers behave like arrays with additional
+ # methods for managing the array
+ # @!visibility private
+ def respond_to_missing?(method, *)
+ if _data.respond_to? method
+ true
+ else
+ super
+ end
+ end
+
+ # Makes component managers behave like arrays with additional
+ # methods for managing the array
+ # @!visibility private
+ def method_missing(method, *args, **kwargs, &block)
+ if _data.respond_to? method
+ _data.send(method, *args, **kwargs, &block)
+ else
+ super
+ end
+ end
# Allows overwriting the storage of triggers, such as for clearing.
# This method should generally only need to be used internally and
@@ -155,41 +199,28 @@ class FelFlame
# @return [Array<Component>] Array of all Components that belong to a given component manager
# @!visibility private
- def data
+ def _data
@data ||= []
end
-
- # Gets a Component from the given {id unique ID}. Usage is simular to how an Array lookup works.
- #
- # @example
- # # this gets the 'Health' Component with ID 7
- # FelFlame::Components::Health[7]
- # @param component_id [Integer]
- # @return [Component] Returns the Component that uses the given unique {id ID}, nil if there is no Component associated with the given {id ID}
- def [](component_id)
- data[component_id]
- end
-
- # Iterates over all components within the component manager.
- # Special Enumerable methods like +map+ or +each_with_index+ are not implemented
- # @return [Enumerator]
- def each(&block)
- data.compact.each(&block)
- end
- end
-
- # An alias for the {id ID Reader}
- # @return [Integer]
- def to_i
- id
end
- # A list of entity ids that are linked to the component
- # @return [Array<Integer>]
+ # Entities that have this component
+ # @return [Array<Component>]
def entities
@entities ||= []
end
+ # A single entity. Use this if you expect the component to only belong to one entity and you want to access it.
+ # @return [Component]
+ def entity
+ if entities.empty?
+ Warning.warn("This component belongs to NO entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.")
+ elsif entities.length > 1
+ Warning.warn("This component belongs to MANY entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.")
+ end
+ entities.first
+ end
+
# Update attribute values using a hash or keywords.
# @return [Hash<Symbol, Value>] Hash of updated attributes
def update_attrs(**opts)
@@ -200,39 +231,35 @@ class FelFlame
# Execute systems that have been added to execute on variable change
# @return [Boolean] +true+
+ # @!visibility private
def attr_changed_trigger_systems(attr)
systems_to_execute = self.class.attr_triggers[attr]
systems_to_execute = [] if systems_to_execute.nil?
systems_to_execute |= attr_triggers[attr] unless attr_triggers[attr].nil?
- systems_to_execute.sort_by(&:priority).reverse.each(&:call)
+ systems_to_execute.sort_by(&:priority).reverse_each(&:call)
true
end
- # Removes this component from the list and purges all references to this Component from other Entities, as well as its {id ID} and data.
+ # Removes this component from the list and purges all references to this Component from other Entities, as well as its data.
# @return [Boolean] +true+.
def delete
addition_triggers.each do |system|
system.clear_triggers component_or_manager: self
end
- # This needs to be cloned because indices get deleted as
- # the remove command is called, breaking the loop if it
- # wasn't referencing a clone(will get Nil errors)
- iter = entities.map(&:clone)
- iter.each do |entity|
- #FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil?
+ entities.reverse_each do |entity|
entity.remove self
end
- self.class.data[id] = nil
+ self.class._data.delete self
instance_variables.each do |var|
instance_variable_set(var, nil)
end
true
end
- # @return [Hash<Symbol, Value>] A hash, where all the keys are attributes linked to their respective values.
- def attrs
+ # @return [Hash<Symbol, Value>] A hash, where all the keys are attributes storing their respective values.
+ def to_h
return_hash = instance_variables.each_with_object({}) do |key, final|
final[key.to_s.delete_prefix('@').to_sym] = instance_variable_get(key)
end
@@ -243,8 +270,8 @@ class FelFlame
# Export all data into a JSON String, which could then later be loaded or saved to a file
# TODO: This function is not yet complete
# @return [String] a JSON formatted String
- #def to_json
+ # def to_json
# # should return a json or hash of all data in this component
- #end
+ # end
end
end
diff --git a/lib/felflame/entity_manager.rb b/lib/felflame/entity_manager.rb
index a05ef93..ef70510 100644
--- a/lib/felflame/entity_manager.rb
+++ b/lib/felflame/entity_manager.rb
@@ -1,53 +1,53 @@
-class FelFlame
- class Entities
- # Holds the unique ID of this entity
- # @return [Integer]
- attr_reader :id
-
- # A seperate attr_writer was made for documentation readability reasons.
- # Yard will list attr_reader is readonly which is my intention.
- # This value needs to be changable as it is set by other functions.
- # @!visibility private
- attr_writer :id
+# frozen_string_literal: true
+module FelFlame
+ class Entities
# Creating a new Entity
# @param components [Components] Can be any number of components, identical duplicates will be automatically purged however different components from the same component manager are allowed.
# @return [Entity]
def initialize(*components)
- # Assign new unique ID
- new_id = self.class.data.find_index(&:nil?)
- new_id = self.class.data.size if new_id.nil?
- self.id = new_id
-
# Add each component
add(*components)
-
- self.class.data[id] = self
+ self.class._data.push self
end
- # A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the {FelFlame::ComponentManager#id IDs} of the components attached to this entity.
+ # A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the the components attached to this entity.
# @return [Hash<Component_Manager, Array<Integer>>]
def components
@components ||= {}
end
- # An alias for the {#id ID reader}
- # @return [Integer]
- def to_i
- id
+ # A single component from a component manager. Use this if you expect the component to only belong to one entity and you want to access it. Access the component using either parameter notation or array notation. Array notation is conventional for better readablility.
+ # @example
+ # @entity.component[@component_manager] # array notation(the standard)
+ # @entity.component(@component_manager) # method notation
+ # @param manager [ComponentManager] If you pass nil you can then use array notation to access the same value.
+ # @return [Component]
+ def component(manager = nil)
+ if manager.nil?
+ FelFlame::Entities.component_redirect.entity = self
+ FelFlame::Entities.component_redirect
+ else
+ if components[manager].nil?
+ raise "This entity(#{self}) doesnt have any components of this type: #{manager}"
+ elsif components[manager].length > 1
+ Warning.warn("This entity has MANY of this component but you called the method that is intended for having a single of this component type.\nYou may have a bug in your logic.")
+ end
+
+ components[manager].first
+ end
end
- # Removes this Entity from the list and purges all references to this Entity from other Components, as well as its {id ID} and data.
+ # Removes this Entity from the list and purges all references to this Entity from other Components, as well as its data.
# @return [Boolean] +true+
def delete
- components.each do |component_manager, component_array|
- component_array.each do |component|
+ components.each do |_component_manager, component_array|
+ component_array.reverse_each do |component|
component.entities.delete(self)
end
end
- FelFlame::Entities.data[id] = nil
+ FelFlame::Entities._data.delete self
@components = {}
- @id = nil
true
end
@@ -89,6 +89,7 @@ class FelFlame
check_systems component, :removal_triggers if component.entities.include? self
component.entities.delete self
components[component.class].delete component
+ components.delete component.class if components[component.class].empty?
end
true
end
@@ -96,39 +97,64 @@ class FelFlame
# Export all data into a JSON String which can then be saved into a file
# TODO: This function is not yet complete
# @return [String] A JSON formatted String
- #def to_json() end
+ # def to_json() end
- class <<self
- include Enumerable
- # @return [Array<Entity>] Array of all Entities that exist
+ class << self
+ # Makes component managers behave like arrays with additional
+ # methods for managing the array
# @!visibility private
- def data
- @data ||= []
+ def respond_to_missing?(method, *)
+ if _data.respond_to? method
+ true
+ else
+ super
+ end
+ end
+
+ # Makes component managers behave like arrays with additional
+ # methods for managing the array
+ # @!visibility private
+ def method_missing(method, *args, **kwargs, &block)
+ if _data.respond_to? method
+ _data.send(method, *args, **kwargs, &block)
+ else
+ super
+ end
end
- # Gets an Entity from the given {id unique ID}. Usage is simular to how an Array lookup works
- #
- # @example
- # # This gets the Entity with ID 7
- # FelFlame::Entities[7]
- # @param entity_id [Integer]
- # @return [Entity] returns the Entity that uses the given unique ID, nil if there is no Entity associated with the given ID
- def [](entity_id)
- data[entity_id]
+ # Fancy method redirection for when the `component` method is called
+ # in an Entity
+ # WARNING: This method will not correctly work with multithreading
+ # @!visibility private
+ def component_redirect
+ if @component_redirect
+ else
+ @component_redirect = Object.new
+ @component_redirect.instance_variable_set(:@entity, nil)
+ @component_redirect.define_singleton_method(:entity) do
+ instance_variable_get(:@entity)
+ end
+ @component_redirect.define_singleton_method(:entity=) do |value|
+ instance_variable_set(:@entity, value)
+ end
+ @component_redirect.define_singleton_method(:[]) do |component_manager|
+ entity.component(component_manager)
+ end
+ end
+ @component_redirect
end
- # Iterates over all entities. The data is compacted so that means index does not correlate to ID.
- # You also call other enumerable methods instead of each, such as +each_with_index+ or +select+
- # @return [Enumerator]
- def each(&block)
- data.compact.each(&block)
+ # @return [Array<Entity>] Array of all Entities that exist
+ # @!visibility private
+ def _data
+ @data ||= []
end
# Creates a new entity using the data from a JSON string
# TODO: This function is not yet complete
# @param json_string [String] A string that was exported originally using the {FelFlame::Entities#to_json to_json} function
# @param opts [Keywords] What values(its {FelFlame::Entities#id ID} or the {FelFlame::ComponentManager#id component IDs}) should be overwritten TODO: this might change
- #def from_json(json_string, **opts) end
+ # def from_json(json_string, **opts) end
end
end
end
diff --git a/lib/felflame/order.rb b/lib/felflame/order.rb
new file mode 100644
index 0000000..c11438d
--- /dev/null
+++ b/lib/felflame/order.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module FelFlame
+ module Order
+ # Sets the priority of all items passed into this method
+ # according to the order they were passed.
+ # If an array is one of the elements then it will give all
+ # of those elements in the array the same priority.
+ # @param sortables [(Systems and Array<Systems>) or (Scenes and Array<Scenes>)]
+ # @return [Boolean] +true+.
+ def self.sort(*sortables)
+ sortables.each_with_index do |sorted, index|
+ if sorted.respond_to? :priority
+ sorted.priority = index
+ else
+ sorted.each do |item|
+ item.priority = index
+ end
+ end
+ end
+ true
+ end
+ end
+end
diff --git a/lib/felflame/scene_manager.rb b/lib/felflame/scene_manager.rb
index 315dd55..0024815 100644
--- a/lib/felflame/scene_manager.rb
+++ b/lib/felflame/scene_manager.rb
@@ -1,19 +1,27 @@
-class FelFlame
- class Scenes
- # The Constant name assigned to this Scene
- attr_reader :const_name
+# frozen_string_literal: true
+module FelFlame
+ class Scenes
# Allows overwriting the storage of systems, such as for clearing.
# This method should generally only need to be used internally and
# not by a game developer/
# @!visibility private
attr_writer :systems
+ # How early this Scene should be executed in a list of Scenes
+ attr_accessor :priority
+
+ def priority=(priority)
+ @priority = priority
+ FelFlame::Stage.scenes = FelFlame::Stage.scenes.sort_by(&:priority)
+ priority
+ end
+
# Create a new Scene using the name given
# @param name [String] String format must follow requirements of a constant
- def initialize(name)
+ def initialize(name, priority: 0)
+ self.priority = priority
FelFlame::Scenes.const_set(name, self)
- @const_name = name
end
# The list of Systems this Scene contains
@@ -33,25 +41,28 @@ class FelFlame
# @return [Boolean] +true+
def add(*systems_to_add)
self.systems |= systems_to_add
- systems.sort_by!(&:priority)
- FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
+ self.systems = systems.sort_by(&:priority)
+ systems_to_add.each do |system|
+ system.scenes |= [self]
+ end
true
end
- # Removes any number of SystemS from this Scene
+ # Removes any number of Systems from this Scene
# @return [Boolean] +true+
def remove(*systems_to_remove)
self.systems -= systems_to_remove
- systems.sort_by!(&:priority)
- FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
true
end
# Removes all Systems from this Scene
# @return [Boolean] +true+
def clear
+ systems.each do |system|
+ system.scenes.delete self
+ end
systems.clear
- FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
+ # FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
true
end
end
diff --git a/lib/felflame/stage_manager.rb b/lib/felflame/stage_manager.rb
index 87ee955..a192b67 100644
--- a/lib/felflame/stage_manager.rb
+++ b/lib/felflame/stage_manager.rb
@@ -1,19 +1,18 @@
-class FelFlame
- class Stage
- class <<self
+# frozen_string_literal: true
+
+module FelFlame
+ module Stage
+ class << self
# Allows clearing of scenes and systems.
# Used internally by FelFlame and shouldn't need to be ever used by developers
# @!visibility private
- attr_writer :scenes, :systems
+ attr_writer :scenes
# Add any number of Scenes to the Stage
# @return [Boolean] +true+
def add(*scenes_to_add)
self.scenes |= scenes_to_add
- scenes_to_add.each do |scene|
- self.systems |= scene.systems
- end
- systems.sort_by!(&:priority)
+ self.scenes = scenes.sort_by(&:priority)
true
end
@@ -21,35 +20,20 @@ class FelFlame
# @return [Boolean] +true+
def remove(*scenes_to_remove)
self.scenes -= scenes_to_remove
- update_systems_list
- true
- end
-
- # Updates the list of systems from the Scenes added to the Stage and make sure they are ordered correctly
- # This is used internally by FelFlame and shouldn't need to be ever used by developers
- # @return [Boolean] +true+
- # @!visibility private
- def update_systems_list
- systems.clear
- scenes.each do |scene|
- self.systems |= scene.systems
- end
- systems.sort_by!(&:priority)
true
end
# Clears all Scenes that were added to the Stage
# @return [Boolean] +true+
def clear
- systems.clear
- scenes.clear
+ self.scenes.clear
true
end
- # Executes one frame of the game. This executes all the Systems in the Scenes added to the Stage. Systems that exist in two or more different Scenes will still only get executed once.
+ # Executes one frame of the game. This executes all the Scenes added to the Stage in order of their priority.
# @return [Boolean] +true+
def call
- systems.each(&:call)
+ self.scenes.each(&:call)
true
end
@@ -58,13 +42,6 @@ class FelFlame
def scenes
@scenes ||= []
end
-
- # Stores systems in the order the stage manager needs to call them
- # This method should generally only need to be used internally and not by a game developer
- # @!visibility private
- def systems
- @systems ||= []
- end
end
end
end
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 <<self
- include Enumerable
+ class << self
+ # Stores the systems in {FelFlame::Components}. This
+ # is needed because calling `FelFlame::Components.constants`
+ # will not let you iterate over the value of the constants
+ # but will instead give you an array of symbols. This caches
+ # the convertion of those symbols to the actual value of the
+ # constants
+ def const_cache
+ @const_cache || update_const_cache
+ end
- # Iterate over all Systems, sorted by their priority. You also call other enumerable methods instead of each, such as +each_with_index+ or +select+
- # @return [Enumerator]
- def each(&block)
- constants.map { |sym| const_get(sym) }.sort_by(&:priority).reverse.each(&block)
+ # Updates the array that stores the constants.
+ # Used internally by FelFlame
+ # @!visibility private
+ def update_const_cache
+ @const_cache = constants.map do |constant|
+ const_get constant
+ end
+ end
+
+ # Forwards undefined methods to the array of constants
+ # if the array can handle the request. Otherwise tells
+ # the programmer their code errored
+ # @!visibility private
+ def respond_to_missing?(method, *)
+ if const_cache.respond_to? method
+ true
+ else
+ super
+ end
+ end
+
+ # Makes system module behave like arrays with additional
+ # methods for managing the array
+ # @!visibility private
+ def method_missing(method, *args, **kwargs, &block)
+ if const_cache.respond_to? method
+ const_cache.send(method, *args, **kwargs, &block)
+ else
+ super
+ end
end
end
@@ -70,15 +114,17 @@ class FelFlame
# @param block [Proc] The code you wish to be executed when the system is triggered. Can be defined by using a +do end+ block or using +{ }+ braces.
def initialize(name, priority: 0, &block)
FelFlame::Systems.const_set(name, self)
- @const_name = name
+ FelFlame::Systems.update_const_cache
@priority = priority
@block = block
+ @scenes = []
end
# Manually execute the system a single time
def call
@block.call
end
+
# Redefine what code is executed by this System when it is called upon.
# @param block [Proc] The code you wish to be executed when the system is triggered. Can be defined by using a +do end+ block or using +{ }+ braces.
def redefine(&block)
@@ -109,16 +155,16 @@ class FelFlame
# @param component_or_manager [Component or ComponentManager] The object to clear triggers from. Use Nil to clear triggers from all components associated with this system.
# @return [Boolean] +true+
def clear_triggers(*trigger_types, component_or_manager: nil)
- trigger_types = [:addition_triggers, :removal_triggers, :attr_triggers] if trigger_types.empty?
+ trigger_types = %i[addition_triggers removal_triggers attr_triggers] if trigger_types.empty?
if trigger_types.include? :attr_triggers
- if (trigger_types - [:addition_triggers,
- :removal_triggers,
- :attr_triggers]).empty?
+ if (trigger_types - %i[addition_triggers
+ removal_triggers
+ attr_triggers]).empty?
if component_or_manager.nil?
- #remove all attrs
- self.attr_triggers.each do |cmp_or_mgr, attrs|
+ # remove all attrs
+ attr_triggers.each do |cmp_or_mgr, attrs|
attrs.each do |attr|
next if cmp_or_mgr.attr_triggers[attr].nil?
@@ -127,49 +173,48 @@ class FelFlame
self.attr_triggers = {}
end
else
- #remove attrs relevant to comp_or_man
- unless self.attr_triggers[component_or_manager].nil?
- self.attr_triggers[component_or_manager].each do |attr|
+ # remove attrs relevant to comp_or_man
+ unless attr_triggers[component_or_manager].nil?
+ attr_triggers[component_or_manager].each do |attr|
component_or_manager.attr_triggers[attr].delete self
end
- self.attr_triggers[component_or_manager] = []
+ attr_triggers[component_or_manager] = []
end
end
- else
+ elsif component_or_manager.nil?
- if component_or_manager.nil?
- (trigger_types - [:addition_triggers, :removal_triggers, :attr_triggers]).each do |attr|
- #remove attr
- self.attr_triggers.each do |cmp_or_mgr, attrs|
- cmp_or_mgr.attr_triggers[attr].delete self
- end
- end
- self.attr_triggers.delete (trigger_types - [:addition_triggers,
- :removal_triggers,
- :attr_triggers])
- else
- #remove attr from component_or_manager
- (trigger_types - [:addition_triggers, :removal_triggers, :attr_triggers]).each do |attr|
- next if component_or_manager.attr_triggers[attr].nil?
- component_or_manager.attr_triggers[attr].delete self
+ (trigger_types - %i[addition_triggers removal_triggers attr_triggers]).each do |attr|
+ # remove attr
+ attr_triggers.each do |cmp_or_mgr, _attrs|
+ cmp_or_mgr.attr_triggers[attr].delete self
end
- self.attr_triggers[component_or_manager] -= trigger_types unless self.attr_triggers[component_or_manager].nil?
end
+ attr_triggers.delete(trigger_types - %i[addition_triggers
+ removal_triggers
+ attr_triggers])
+ else
+ # remove attr from component_or_manager
+ (trigger_types - %i[addition_triggers removal_triggers attr_triggers]).each do |attr|
+ next if component_or_manager.attr_triggers[attr].nil?
+
+ component_or_manager.attr_triggers[attr].delete self
+ end
+ attr_triggers[component_or_manager] -= trigger_types unless attr_triggers[component_or_manager].nil?
end
end
- (trigger_types & [:removal_triggers, :addition_triggers] - [:attr_triggers]).each do |trigger_type|
+ (trigger_types & %i[removal_triggers addition_triggers] - [:attr_triggers]).each do |trigger_type|
if component_or_manager.nil?
- #remove all removal triggers
- self.send(trigger_type).each do |trigger|
+ # remove all removal triggers
+ send(trigger_type).each do |trigger|
trigger.send(trigger_type).delete self
end
- self.send("#{trigger_type.to_s}=", [])
+ send("#{trigger_type}=", [])
else
- #remove removal trigger relevant to comp/man
- self.send(trigger_type).delete component_or_manager
+ # remove removal trigger relevant to comp/man
+ send(trigger_type).delete component_or_manager
component_or_manager.send(trigger_type).delete self
end
end
@@ -202,10 +247,10 @@ class FelFlame
else
component_or_manager.attr_triggers[attr] |= [self]
end
- if self.attr_triggers[component_or_manager].nil?
- self.attr_triggers[component_or_manager] = [attr]
+ if attr_triggers[component_or_manager].nil?
+ attr_triggers[component_or_manager] = [attr]
else
- self.attr_triggers[component_or_manager] |= [attr]
+ attr_triggers[component_or_manager] |= [attr]
end
true
end
diff --git a/lib/felflame/version.rb b/lib/felflame/version.rb
index 882774f..9f7f09e 100644
--- a/lib/felflame/version.rb
+++ b/lib/felflame/version.rb
@@ -4,6 +4,6 @@
# Keeps the version of the Gem
module Felflame
# The version of the Gem
- VERSION = "3.0.0"
+ VERSION = '4.0.0'
end
# :nocov:
diff --git a/spec/component_manager_spec.rb b/spec/component_manager_spec.rb
index d99d744..9bf9b9e 100644
--- a/spec/component_manager_spec.rb
+++ b/spec/component_manager_spec.rb
@@ -1,16 +1,19 @@
-require 'felflame'
+# frozen_string_literal: true
-describe 'Components' do
+require_relative '../lib/felflame'
- #let :component_manager do
+describe 'Components' do
+ # let :component_manager do
# @component_manager ||= FelFlame::Components.new('TestComponents', :param1, param2: 'def')
- #end
+ # end
before :all do
@component_manager ||= FelFlame::Components.new('TestComponents', :param1, param2: 'def')
end
before :each do
+ @orig_stderr = $stderr
+ $stderr = StringIO.new
@ent0 = FelFlame::Entities.new
@ent1 = FelFlame::Entities.new
@ent2 = FelFlame::Entities.new
@@ -20,36 +23,81 @@ describe 'Components' do
end
after :each do
- FelFlame::Entities.each(&:delete)
- @component_manager.each(&:delete)
+ $stderr = @orig_stderr
+ FelFlame::Entities.reverse_each(&:delete)
+ @component_manager.reverse_each(&:delete)
+ end
+
+ it 'can get a single entity' do
+ @cmp0.entity
+ $stderr.rewind
+ $stderr.string.chomp.should eq("This component belongs to NO entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.")
+ @ent0.add @cmp0
+ expect(@cmp0.entity).to eq(@ent0)
+ @ent1.add @cmp0
+ @cmp0.entity
+ $stderr.rewind
+ $stderr.string.chomp.should eq("This component belongs to MANY entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.")
+ end
+
+ it 'responds to array methods' do
+ expect(@component_manager.respond_to?(:[])).to be true
+ expect(@component_manager.respond_to?(:each)).to be true
+ @component_manager.each do |component|
+ expect(component.respond_to?(:param1)).to be true
+ end
+ expect(@component_manager.respond_to?(:filter)).to be true
+ expect(@component_manager.respond_to?(:first)).to be true
+ expect(@component_manager.respond_to?(:last)).to be true
+ expect(@component_manager.respond_to?(:somethingwrong)).to be false
+ end
+
+ it 'dont respond to missing methods' do
+ expect { @component_manager.somethingwrong }.to raise_error(NoMethodError)
+ end
+
+ it 'Component module responds to array methods' do
+ expect(FelFlame::Components.respond_to?(:[])).to be true
+ expect(FelFlame::Components.respond_to?(:each)).to be true
+ FelFlame::Components.each do |component_manager|
+ expect(component_manager.respond_to?(:addition_triggers)).to be true
+ end
+ expect(FelFlame::Components.respond_to?(:filter)).to be true
+ expect(FelFlame::Components.respond_to?(:first)).to be true
+ expect(FelFlame::Components.respond_to?(:last)).to be true
+ expect(FelFlame::Components.respond_to?(:somethingwrong)).to be false
+ end
+
+ it 'Component module doesnt respond to missing methods' do
+ expect { FelFlame::Components.somethingwrong }.to raise_error(NoMethodError)
end
it 'can delete a component' do
- component_id = @cmp1.id
+ # component_id = @cmp1.id
@ent0.add @cmp1
-
+ length = @component_manager.length
expect(@cmp1.delete).to be true
- expect(@cmp1.id).to be_nil
- expect(@component_manager[component_id]).to be_nil
+ expect(@component_manager.length).to eq(length - 1)
+ # expect(@cmp1.id).to be_nil
+ # expect(@component_manager[component_id]).to be_nil
expect(@cmp1.entities).to eq([])
end
- it 'can iterate over all component managers' do
- all_components = FelFlame::Components.constants
+ it 'can iterate component managers' do
+ all_components_symbols = FelFlame::Components.constants
+ all_components = all_components_symbols.map do |symbol|
+ FelFlame::Components.const_get symbol
+ end
+ expect(all_components).to eq(FF::Components.each.to_a)
expect(all_components.length).to be > 0
expect(FelFlame::Components.each).to be_an Enumerator
- FelFlame::Components.each do |component_manager|
- all_components.delete component_manager.to_s.to_sym
- end
- expect(all_components).to eq([])
end
it 'can change params on initialization' do
@cmp3 = @component_manager.new(param1: 'ok', param2: 10)
- expect(@cmp3.attrs).to eq(param1: 'ok', param2: 10, id: @cmp3.id)
+ expect(@cmp3.to_h).to eq(param1: 'ok', param2: 10)
end
-
it 'sets default params correctly' do
expect(@cmp0.param1).to be_nil
expect(@cmp0.param2).to eq('def')
@@ -59,28 +107,26 @@ describe 'Components' do
expect(@cmp2.param2).to eq('def')
end
- it 'can read attrs' do
- expect(@cmp0.attrs).to eq(param2: 'def', id: 0)
- expect(@cmp1.attrs).to eq(param2: 'def', id: 1)
- expect(@cmp2.attrs).to eq(param2: 'def', id: 2)
+ it 'can read attributes' do
+ expect(@cmp0.to_h).to eq(param2: 'def')
+ expect(@cmp1.to_h).to eq(param2: 'def')
+ expect(@cmp2.to_h).to eq(param2: 'def')
end
it 'can set attrs' do
expect(@cmp0.param1 = 4).to eq(4)
expect(@cmp1.update_attrs(param1: 3, param2: 'new')).to eq(param1: 3, param2: 'new')
- expect(@cmp1.attrs).to eq(param1: 3, param2: 'new', id: 1)
+ expect(@cmp1.to_h).to eq(param1: 3, param2: 'new')
end
- it 'can be accessed' do
- expect(@cmp0).to eq(@component_manager[0])
- expect(@cmp1).to eq(@component_manager[1])
- expect(@cmp2).to eq(@component_manager[2])
+ it 'can be used as a singleton' do
+ expect(@component_manager.first).to eq(@cmp0)
end
- it 'can get id from to_i' do
- expect(@cmp0.id).to eq(@cmp0.to_i)
- expect(@cmp1.id).to eq(@cmp1.to_i)
- expect(@cmp2.id).to eq(@cmp2.to_i)
+ it 'can be accessed' do
+ expect(@component_manager[0].respond_to?(:param1)).to eq(true)
+ expect(@component_manager[1].respond_to?(:param1)).to eq(true)
+ expect(@component_manager[2].respond_to?(:param1)).to eq(true)
end
it 'cant overwrite exiting component managers' do
@@ -89,7 +135,7 @@ describe 'Components' do
end
it 'can\'t create an attribute when its name is an existing method' do
- expect { FelFlame::Components.new('TestComponent2', :id) }.to raise_error(NameError)
+ # expect { FelFlame::Components.new('TestComponent2', :id) }.to raise_error(NameError)
expect { FelFlame::Components.new('TestComponent2', :addition_triggers) }.to raise_error(NameError)
expect { FelFlame::Components.new('TestComponent2', :removal_triggers) }.to raise_error(NameError)
expect { FelFlame::Components.new('TestComponent2', :attr_triggers) }.to raise_error(NameError)
diff --git a/spec/entity_manager_spec.rb b/spec/entity_manager_spec.rb
index ef638c0..2068986 100644
--- a/spec/entity_manager_spec.rb
+++ b/spec/entity_manager_spec.rb
@@ -1,19 +1,18 @@
-require 'felflame'
+# frozen_string_literal: true
-#class EntitiesTest < Minitest::Test
+require_relative '../lib/felflame'
-describe 'Entities' do
-
- #let :component_manager do
- # @component_manager ||= FelFlame::Components.new('Test', :param1, param2: 'def')
- #end
+# class EntitiesTest < Minitest::Test
+describe 'Entities' do
before :all do
+ $VERBOSE = nil
@component_manager ||= FelFlame::Components.new('TestEntity', :param1, param2: 'def')
end
-
before :each do
+ @orig_stderr = $stderr
+ $stderr = StringIO.new
@ent0 = FelFlame::Entities.new
@ent1 = FelFlame::Entities.new
@ent2 = FelFlame::Entities.new
@@ -23,8 +22,40 @@ describe 'Entities' do
end
after :each do
- FelFlame::Entities.each(&:delete)
- @component_manager.each(&:delete)
+ $stderr = @orig_stderr
+ FelFlame::Entities.reverse_each(&:delete)
+ @component_manager.reverse_each(&:delete)
+ end
+
+ it 'can get a single component' do
+ expect { @ent0.component[@component_manager] }.to raise_error(RuntimeError)
+ @ent0.add @cmp0
+ expect(@ent0.component[@component_manager]).to eq(@cmp0)
+ expect(@ent0.component[@component_manager]).to eq(@ent0.component(@component_manager))
+ @ent0.add @cmp1
+ @ent0.component[@component_manager]
+ $stderr.rewind
+ $stderr.string.chomp.should eq("This entity has MANY of this component but you called the method that is intended for having a single of this component type.\nYou may have a bug in your logic.")
+ @ent0.components[@component_manager].reverse_each do |component|
+ @ent0.remove component
+ end
+ expect { @ent0.component[@component_manager] }.to raise_error(RuntimeError)
+ end
+
+ it 'responds to array methods' do
+ expect(FelFlame::Entities.respond_to?(:[])).to be true
+ expect(FelFlame::Entities.respond_to?(:each)).to be true
+ FelFlame::Entities.each do |entity|
+ expect(entity.respond_to?(:components)).to be true
+ end
+ expect(FelFlame::Entities.respond_to?(:filter)).to be true
+ expect(FelFlame::Entities.respond_to?(:first)).to be true
+ expect(FelFlame::Entities.respond_to?(:last)).to be true
+ expect(FelFlame::Entities.respond_to?(:somethingwrong)).to be false
+ end
+
+ it 'dont respond to missing methods' do
+ expect { FelFlame::Entities.somethingwrong }.to raise_error(NoMethodError)
end
it 'won\'t add duplicate entities' do
@@ -32,21 +63,15 @@ describe 'Entities' do
expect(@ent0.components[@component_manager].count).to eq(2)
end
- it 'has correct ID\'s' do
- expect(@ent0.id).to eq(0)
- expect(@ent1.id).to eq(1)
- expect(@ent2.id).to eq(2)
- end
-
it 'can be accessed' do
- expect(@ent0).to eq(FelFlame::Entities[0])
- expect(@ent1).to eq(FelFlame::Entities[1])
- expect(@ent2).to eq(FelFlame::Entities[2])
+ expect(FelFlame::Entities[0].respond_to?(:components)).to eq(true)
+ expect(FelFlame::Entities[1].respond_to?(:components)).to eq(true)
+ expect(FelFlame::Entities[2].respond_to?(:components)).to eq(true)
end
it 'can have components attached' do
@ent0.add @cmp0
- expect(@ent0.components[@component_manager][0]).to eq(@cmp0)
+ expect(@ent0.component[@component_manager]).to eq(@cmp0)
@ent1.add @cmp1, @cmp2
expect(@ent1.components[@component_manager].length).to eq(2)
@@ -54,38 +79,36 @@ describe 'Entities' do
expect(@ent1.components[@component_manager].include?(@cmp2)).to be true
end
- it 'can get id from to_i' do
- expect(@ent0.id).to eq(@ent0.to_i)
- expect(@ent1.id).to eq(@ent1.to_i)
- expect(@ent2.id).to eq(@ent2.to_i)
- end
-
it 'can have components removed' do
@ent0.add @cmp0
- expect(@ent0.remove @cmp0).to be true
+ expect(@ent0.remove(@cmp0)).to be true
expect(@cmp0.entities.empty?).to be true
- expect(@ent0.components[@component_manager].empty?).to be true
+ expect(@ent0.components[@component_manager].nil?).to be true
+ @ent0.add @cmp0
+ @cmp0.delete
+ expect(@ent0.components[@component_manager].nil?).to be true
end
it 'can have many components added then removed' do
@ent0.add @cmp0, @cmp1, @cmp2
@ent1.add @cmp0, @cmp1
@ent2.add @cmp1, @cmp2
- expect(@ent0.components).to eq({@component_manager => [@cmp0,@cmp1,@cmp2]})
- expect(@cmp0.entities).to eq([@ent0,@ent1])
- expect(@cmp1.entities).to eq([@ent0,@ent1,@ent2])
- expect(@cmp2.entities).to eq([@ent0,@ent2])
+ expect(@ent0.components).to eq({ @component_manager => [@cmp0, @cmp1, @cmp2] })
+ expect(@cmp0.entities).to eq([@ent0, @ent1])
+ expect(@cmp1.entities).to eq([@ent0, @ent1, @ent2])
+ expect(@cmp2.entities).to eq([@ent0, @ent2])
@ent1.delete
expect(@cmp0.entities).to eq([@ent0])
- expect(@cmp1.entities).to eq([@ent0,@ent2])
- expect(@cmp2.entities).to eq([@ent0,@ent2])
+ expect(@cmp1.entities).to eq([@ent0, @ent2])
+ expect(@cmp2.entities).to eq([@ent0, @ent2])
@cmp1.delete
- expect(@ent0.components).to eq({@component_manager => [@cmp0,@cmp2]})
- @component_manager.each(&:delete)
- expect(@component_manager.each.to_a).to eq([])
- expect(@ent0.components).to eq({@component_manager => []})
- expect(@ent2.components).to eq({@component_manager => []})
- FelFlame::Entities.each(&:delete)
- expect(FelFlame::Entities.each.to_a).to eq([])
+ expect(@ent0.components).to eq({ @component_manager => [@cmp0, @cmp2] })
+ @component_manager.reverse_each(&:delete)
+ expect(@component_manager.length).to eq(0)
+ expect(@component_manager.empty?).to be true
+ expect(@ent0.components).to eq({})
+ expect(@ent2.components).to eq({})
+ FelFlame::Entities.reverse_each(&:delete)
+ expect(FelFlame::Entities.empty?).to be true
end
end
diff --git a/spec/order_spec.rb b/spec/order_spec.rb
new file mode 100644
index 0000000..fd104fc
--- /dev/null
+++ b/spec/order_spec.rb
@@ -0,0 +1,71 @@
+# frozen_string_literal: true
+
+require_relative '../lib/felflame'
+
+# class EntitiesTest < Minitest::Test
+
+describe 'Order' do
+ before :all do
+ @result = []
+ @system0 = FelFlame::Systems.new('System1', priority: 0) do
+ @result.push 0
+ end
+ @system2 = FelFlame::Systems.new('System3', priority: 2) do
+ @result.push 2
+ end
+ @system1 = FelFlame::Systems.new('System2', priority: 1) do
+ @result.push 1
+ end
+
+ @scene1 = FelFlame::Scenes.new('Scene0', priority: 1)
+ @scene0 = FelFlame::Scenes.new('Scene0', priority: 0)
+ end
+
+ before :each do
+ end
+
+ after :each do
+ @result.clear
+ @scene0.clear
+ @scene1.clear
+ @system0.priority = 0
+ @system1.priority = 1
+ @system2.priority = 2
+ @scene0.priority = 0
+ @scene1.priority = 1
+ end
+
+ it 'can sort Scenes' do
+ @scene0.add @system0
+ @scene1.add @system1
+ FelFlame::Order.sort(
+ @scene1,
+ @scene0
+ )
+ expect(@scene1.priority < @scene0.priority).to eq(true)
+ end
+
+ it 'can sort Systems' do
+ @scene0.add @system0, @system1, @system2
+ FelFlame::Order.sort(
+ @system2,
+ @system0,
+ @system1
+ )
+ @scene0.call
+ expect(@result).to eq([2, 0, 1])
+ end
+
+ it 'can handle array' do
+ FelFlame::Order.sort(
+ @system0,
+ [
+ @system1,
+ @system2
+ ]
+ )
+ expect(@system0.priority < @system1.priority).to eq(true)
+ expect(@system0.priority < @system2.priority).to eq(true)
+ expect(@system1.priority == @system2.priority).to eq(true)
+ end
+end
diff --git a/spec/scene_manager_spec.rb b/spec/scene_manager_spec.rb
index f2aee01..e1984dc 100644
--- a/spec/scene_manager_spec.rb
+++ b/spec/scene_manager_spec.rb
@@ -1,6 +1,8 @@
-require 'felflame'
+# frozen_string_literal: true
-#class EntitiesTest < Minitest::Test
+require_relative '../lib/felflame'
+
+# class EntitiesTest < Minitest::Test
describe 'Scenes' do
before :all do
@@ -35,6 +37,9 @@ describe 'Scenes' do
it 'can add Systems' do
@scene.add @system2, @system3, @system1
+ expect(@system1.scenes.length).to eq(1)
+ expect(@system2.scenes.length).to eq(1)
+ expect(@system3.scenes.length).to eq(1)
expect(@scene.systems).to eq([@system1, @system2, @system3])
end
@@ -47,18 +52,23 @@ describe 'Scenes' do
it 'can clear Systems' do
@scene.add @system2, @system3, @system1
@scene.clear
+ expect(@system1.scenes.length).to eq(0)
+ expect(@system2.scenes.length).to eq(0)
+ expect(@system3.scenes.length).to eq(0)
expect(@scene.systems).to eq([])
end
- it 'has the correct constant name' do
- match = FelFlame::Scenes.new('Match')
- expect(FelFlame::Scenes::Match.const_name).to eq('Match')
- expect(match.const_name).to eq('Match')
- end
-
it 'can execute Systems in the correct order' do
@scene.add @system2, @system3, @system1
@scene.call
expect(@cmp.order).to eq([1, 2, 3])
+ @cmp.order = []
+ @system3.priority = -1
+ @scene.call
+ expect(@cmp.order).to eq([3, 1, 2])
+ end
+
+ it 'will return priority when setting priority' do
+ expect(@scene.priority = 3).to eq(3)
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 0d826a1..797ff0f 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -20,15 +22,15 @@ RSpec.configure do |config|
SimpleCov.start do
add_filter 'spec'
add_filter 'deprecated'
- add_group "Ignored Code" do |src_file|
+ add_group 'Ignored Code' do |src_file|
open(src_file.filename).grep(/:nocov:/).any?
end
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
- SimpleCov::Formatter::Console,
- SimpleCov::Formatter::HTMLFormatter,
- SimpleCov::Formatter::JSONFormatter
- #SimpleCovSmallBadge::Formatter
- ])
+ SimpleCov::Formatter::Console,
+ SimpleCov::Formatter::HTMLFormatter,
+ SimpleCov::Formatter::JSONFormatter
+ # SimpleCovSmallBadge::Formatter
+ ])
end
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
@@ -62,55 +64,53 @@ RSpec.configure do |config|
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
-=begin
- # This allows you to limit a spec run to individual examples or groups
- # you care about by tagging them with `:focus` metadata. When nothing
- # is tagged with `:focus`, all examples get run. RSpec also provides
- # aliases for `it`, `describe`, and `context` that include `:focus`
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
- config.filter_run_when_matching :focus
-
- # Allows RSpec to persist some state between runs in order to support
- # the `--only-failures` and `--next-failure` CLI options. We recommend
- # you configure your source control system to ignore this file.
- config.example_status_persistence_file_path = "spec/examples.txt"
-
- # Limits the available syntax to the non-monkey patched syntax that is
- # recommended. For more details, see:
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
- config.disable_monkey_patching!
-
- # This setting enables warnings. It's recommended, but in some cases may
- # be too noisy due to issues in dependencies.
- config.warnings = true
-
- # Many RSpec users commonly either run the entire suite or an individual
- # file, and it's useful to allow more verbose output when running an
- # individual spec file.
- if config.files_to_run.one?
- # Use the documentation formatter for detailed output,
- # unless a formatter has already been configured
- # (e.g. via a command-line flag).
- config.default_formatter = "doc"
- end
-
- # Print the 10 slowest examples and example groups at the
- # end of the spec run, to help surface which specs are running
- # particularly slow.
- config.profile_examples = 10
-
- # Run specs in random order to surface order dependencies. If you find an
- # order dependency and want to debug it, you can fix the order by providing
- # the seed, which is printed after each run.
- # --seed 1234
- config.order = :random
-
- # Seed global randomization in this process using the `--seed` CLI option.
- # Setting this allows you to use `--seed` to deterministically reproduce
- # test failures related to randomization by passing the same `--seed` value
- # as the one that triggered the failure.
- Kernel.srand config.seed
-=end
+ # # This allows you to limit a spec run to individual examples or groups
+ # # you care about by tagging them with `:focus` metadata. When nothing
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ # config.filter_run_when_matching :focus
+ #
+ # # Allows RSpec to persist some state between runs in order to support
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # # you configure your source control system to ignore this file.
+ # config.example_status_persistence_file_path = "spec/examples.txt"
+ #
+ # # Limits the available syntax to the non-monkey patched syntax that is
+ # # recommended. For more details, see:
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ # config.disable_monkey_patching!
+ #
+ # # This setting enables warnings. It's recommended, but in some cases may
+ # # be too noisy due to issues in dependencies.
+ # config.warnings = true
+ #
+ # # Many RSpec users commonly either run the entire suite or an individual
+ # # file, and it's useful to allow more verbose output when running an
+ # # individual spec file.
+ # if config.files_to_run.one?
+ # # Use the documentation formatter for detailed output,
+ # # unless a formatter has already been configured
+ # # (e.g. via a command-line flag).
+ # config.default_formatter = "doc"
+ # end
+ #
+ # # Print the 10 slowest examples and example groups at the
+ # # end of the spec run, to help surface which specs are running
+ # # particularly slow.
+ # config.profile_examples = 10
+ #
+ # # Run specs in random order to surface order dependencies. If you find an
+ # # order dependency and want to debug it, you can fix the order by providing
+ # # the seed, which is printed after each run.
+ # # --seed 1234
+ # config.order = :random
+ #
+ # # Seed global randomization in this process using the `--seed` CLI option.
+ # # Setting this allows you to use `--seed` to deterministically reproduce
+ # # test failures related to randomization by passing the same `--seed` value
+ # # as the one that triggered the failure.
+ # Kernel.srand config.seed
end
diff --git a/spec/stage_manager_spec.rb b/spec/stage_manager_spec.rb
index ed1125c..16f9080 100644
--- a/spec/stage_manager_spec.rb
+++ b/spec/stage_manager_spec.rb
@@ -1,40 +1,36 @@
-require 'felflame'
+# frozen_string_literal: true
-#class EntitiesTest < Minitest::Test
+require_relative '../lib/felflame'
+
+# class EntitiesTest < Minitest::Test
describe 'Stage' do
before :all do
- @component_manager ||= FelFlame::Components.new('TestStage', order: Array.new)
- @system2 = FelFlame::Systems.new('StageTest', priority: 50) do
- @component_manager.each do |component|
- component.order.push 2
- end
+ @component_manager ||= FelFlame::Components.new('TestStage', order: [])
+ @system2 = FelFlame::Systems.new('StageTest', priority: 1) do
+ @component_manager.first.order.push 2
end
- @system1 = FelFlame::Systems.new('StageMana', priority: 1) do
- @component_manager.each do |component|
- component.order.push 1
- end
+ @system1 = FelFlame::Systems.new('StageMana', priority: 3) do
+ @component_manager.first.order.push 1
end
- @system3 = FelFlame::Systems.new('StageSpell', priority: 100) do
- @component_manager.each do |component|
- component.order.push 3
- end
+ @system3 = FelFlame::Systems.new('StageSpell', priority: 2) do
+ @scene1.add @system1
+ @scene2.add @system2
+ @scene3.add @system3
+ @component_manager.first.order.push 3
end
- @scene1 = FelFlame::Scenes.new('TestStage1')
- @scene2 = FelFlame::Scenes.new('TestStage2')
- @scene3 = FelFlame::Scenes.new('TestStage3')
+ @scene1 = FelFlame::Scenes.new('TestStage1', priority: 1)
+ @scene2 = FelFlame::Scenes.new('TestStage2', priority: 2)
+ @scene3 = FelFlame::Scenes.new('TestStage3', priority: 3)
end
before :each do
@cmp = @component_manager.new
- @scene1.add @system1
- @scene2.add @system2
- @scene3.add @system3
end
after :each do
- FelFlame::Entities.each(&:delete)
- @component_manager.each(&:delete)
+ FelFlame::Entities.reverse_each(&:delete)
+ @component_manager.reverse_each(&:delete)
@scene1.clear
@scene2.clear
@scene3.clear
@@ -43,61 +39,27 @@ describe 'Stage' do
it 'can add Scenes' do
FelFlame::Stage.add @scene2, @scene1, @scene3
- expect(FelFlame::Stage.scenes).to eq([@scene2, @scene1, @scene3])
- expect(FelFlame::Stage.systems).to eq([@system1, @system2, @system3])
+ expect(FelFlame::Stage.scenes).to eq([@scene1, @scene2, @scene3])
end
it 'can remove Scenes' do
FelFlame::Stage.add @scene1, @scene2, @scene3
FelFlame::Stage.remove @scene1, @scene3
expect(FelFlame::Stage.scenes).to eq([@scene2])
- expect(FelFlame::Stage.systems).to eq([@system2])
end
it 'can clear Scenes' do
FelFlame::Stage.add @scene1, @scene2, @scene3
FelFlame::Stage.clear
expect(FelFlame::Stage.scenes).to eq([])
- expect(FelFlame::Stage.systems).to eq([])
end
- it 'can execute Systems in the correct order' do
+ it 'can call Scenes in correct order' do
FelFlame::Stage.add @scene2, @scene1, @scene3
+ @scene1.add @system1
+ @scene2.add @system2
+ @scene3.add @system3
FelFlame::Stage.call
- expect(@cmp.order).to eq([1, 2, 3])
- end
-
- it 'can add Systems to Scenes already added in Stage' do
- FelFlame::Stage.add @scene2, @scene1, @scene3
- system2p5 = FelFlame::Systems.new('StageAddingTest', priority: 75) do
- @component_manager.each do |component|
- component.order.push 2.5
- end
- end
- @scene2.add system2p5
- @scene3.add system2p5
- FelFlame::Stage.call
- expect(@cmp.order).to eq([1,2,2.5,3])
- end
-
- it 'can remove Systems to Scenes already added in Stage' do
- FelFlame::Stage.add @scene2, @scene1, @scene3
- system2p5 = FelFlame::Systems.new('StageAddingTest', priority: 75) do
- @component_manager.each do |component|
- component.order.push 2.5
- end
- end
- @scene2.add system2p5
- @scene3.add system2p5
- @scene2.remove @system2
- FelFlame::Stage.call
- expect(@cmp.order).to eq([1,2.5,3])
- end
-
- it 'can have Systems change priority in an existing Stage' do
- FelFlame::Stage.add @scene2, @scene1, @scene3
- @system2.priority = 0
- FelFlame::Stage.call
- expect(@cmp.order).to eq([2,1,3])
+ expect(@component_manager.first.order).to eq([1, 2, 3])
end
end
diff --git a/spec/system_manager_spec.rb b/spec/system_manager_spec.rb
index f9df439..b7177af 100644
--- a/spec/system_manager_spec.rb
+++ b/spec/system_manager_spec.rb
@@ -1,7 +1,8 @@
-require 'felflame'
+# frozen_string_literal: true
-describe 'Components' do
+require_relative '../lib/felflame'
+describe 'Systems' do
before :all do
@component_manager ||= FelFlame::Components.new('TestSystems', health: 10, whatever: 'imp', mana: 10)
@@testitr = 999
@@ -23,10 +24,11 @@ describe 'Components' do
end
it 'can create a system' do
- FelFlame::Systems.new('Test99') do
+ @@testitr += 1
+ sys = FelFlame::Systems.new("Test#{@@testitr}") do
'Works'
end
- expect(FelFlame::Systems::Test99.call).to eq('Works')
+ expect(sys.call).to eq('Works')
end
it 'can be redefined' do
@@ -36,26 +38,27 @@ describe 'Components' do
expect(@system.call).to eq('very neat')
end
- it 'can iterate over the sorted systems by priority' do
- FelFlame::Systems.new('Test2', priority: 1) {}
- FelFlame::Systems.new('Test3', priority: 50) {}
- FelFlame::Systems.new('Test4', priority: 7) {}
- answer_key = ['Test3', 'Test4', 'Test2']
- test = FelFlame::Systems.each.to_a
- # converts the system name to the constant, compares their positions making sure they are sorted
- # higher priority should be placed first
- expect(test.map(&:const_name).find_index(answer_key[0])).to be <= test.map(&:const_name).find_index(answer_key[1])
- expect(test.map(&:const_name).find_index(answer_key[0])).to be <= test.map(&:const_name).find_index(answer_key[2])
- expect(test.map(&:const_name).find_index(answer_key[1])).to be >= test.map(&:const_name).find_index(answer_key[0])
- expect(test.map(&:const_name).find_index(answer_key[1])).to be <= test.map(&:const_name).find_index(answer_key[2])
- expect(test.map(&:const_name).find_index(answer_key[2])).to be >= test.map(&:const_name).find_index(answer_key[0])
- expect(test.map(&:const_name).find_index(answer_key[2])).to be >= test.map(&:const_name).find_index(answer_key[1])
+ it 'responds to array methods' do
+ expect(FelFlame::Systems.respond_to?(:[])).to be true
+ expect(FelFlame::Systems.respond_to?(:each)).to be true
+ FelFlame::Systems.each do |system|
+ expect(system.respond_to?(:call)).to be true
+ end
+ expect(FelFlame::Systems.respond_to?(:filter)).to be true
+ expect(FelFlame::Systems.respond_to?(:first)).to be true
+ expect(FelFlame::Systems.respond_to?(:last)).to be true
+ expect(FelFlame::Systems.respond_to?(:somethingwrong)).to be false
+ end
+
+ it 'dont respond to missing methods' do
+ expect { FelFlame::Systems.somethingwrong }.to raise_error(NoMethodError)
end
it 'can manipulate components' do
init1 = 27
init2 = 130
multiple = 3
+ iter = 10
first = @component_manager.new(health: init1)
second = @component_manager.new(health: init2)
@system.redefine do
@@ -66,11 +69,21 @@ describe 'Components' do
@system.call
expect(first.health).to eq(init1 -= multiple)
expect(second.health).to eq(init2 -= multiple)
- 10.times do
+ iter.times do
@system.call
end
- expect(first.health).to eq(init1 - (multiple * 10))
- expect(second.health).to eq(init2 - (multiple * 10))
+ expect(first.health).to eq(init1 - (multiple * iter))
+ expect(second.health).to eq(init2 - (multiple * iter))
+ end
+
+ it 'can clear triggers from components and systems' do
+ @cmp0 = @component_manager.new
+ @system.trigger_when_added @cmp0
+ expect(@cmp0.addition_triggers.length).to eq(1)
+ expect(@system.addition_triggers.length).to eq(1)
+ expect(@cmp0.delete).to be true
+ expect(@cmp0.addition_triggers.length).to eq(0)
+ expect(@system.addition_triggers.length).to eq(0)
end
it 'can trigger when a single Component is added' do
@@ -219,11 +232,11 @@ describe 'Components' do
@entity1 = FelFlame::Entities.new
@system.trigger_when_is_changed @cmp0, :whatever
@system.trigger_when_is_changed @cmp0, :mana
- #expect(@system.attr_triggers).to eq({@cmp0 => [:name, :mana]})
- #expect(@cmp0.attr_triggers).to eq({:name => [@system], :mana => [@system]})
+ # expect(@system.attr_triggers).to eq({@cmp0 => [:name, :mana]})
+ # expect(@cmp0.attr_triggers).to eq({:name => [@system], :mana => [@system]})
@system.clear_triggers :attr_triggers, :whatever, component_or_manager: @cmp0
- #expect(@system.attr_triggers).to eq({@cmp0 => [:mana]})
- #expect(@cmp0.attr_triggers).to eq({:name => [], :mana => [@system]})
+ # expect(@system.attr_triggers).to eq({@cmp0 => [:mana]})
+ # expect(@cmp0.attr_triggers).to eq({:name => [], :mana => [@system]})
expect(@cmp0.health).to eq(10)
expect(@cmp1.health).to eq(20)
@cmp0.whatever = 'something'
@@ -326,7 +339,7 @@ describe 'Components' do
expect(@cmp0.health).to eq(10)
expect(@cmp1.health).to eq(20)
end
-
+
it 'can clear addition_trigger, with component' do
@cmp0 = @component_manager.new health: 10
@cmp1 = @component_manager.new health: 20
@@ -369,7 +382,7 @@ describe 'Components' do
expect(@cmp0.health).to eq(10)
expect(@cmp1.health).to eq(20)
end
-
+
it 'can clear removal_trigger, with component' do
@cmp0 = @component_manager.new health: 10
@cmp1 = @component_manager.new health: 20