From 3104eaf4ca0515572aeedc114cb6095a07825d90 Mon Sep 17 00:00:00 2001 From: _Tradam Date: Thu, 30 Dec 2021 07:33:27 -0500 Subject: Revert "Major 4.0 update (#12)" This reverts commit 5ef652300e71b572ca58b061610d606840ce19a9. --- docs/FelFlame/ComponentManager.html | 569 +++++++++++++++++++++++++++--------- docs/FelFlame/Components.html | 136 +++++++-- docs/FelFlame/Entities.html | 528 ++++++++++++++++++++++++--------- docs/FelFlame/Scenes.html | 22 +- docs/FelFlame/Stage.html | 28 +- docs/FelFlame/Systems.html | 24 +- 6 files changed, 981 insertions(+), 326 deletions(-) (limited to 'docs/FelFlame') diff --git a/docs/FelFlame/ComponentManager.html b/docs/FelFlame/ComponentManager.html index 599b547..1da6816 100644 --- a/docs/FelFlame/ComponentManager.html +++ b/docs/FelFlame/ComponentManager.html @@ -37,7 +37,7 @@ + +
+

+ + #idInteger + + + + + +

+
+ +

Holds the unique ID of a component. The ID is only unique within the scope of the component manager it was created from.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+63
+64
+65
+
+
# File 'lib/felflame/component_manager.rb', line 63
+
+def id
+  @id
+end
+
+
+ +

@@ -899,12 +1051,12 @@
 
 
-94
-95
-96
+89 +90 +91 -
# File 'lib/felflame/component_manager.rb', line 94
+      
# File 'lib/felflame/component_manager.rb', line 89
 
 def removal_triggers
   @removal_triggers ||= []
@@ -917,6 +1069,149 @@
   

+
+

Class Method Details

+ + +
+

+ + .[](component_id) ⇒ Component + + + + + +

+
+ +

Gets a Component from the given unique ID. Usage is simular to how an Array lookup works.

+ + +
+
+
+ +
+

Examples:

+ + +
# this gets the 'Health' Component with ID 7
+FelFlame::Components::Health[7]
+ +
+

Parameters:

+
    + +
  • + + component_id + + + (Integer) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Component) + + + + — +
    +

    Returns the Component that uses the given unique ID, nil if there is no Component associated with the given ID

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+169
+170
+171
+
+
# File 'lib/felflame/component_manager.rb', line 169
+
+def [](component_id)
+  data[component_id]
+end
+
+
+ +
+

+ + .each(&block) ⇒ Enumerator + + + + + +

+
+ +

Iterates over all components within the component manager. Special Enumerable methods like map or each_with_index are not implemented

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Enumerator) + + + +
  • + +
+ +
+ + + + +
+
+
+
+176
+177
+178
+
+
# File 'lib/felflame/component_manager.rb', line 176
+
+def each(&block)
+  data.compact.each(&block)
+end
+
+
+ +
+

Instance Method Details

@@ -965,18 +1260,18 @@
 
 
-213
-214
-215
-216
-217
-218
-219
-220
-221
+203 +204 +205 +206 +207 +208 +209 +210 +211 -
# File 'lib/felflame/component_manager.rb', line 213
+      
# File 'lib/felflame/component_manager.rb', line 203
 
 def attr_changed_trigger_systems(attr)
   systems_to_execute = self.class.attr_triggers[attr]
@@ -984,7 +1279,7 @@
 
   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
@@ -993,9 +1288,9 @@
-

+

- #deleteBoolean + #attrsHash<Symbol, Value> @@ -1004,7 +1299,7 @@

-

Removes this component from the list and purges all references to this Component from other Entities, as well as its data.

+

Returns A hash, where all the keys are attributes linked to their respective values.

@@ -1017,13 +1312,13 @@
  • - (Boolean) + (Hash<Symbol, Value>)
    -

    true.

    +

    A hash, where all the keys are attributes linked to their respective values.

  • @@ -1036,35 +1331,23 @@
     
     
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
     235
    -236
    +236 +237 +238 +239 +240 +241 -
    # File 'lib/felflame/component_manager.rb', line 224
    +      
    # File 'lib/felflame/component_manager.rb', line 235
     
    -def delete
    -  addition_triggers.each do |system|
    -    system.clear_triggers component_or_manager: self
    -  end
    -  entities.reverse_each do |entity|
    -    entity.remove self
    -  end
    -  self.class._data.delete self
    -  instance_variables.each do |var|
    -    instance_variable_set(var, nil)
    +def attrs
    +  return_hash = instance_variables.each_with_object({}) do |key, final|
    +    final[key.to_s.delete_prefix('@').to_sym] = instance_variable_get(key)
       end
    -  true
    +  return_hash.delete(:attr_triggers)
    +  return_hash
     end
    @@ -1072,9 +1355,9 @@
    -

    +

    - #entitiesArray<Component> + #deleteBoolean @@ -1083,7 +1366,7 @@

    -

    Entities that have this component

    +

    Removes this component from the list and purges all references to this Component from other Entities, as well as its ID and data.

    @@ -1096,10 +1379,15 @@
  • - (Array<Component>) + (Boolean) + — +
    +

    true.

    +
    +
  • @@ -1110,15 +1398,45 @@
     
     
    -188
    -189
    -190
    +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 -
    # File 'lib/felflame/component_manager.rb', line 188
    +      
    # File 'lib/felflame/component_manager.rb', line 215
     
    -def entities
    -  @entities ||= []
    +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?
    +    entity.remove self
    +  end
    +  self.class.data[id] = nil
    +  instance_variables.each do |var|
    +    instance_variable_set(var, nil)
    +  end
    +  true
     end
    @@ -1126,9 +1444,9 @@
    -

    +

    - #entityComponent + #entitiesArray<Integer> @@ -1137,7 +1455,7 @@

    -

    A single entity. Use this if you expect the component to only belong to one entity and you want to access it.

    +

    A list of entity ids that are linked to the component

    @@ -1150,7 +1468,7 @@
  • - (Component) + (Array<Integer>) @@ -1164,25 +1482,15 @@
     
     
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    +189 +190 +191 -
    # File 'lib/felflame/component_manager.rb', line 194
    +      
    # File 'lib/felflame/component_manager.rb', line 189
     
    -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
    +def entities
    +  @entities ||= []
     end
    @@ -1190,9 +1498,9 @@
  • -

    +

    - #to_hHash<Symbol, Value> + #to_iInteger @@ -1201,7 +1509,7 @@

    -

    Returns A hash, where all the keys are attributes linked to their respective values.

    +

    An alias for the ID Reader

    @@ -1214,14 +1522,9 @@
  • - (Hash<Symbol, Value>) - + (Integer) - — -
    -

    A hash, where all the keys are attributes linked to their respective values.

    -
  • @@ -1233,23 +1536,15 @@
     
     
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    +183 +184 +185 -
    # File 'lib/felflame/component_manager.rb', line 239
    +      
    # File 'lib/felflame/component_manager.rb', line 183
     
    -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
    -  return_hash.delete(:attr_triggers)
    -  return_hash
    +def to_i
    +  id
     end
    @@ -1300,14 +1595,14 @@
     
     
    -205
    -206
    -207
    -208
    -209
    +195 +196 +197 +198 +199
    -
    # File 'lib/felflame/component_manager.rb', line 205
    +      
    # File 'lib/felflame/component_manager.rb', line 195
     
     def update_attrs(**opts)
       opts.each do |key, value|
    @@ -1324,7 +1619,7 @@
     
    diff --git a/docs/FelFlame/Components.html b/docs/FelFlame/Components.html index e3b6167..a44ec31 100644 --- a/docs/FelFlame/Components.html +++ b/docs/FelFlame/Components.html @@ -4,7 +4,7 @@ - Module: FelFlame::Components + Class: FelFlame::Components — Documentation by YARD 0.9.26 @@ -37,7 +37,7 @@ <div id="menu"> <a href="../_index.html">Index (C)</a> » - <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span> + <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span> » <span class="title">Components</span> @@ -59,16 +59,37 @@ <div class="clear"></div> </div> - <div id="content"><h1>Module: FelFlame::Components + <div id="content"><h1>Class: 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> + @@ -88,7 +109,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 (module)">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 (class)">Components</a></span> namespace as Constants</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> @@ -116,6 +137,30 @@ <li class="public "> <span class="summary_signature"> + <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&block) ⇒ 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) ⇒ ComponentManager </a> @@ -141,13 +186,68 @@ + <div id="class_method_details" class="method_details_list"> <h2>Class Method Details</h2> <div class="method_details first"> - <h3 class="signature first" id="new-class_method"> + <h3 class="signature first" id="each-class_method"> + + .<strong>each</strong>(&block) ⇒ <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'>&</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'>&</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"> .<strong>new</strong>(component_name, *attrs, **attrs_with_defaults) ⇒ <tt><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></tt> @@ -173,7 +273,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 (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'>'</span><span class='tstring_content'>Health</span><span class='tstring_end'>'</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'>'</span><span class='tstring_content'>red</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre> +</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'>'</span><span class='tstring_content'>Health</span><span class='tstring_end'>'</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'>'</span><span class='tstring_content'>red</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre> </div> <p class="tag_title">Parameters:</p> @@ -249,7 +349,6 @@ <pre class="lines"> -18 19 20 21 @@ -277,39 +376,40 @@ 43 44 45 -46</pre> +46 +47</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 18</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 19</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 (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='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='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'>"</span><span class='tstring_content'>Component Manager '</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'>' is already defined</span><span class='tstring_end'>"</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 (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_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_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 (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'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></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'>"</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'>"</span></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_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'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</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'>"</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'>"</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'>"</span><span class='tstring_content'>The attribute name \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" is already a method</span><span class='tstring_end'>"</span></span> <span class='kw'>end</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='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='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 (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'>"</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'>"</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 (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'>"</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'>"</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'>"</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'>"</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 (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='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='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'>"</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'>"</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 (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='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='kw'>end</span></pre> </td> </tr> @@ -321,7 +421,7 @@ </div> <div id="footer"> - Generated on Thu Dec 30 07:28:05 2021 by + Generated on Mon Jul 12 18:28:27 2021 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 aca4cac..9d10529 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> » - <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span> + <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span> » <span class="title">Entities</span> @@ -85,6 +85,11 @@ + <dl> + <dt>Extended by:</dt> + <dd>Enumerable</dd> + </dl> + @@ -104,7 +109,7 @@ <h2>Overview</h2><div class="docstring"> <div class="discussion"> -<p>Creates and manages Entities. Allows iterating or accessing Entities using array methods directly on the class. Entities are just collections of Components.</p> +<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> </div> @@ -116,12 +121,46 @@ + <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> ⇒ 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> - Instance Method Summary + Class Method Summary <small><a href="#" class="summary_toggle">collapse</a></small> </h2> @@ -130,7 +169,7 @@ <li class="public "> <span class="summary_signature"> - <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) ⇒ Boolean </a> + <a href="#[]-class_method" title="[] (class method)">.<strong>[]</strong>(entity_id) ⇒ Entity </a> @@ -145,16 +184,49 @@ <span class="summary_desc"><div class='inline'> -<p>Add any number components to the Entity.</p> +<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>(&block) ⇒ Enumerator </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'> +<p>Iterates over all entities.</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="#component-instance_method" title="#component (instance method)">#<strong>component</strong>(manager = nil) ⇒ Component </a> + <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) ⇒ Boolean </a> @@ -169,7 +241,7 @@ <span class="summary_desc"><div class='inline'> -<p>A single component from a component manager.</p> +<p>Add any number components to the Entity.</p> </div></span> </li> @@ -193,7 +265,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 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 <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> </div></span> </li> @@ -217,7 +289,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 data.</p> +<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> </div></span> </li> @@ -270,13 +342,38 @@ <p>Remove a component from the Entity.</p> </div></span> +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#to_i-instance_method" title="#to_i (instance method)">#<strong>to_i</strong> ⇒ 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"> @@ -305,7 +402,7 @@ <span class='name'>components</span> - <span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (module)">Components</a></span></tt>)</span> + <span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (class)">Components</a></span></tt>)</span> @@ -325,35 +422,31 @@ <pre class="lines"> -7 -8 -9 -10 -11 -12 -13 -14 -15 16 17 18 -19</pre> +19 +20 +21 +22 +23 +24 +25 +26</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 7</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_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'>&</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='comment'># Fancy method redirection for when the `component` method is called -</span> <span class='ivar'>@component_redirect</span> <span class='op'>=</span> <span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> - <span class='ivar'>@component_redirect</span><span class='period'>.</span><span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='symbol'>:@entity</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> - <span class='ivar'>@component_redirect</span><span class='period'>.</span><span class='id identifier rubyid_define_singleton_method'>define_singleton_method</span><span class='lparen'>(</span><span class='symbol'>:[]</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component_manager'>component_manager</span><span class='op'>|</span> - <span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='symbol'>:@entity</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_component'>component</span><span class='lparen'>(</span><span class='id identifier rubyid_component_manager'>component_manager</span><span class='rparen'>)</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_push'>push</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='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'>end</span></pre> </td> </tr> @@ -362,15 +455,76 @@ </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> ⇒ <tt>Integer</tt> + - <div id="instance_method_details" class="method_details_list"> - <h2>Instance Method Details</h2> + + + +</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 class="method_details first"> - <h3 class="signature first" id="add-instance_method"> + <h3 class="signature first" id="[]-class_method"> - #<strong>add</strong>(*components_to_add) ⇒ <tt>Boolean</tt> + .<strong>[]</strong>(entity_id) ⇒ <tt>Entity</tt> @@ -379,28 +533,32 @@ </h3><div class="docstring"> <div class="discussion"> -<p>Add any number components to the Entity.</p> +<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> </div> </div> <div class="tags"> - <p class="tag_title">Parameters:</p> + + <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> <ul class="param"> <li> - <span class='name'>components_to_add</span> - + <span class='name'>entity_id</span> - <span class='type'>(<tt>Component</tt>)</span> + <span class='type'>(<tt>Integer</tt>)</span> - — - <div class='inline'> -<p>Any number of components created from any component manager</p> -</div> </li> @@ -412,13 +570,13 @@ <li> - <span class='type'>(<tt>Boolean</tt>)</span> + <span class='type'>(<tt>Entity</tt>)</span> — <div class='inline'> -<p><code>true</code></p> +<p>returns the Entity that uses the given unique ID, nil if there is no Entity associated with the given ID</p> </div> </li> @@ -431,37 +589,15 @@ <pre class="lines"> -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76</pre> +116 +117 +118</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 63</span> + <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 116</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'>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'>end</span></pre> </td> </tr> @@ -469,9 +605,9 @@ </div> <div class="method_details "> - <h3 class="signature " id="component-instance_method"> + <h3 class="signature " id="each-class_method"> - #<strong>component</strong>(manager = nil) ⇒ <tt>Component</tt> + .<strong>each</strong>(&block) ⇒ <tt>Enumerator</tt> @@ -480,38 +616,87 @@ </h3><div class="docstring"> <div class="discussion"> -<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.</p> +<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> </div> </div> <div class="tags"> - <div class="examples"> - <p class="tag_title">Examples:</p> - +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>Enumerator</tt>)</span> - <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 -</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> + + + </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'>&</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'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> </div> -<p class="tag_title">Parameters:</p> + + <div id="instance_method_details" class="method_details_list"> + <h2>Instance Method Details</h2> + + + <div class="method_details first"> + <h3 class="signature first" id="add-instance_method"> + + #<strong>add</strong>(*components_to_add) ⇒ <tt>Boolean</tt> + + + + + +</h3><div class="docstring"> + <div class="discussion"> + +<p>Add any number components to the Entity.</p> + + + </div> +</div> +<div class="tags"> + <p class="tag_title">Parameters:</p> <ul class="param"> <li> - <span class='name'>manager</span> - + <span class='name'>components_to_add</span> - <span class='type'>(<tt><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></tt>)</span> + <span class='type'>(<tt>Component</tt>)</span> - <em class="default">(defaults to: <tt>nil</tt>)</em> — <div class='inline'> -<p>If you pass nil you can then use array notation to access the same value.</p> +<p>Any number of components created from any component manager</p> </div> </li> @@ -524,10 +709,15 @@ <li> - <span class='type'>(<tt>Component</tt>)</span> + <span class='type'>(<tt>Boolean</tt>)</span> + — + <div class='inline'> +<p><code>true</code></p> +</div> + </li> </ul> @@ -538,33 +728,37 @@ <pre class="lines"> -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44</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 33</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='ivar'>@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'>"</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'>"</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'>></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'>"</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'>"</span></span><span class='rparen'>)</span> + <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> <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> @@ -583,7 +777,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 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 <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> </div> @@ -610,12 +804,12 @@ <pre class="lines"> -23 -24 -25</pre> +30 +31 +32</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 23</span> + <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 30</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> @@ -637,7 +831,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 data.</p> +<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> </div> @@ -669,28 +863,30 @@ <pre class="lines"> +42 +43 +44 +45 +46 +47 +48 49 50 51 -52 -53 -54 -55 -56 -57 -58</pre> +52</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 49</span> + <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 42</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_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_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_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 (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='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='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> @@ -762,35 +958,83 @@ <pre class="lines"> +87 +88 +89 +90 +91 +92 93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103</pre> +94</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 93</span> + <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 87</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_components_to_remove'>components_to_remove</span><span class='rparen'>)</span> <span class='id identifier rubyid_components_to_remove'>components_to_remove</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_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='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='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'>end</span> <span class='kw'>end</span> <span class='kw'>true</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> ⇒ <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> @@ -798,7 +1042,7 @@ </div> <div id="footer"> - Generated on Thu Dec 30 07:28:05 2021 by + Generated on Mon Jul 12 18:28:27 2021 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/Scenes.html b/docs/FelFlame/Scenes.html index 2c160fe..41e369e 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> » - <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span> + <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span> » <span class="title">Scenes</span> @@ -104,7 +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. 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> +<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> @@ -308,7 +308,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> @@ -375,7 +375,7 @@ <pre class="code"><span class="info file"># File 'lib/felflame/scene_manager.rb', line 14</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 (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='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'>end</span></pre> </td> @@ -550,8 +550,8 @@ <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='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'>&</span><span class='symbol'>:priority</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="Stage.html" title="FelFlame::Stage (module)">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 (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (module)">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='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'>&</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> @@ -675,7 +675,7 @@ <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='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="Stage.html" title="FelFlame::Stage (module)">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 (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (module)">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='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> @@ -695,7 +695,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> @@ -739,8 +739,8 @@ <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='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'>&</span><span class='symbol'>:priority</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="Stage.html" title="FelFlame::Stage (module)">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 (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Stage.html" title="FelFlame::Stage (module)">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='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'>&</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 +753,7 @@ </div> <div id="footer"> - Generated on Thu Dec 30 07:28:05 2021 by + Generated on Mon Jul 12 18:28:27 2021 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 b2e961b..65fe2f4 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> - Module: FelFlame::Stage + Class: FelFlame::Stage — Documentation by YARD 0.9.26 @@ -37,7 +37,7 @@ <div id="menu"> <a href="../_index.html">Index (S)</a> » - <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span> + <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span> » <span class="title">Stage</span> @@ -59,13 +59,29 @@ <div class="clear"></div> </div> - <div id="content"><h1>Module: FelFlame::Stage + <div id="content"><h1>Class: 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> + @@ -88,7 +104,7 @@ <h2>Overview</h2><div class="docstring"> <div class="discussion"> -<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> +<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> </div> @@ -372,7 +388,7 @@ <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='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'>&</span><span class='symbol'>:priority</span><span class='rparen'>)</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'>&</span><span class='symbol'>:priority</span><span class='rparen'>)</span> <span class='kw'>true</span> <span class='kw'>end</span></pre> </td> @@ -572,7 +588,7 @@ </div> <div id="footer"> - Generated on Thu Dec 30 07:28:05 2021 by + Generated on Mon Jul 12 18:28:27 2021 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 e549566..f0f8d56 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> » - <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span> + <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span> » <span class="title">Systems</span> @@ -109,7 +109,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. Any systems you create are accessable under the <span class='object_link'><a href="" title="FelFlame::Systems (class)">Systems</a></span> namespace as Constants.</p> +<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> @@ -515,8 +515,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 (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'>'</span><span class='tstring_content'>PassiveHeal</span><span class='tstring_end'>'</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> + <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'>'</span><span class='tstring_content'>PassiveHeal</span><span class='tstring_end'>'</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> <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> @@ -597,7 +597,7 @@ <pre class="code"><span class="info file"># File 'lib/felflame/system_manager.rb', line 71</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'>&</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 (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 (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='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> @@ -998,19 +998,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 (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><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='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 (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><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 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 (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><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='comment'># Clear a trigger from a specific component -</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><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 class='comment'># Clear a trigger from a specific component manager -</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><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='comment'># Clear the trigger that executes a system when the ':example_attr' is changes -</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> +</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> </div> <p class="tag_title">Parameters:</p> @@ -1531,7 +1531,7 @@ </div> <div id="footer"> - Generated on Thu Dec 30 07:28:05 2021 by + Generated on Mon Jul 12 18:28:27 2021 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.26 (ruby-2.7.3). </div> -- cgit v1.2.3