felflame 1.0.2 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,7 +37,7 @@
37
37
  <div id="menu">
38
38
 
39
39
  <a href="../_index.html">Index (E)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span>
40
+ <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
41
41
  &raquo;
42
42
  <span class="title">Entities</span>
43
43
 
@@ -85,11 +85,6 @@
85
85
 
86
86
 
87
87
 
88
- <dl>
89
- <dt>Extended by:</dt>
90
- <dd>Enumerable</dd>
91
- </dl>
92
-
93
88
 
94
89
 
95
90
 
@@ -99,8 +94,8 @@
99
94
 
100
95
  <dl>
101
96
  <dt>Defined in:</dt>
102
- <dd>felflame.rb<span class="defines">,<br />
103
- entity_manager.rb</span>
97
+ <dd>lib/felflame.rb<span class="defines">,<br />
98
+ lib/felflame/entity_manager.rb</span>
104
99
  </dd>
105
100
  </dl>
106
101
 
@@ -109,7 +104,7 @@
109
104
  <h2>Overview</h2><div class="docstring">
110
105
  <div class="discussion">
111
106
 
112
- <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>
107
+ <p>Creates and manages Entities. Entities are just collections of Components. You can use array methods directly on this class to access Entities.</p>
113
108
 
114
109
 
115
110
  </div>
@@ -121,46 +116,12 @@
121
116
 
122
117
 
123
118
 
124
- <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
125
- <ul class="summary">
126
-
127
- <li class="public ">
128
- <span class="summary_signature">
129
-
130
- <a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> &#x21d2; Integer </a>
131
-
132
-
133
-
134
- </span>
135
-
136
-
137
-
138
-
139
- <span class="note title readonly">readonly</span>
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
- <span class="summary_desc"><div class='inline'>
150
- <p>Holds the unique ID of this entity.</p>
151
- </div></span>
152
-
153
- </li>
154
-
155
-
156
- </ul>
157
-
158
119
 
159
120
 
160
121
 
161
122
 
162
123
  <h2>
163
- Class Method Summary
124
+ Instance Method Summary
164
125
  <small><a href="#" class="summary_toggle">collapse</a></small>
165
126
  </h2>
166
127
 
@@ -169,31 +130,7 @@
169
130
  <li class="public ">
170
131
  <span class="summary_signature">
171
132
 
172
- <a href="#[]-class_method" title="[] (class method)">.<strong>[]</strong>(entity_id) &#x21d2; Entity </a>
173
-
174
-
175
-
176
- </span>
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
- <span class="summary_desc"><div class='inline'>
187
- <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>
188
- </div></span>
189
-
190
- </li>
191
-
192
-
193
- <li class="public ">
194
- <span class="summary_signature">
195
-
196
- <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Enumerator </a>
133
+ <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) &#x21d2; Boolean </a>
197
134
 
198
135
 
199
136
 
@@ -208,25 +145,16 @@
208
145
 
209
146
 
210
147
  <span class="summary_desc"><div class='inline'>
211
- <p>Iterates over all entities.</p>
148
+ <p>Add any number components to the Entity.</p>
212
149
  </div></span>
213
150
 
214
151
  </li>
215
152
 
216
153
 
217
- </ul>
218
-
219
- <h2>
220
- Instance Method Summary
221
- <small><a href="#" class="summary_toggle">collapse</a></small>
222
- </h2>
223
-
224
- <ul class="summary">
225
-
226
154
  <li class="public ">
227
155
  <span class="summary_signature">
228
156
 
229
- <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) &#x21d2; Boolean </a>
157
+ <a href="#component-instance_method" title="#component (instance method)">#<strong>component</strong>(manager = nil) &#x21d2; Component </a>
230
158
 
231
159
 
232
160
 
@@ -241,7 +169,7 @@
241
169
 
242
170
 
243
171
  <span class="summary_desc"><div class='inline'>
244
- <p>Add any number components to the Entity.</p>
172
+ <p>A single component from a component manager.</p>
245
173
  </div></span>
246
174
 
247
175
  </li>
@@ -265,7 +193,7 @@
265
193
 
266
194
 
267
195
  <span class="summary_desc"><div class='inline'>
268
- <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>
196
+ <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>
269
197
  </div></span>
270
198
 
271
199
  </li>
@@ -289,7 +217,7 @@
289
217
 
290
218
 
291
219
  <span class="summary_desc"><div class='inline'>
292
- <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>
220
+ <p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its data.</p>
293
221
  </div></span>
294
222
 
295
223
  </li>
@@ -342,38 +270,13 @@
342
270
  <p>Remove a component from the Entity.</p>
343
271
  </div></span>
344
272
 
345
- </li>
346
-
347
-
348
- <li class="public ">
349
- <span class="summary_signature">
350
-
351
- <a href="#to_i-instance_method" title="#to_i (instance method)">#<strong>to_i</strong> &#x21d2; Integer </a>
352
-
353
-
354
-
355
- </span>
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
- <span class="summary_desc"><div class='inline'>
366
- <p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID reader</a></span>.</p>
367
- </div></span>
368
-
369
273
  </li>
370
274
 
371
275
 
372
276
  </ul>
373
277
 
374
278
 
375
-
376
- <div id="constructor_details" class="method_details_list">
279
+ <div id="constructor_details" class="method_details_list">
377
280
  <h2>Constructor Details</h2>
378
281
 
379
282
  <div class="method_details first">
@@ -402,7 +305,7 @@
402
305
  <span class='name'>components</span>
403
306
 
404
307
 
405
- <span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (class)">Components</a></span></tt>)</span>
308
+ <span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (module)">Components</a></span></tt>)</span>
406
309
 
407
310
 
408
311
 
@@ -422,31 +325,19 @@
422
325
  <pre class="lines">
423
326
 
424
327
 
425
- 16
426
- 17
427
- 18
428
- 19
429
- 20
430
- 21
431
- 22
432
- 23
433
- 24
434
- 25
435
- 26</pre>
328
+ 8
329
+ 9
330
+ 10
331
+ 11
332
+ 12</pre>
436
333
  </td>
437
334
  <td>
438
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 16</span>
335
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 8</span>
439
336
 
440
337
  <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>
441
- <span class='comment'># Assign new unique ID
442
- </span> <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:nil?</span><span class='rparen'>)</span>
443
- <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>
444
- <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>
445
-
446
338
  <span class='comment'># Add each component
447
339
  </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>
448
-
449
- <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>
340
+ <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>
450
341
  <span class='kw'>end</span></pre>
451
342
  </td>
452
343
  </tr>
@@ -455,76 +346,15 @@
455
346
 
456
347
  </div>
457
348
 
458
- <div id="instance_attr_details" class="attr_details">
459
- <h2>Instance Attribute Details</h2>
460
-
461
-
462
- <span id="id=-instance_method"></span>
463
- <div class="method_details first">
464
- <h3 class="signature first" id="id-instance_method">
465
-
466
- #<strong>id</strong> &#x21d2; <tt>Integer</tt>
467
-
468
-
469
-
470
349
 
471
-
472
- </h3><div class="docstring">
473
- <div class="discussion">
474
-
475
- <p>Holds the unique ID of this entity</p>
476
-
477
-
478
- </div>
479
- </div>
480
- <div class="tags">
481
-
482
- <p class="tag_title">Returns:</p>
483
- <ul class="return">
484
-
485
- <li>
486
-
487
-
488
- <span class='type'>(<tt>Integer</tt>)</span>
489
-
490
-
491
-
492
- </li>
493
-
494
- </ul>
495
-
496
- </div><table class="source_code">
497
- <tr>
498
- <td>
499
- <pre class="lines">
500
-
501
-
502
- 5
503
- 6
504
- 7</pre>
505
- </td>
506
- <td>
507
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 5</span>
508
-
509
- <span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
510
- <span class='ivar'>@id</span>
511
- <span class='kw'>end</span></pre>
512
- </td>
513
- </tr>
514
- </table>
515
- </div>
516
-
517
- </div>
518
-
519
-
520
- <div id="class_method_details" class="method_details_list">
521
- <h2>Class Method Details</h2>
350
+ <div id="instance_method_details" class="method_details_list">
351
+ <h2>Instance Method Details</h2>
522
352
 
523
353
 
524
354
  <div class="method_details first">
525
- <h3 class="signature first" id="[]-class_method">
355
+ <h3 class="signature first" id="add-instance_method">
526
356
 
527
- .<strong>[]</strong>(entity_id) &#x21d2; <tt>Entity</tt>
357
+ #<strong>add</strong>(*components_to_add) &#x21d2; <tt>Boolean</tt>
528
358
 
529
359
 
530
360
 
@@ -533,32 +363,28 @@
533
363
  </h3><div class="docstring">
534
364
  <div class="discussion">
535
365
 
536
- <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>
366
+ <p>Add any number components to the Entity.</p>
537
367
 
538
368
 
539
369
  </div>
540
370
  </div>
541
371
  <div class="tags">
542
-
543
- <div class="examples">
544
- <p class="tag_title">Examples:</p>
545
-
546
-
547
- <pre class="example code"><code><span class='comment'># This gets the Entity with ID 7
548
- </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>
549
-
550
- </div>
551
- <p class="tag_title">Parameters:</p>
372
+ <p class="tag_title">Parameters:</p>
552
373
  <ul class="param">
553
374
 
554
375
  <li>
555
376
 
556
- <span class='name'>entity_id</span>
377
+ <span class='name'>components_to_add</span>
378
+
557
379
 
380
+ <span class='type'>(<tt>Component</tt>)</span>
558
381
 
559
- <span class='type'>(<tt>Integer</tt>)</span>
560
382
 
561
383
 
384
+ &mdash;
385
+ <div class='inline'>
386
+ <p>Any number of components created from any component manager</p>
387
+ </div>
562
388
 
563
389
  </li>
564
390
 
@@ -570,13 +396,13 @@
570
396
  <li>
571
397
 
572
398
 
573
- <span class='type'>(<tt>Entity</tt>)</span>
399
+ <span class='type'>(<tt>Boolean</tt>)</span>
574
400
 
575
401
 
576
402
 
577
403
  &mdash;
578
404
  <div class='inline'>
579
- <p>returns the Entity that uses the given unique ID, nil if there is no Entity associated with the given ID</p>
405
+ <p><code>true</code></p>
580
406
  </div>
581
407
 
582
408
  </li>
@@ -589,15 +415,37 @@
589
415
  <pre class="lines">
590
416
 
591
417
 
592
- 117
593
- 118
594
- 119</pre>
418
+ 57
419
+ 58
420
+ 59
421
+ 60
422
+ 61
423
+ 62
424
+ 63
425
+ 64
426
+ 65
427
+ 66
428
+ 67
429
+ 68
430
+ 69
431
+ 70</pre>
595
432
  </td>
596
433
  <td>
597
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 117</span>
434
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 57</span>
598
435
 
599
- <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>
600
- <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>
436
+ <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>
437
+ <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>
438
+ <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>
439
+ <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>
440
+ <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>
441
+ <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>
442
+ <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>
443
+ <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>
444
+ <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>
445
+ <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>
446
+ <span class='kw'>end</span>
447
+ <span class='kw'>end</span>
448
+ <span class='kw'>true</span>
601
449
  <span class='kw'>end</span></pre>
602
450
  </td>
603
451
  </tr>
@@ -605,9 +453,9 @@
605
453
  </div>
606
454
 
607
455
  <div class="method_details ">
608
- <h3 class="signature " id="each-class_method">
456
+ <h3 class="signature " id="component-instance_method">
609
457
 
610
- .<strong>each</strong>(&amp;block) &#x21d2; <tt>Enumerator</tt>
458
+ #<strong>component</strong>(manager = nil) &#x21d2; <tt>Component</tt>
611
459
 
612
460
 
613
461
 
@@ -616,87 +464,38 @@
616
464
  </h3><div class="docstring">
617
465
  <div class="discussion">
618
466
 
619
- <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>
467
+ <p>A single component from a component manager. Use this if you expect the component to only belong to one entity and you want to access it. Access the component using either parameter notation or array notation. Array notation is conventional for better readablility.</p>
620
468
 
621
469
 
622
470
  </div>
623
471
  </div>
624
472
  <div class="tags">
625
473
 
626
- <p class="tag_title">Returns:</p>
627
- <ul class="return">
628
-
629
- <li>
630
-
631
-
632
- <span class='type'>(<tt>Enumerator</tt>)</span>
633
-
634
-
635
-
636
- </li>
637
-
638
- </ul>
639
-
640
- </div><table class="source_code">
641
- <tr>
642
- <td>
643
- <pre class="lines">
644
-
645
-
646
- 124
647
- 125
648
- 126</pre>
649
- </td>
650
- <td>
651
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 124</span>
652
-
653
- <span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
654
- <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
655
- <span class='kw'>end</span></pre>
656
- </td>
657
- </tr>
658
- </table>
659
- </div>
660
-
661
- </div>
662
-
663
- <div id="instance_method_details" class="method_details_list">
664
- <h2>Instance Method Details</h2>
665
-
474
+ <div class="examples">
475
+ <p class="tag_title">Examples:</p>
666
476
 
667
- <div class="method_details first">
668
- <h3 class="signature first" id="add-instance_method">
669
-
670
- #<strong>add</strong>(*components_to_add) &#x21d2; <tt>Boolean</tt>
671
-
672
-
673
-
674
-
675
-
676
- </h3><div class="docstring">
677
- <div class="discussion">
477
+
478
+ <pre class="example code"><code><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_component'>component</span><span class='lbracket'>[</span><span class='ivar'>@component_manager</span><span class='rbracket'>]</span> <span class='comment'># array notation(the standard)
479
+ </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>
678
480
 
679
- <p>Add any number components to the Entity.</p>
680
-
681
-
682
481
  </div>
683
- </div>
684
- <div class="tags">
685
- <p class="tag_title">Parameters:</p>
482
+ <p class="tag_title">Parameters:</p>
686
483
  <ul class="param">
687
484
 
688
485
  <li>
689
486
 
690
- <span class='name'>components_to_add</span>
487
+ <span class='name'>manager</span>
691
488
 
692
489
 
693
- <span class='type'>(<tt>Component</tt>)</span>
490
+ <span class='type'>(<tt><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></tt>)</span>
491
+
694
492
 
493
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
695
494
 
696
495
 
697
496
  &mdash;
698
497
  <div class='inline'>
699
- <p>Any number of components created from any component manager</p>
498
+ <p>If you pass nil you can then use array notation to access the same value.</p>
700
499
  </div>
701
500
 
702
501
  </li>
@@ -709,14 +508,9 @@
709
508
  <li>
710
509
 
711
510
 
712
- <span class='type'>(<tt>Boolean</tt>)</span>
713
-
511
+ <span class='type'>(<tt>Component</tt>)</span>
714
512
 
715
513
 
716
- &mdash;
717
- <div class='inline'>
718
- <p><code>true</code></p>
719
- </div>
720
514
 
721
515
  </li>
722
516
 
@@ -728,37 +522,37 @@
728
522
  <pre class="lines">
729
523
 
730
524
 
731
- 58
732
- 59
733
- 60
734
- 61
735
- 62
736
- 63
737
- 64
738
- 65
739
- 66
740
- 67
741
- 68
742
- 69
743
- 70
744
- 71</pre>
525
+ 26
526
+ 27
527
+ 28
528
+ 29
529
+ 30
530
+ 31
531
+ 32
532
+ 33
533
+ 34
534
+ 35
535
+ 36
536
+ 37
537
+ 38
538
+ 39</pre>
745
539
  </td>
746
540
  <td>
747
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 58</span>
748
-
749
- <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>
750
- <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>
751
- <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>
752
- <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='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span>
753
- <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='id identifier rubyid_id'>id</span>
754
- <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>
755
- <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='period'>.</span><span class='id identifier rubyid_id'>id</span>
756
- <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='period'>.</span><span class='id identifier rubyid_id'>id</span>
757
- <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='id identifier rubyid_id'>id</span>
758
- <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>
541
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 26</span>
542
+
543
+ <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>
544
+ <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>
545
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_component_redirect'>component_redirect</span><span class='period'>.</span><span class='id identifier rubyid_entity'>entity</span> <span class='op'>=</span> <span class='kw'>self</span>
546
+ <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_component_redirect'>component_redirect</span>
547
+ <span class='kw'>else</span>
548
+ <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>
549
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This entity(</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>) doesnt have any components of this type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_manager'>manager</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
550
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_manager'>manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;</span> <span class='int'>1</span>
551
+ <span class='const'>Warning</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This entity has MANY of this component but you called the method that is intended for having a single of this component type.\nYou may have a bug in your logic.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
759
552
  <span class='kw'>end</span>
553
+
554
+ <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>
760
555
  <span class='kw'>end</span>
761
- <span class='kw'>true</span>
762
556
  <span class='kw'>end</span></pre>
763
557
  </td>
764
558
  </tr>
@@ -777,7 +571,7 @@
777
571
  </h3><div class="docstring">
778
572
  <div class="discussion">
779
573
 
780
- <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>
574
+ <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>
781
575
 
782
576
 
783
577
  </div>
@@ -804,12 +598,12 @@
804
598
  <pre class="lines">
805
599
 
806
600
 
807
- 30
808
- 31
809
- 32</pre>
601
+ 16
602
+ 17
603
+ 18</pre>
810
604
  </td>
811
605
  <td>
812
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 30</span>
606
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 16</span>
813
607
 
814
608
  <span class='kw'>def</span> <span class='id identifier rubyid_components'>components</span>
815
609
  <span class='ivar'>@components</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -831,7 +625,7 @@
831
625
  </h3><div class="docstring">
832
626
  <div class="discussion">
833
627
 
834
- <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>
628
+ <p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its data.</p>
835
629
 
836
630
 
837
631
  </div>
@@ -863,7 +657,6 @@
863
657
  <pre class="lines">
864
658
 
865
659
 
866
- 42
867
660
  43
868
661
  44
869
662
  45
@@ -873,22 +666,19 @@
873
666
  49
874
667
  50
875
668
  51
876
- 52
877
- 53</pre>
669
+ 52</pre>
878
670
  </td>
879
671
  <td>
880
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 42</span>
672
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 43</span>
881
673
 
882
674
  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
883
- <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>
884
- <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_id'>component_id</span><span class='op'>|</span>
885
- <span class='id identifier rubyid_component_manager'>component_manager</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rbracket'>]</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='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
886
- <span class='comment'>#self.remove FelFlame::Components.const_get(component_manager.name)[component_id]
887
- </span> <span class='kw'>end</span>
675
+ <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>
676
+ <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>
677
+ <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>
678
+ <span class='kw'>end</span>
888
679
  <span class='kw'>end</span>
889
- <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>
680
+ <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>
890
681
  <span class='ivar'>@components</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
891
- <span class='ivar'>@id</span> <span class='op'>=</span> <span class='kw'>nil</span>
892
682
  <span class='kw'>true</span>
893
683
  <span class='kw'>end</span></pre>
894
684
  </td>
@@ -960,6 +750,7 @@
960
750
  <pre class="lines">
961
751
 
962
752
 
753
+ 87
963
754
  88
964
755
  89
965
756
  90
@@ -970,73 +761,20 @@
970
761
  95</pre>
971
762
  </td>
972
763
  <td>
973
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 88</span>
764
+ <pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 87</span>
974
765
 
975
766
  <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>
976
767
  <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>
977
- <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='id identifier rubyid_id'>id</span>
978
- <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='id identifier rubyid_id'>id</span>
979
- <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='period'>.</span><span class='id identifier rubyid_id'>id</span>
768
+ <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>
769
+ <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>
770
+ <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>
771
+ <span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
980
772
  <span class='kw'>end</span>
981
773
  <span class='kw'>true</span>
982
774
  <span class='kw'>end</span></pre>
983
775
  </td>
984
776
  </tr>
985
777
  </table>
986
- </div>
987
-
988
- <div class="method_details ">
989
- <h3 class="signature " id="to_i-instance_method">
990
-
991
- #<strong>to_i</strong> &#x21d2; <tt>Integer</tt>
992
-
993
-
994
-
995
-
996
-
997
- </h3><div class="docstring">
998
- <div class="discussion">
999
-
1000
- <p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID reader</a></span></p>
1001
-
1002
-
1003
- </div>
1004
- </div>
1005
- <div class="tags">
1006
-
1007
- <p class="tag_title">Returns:</p>
1008
- <ul class="return">
1009
-
1010
- <li>
1011
-
1012
-
1013
- <span class='type'>(<tt>Integer</tt>)</span>
1014
-
1015
-
1016
-
1017
- </li>
1018
-
1019
- </ul>
1020
-
1021
- </div><table class="source_code">
1022
- <tr>
1023
- <td>
1024
- <pre class="lines">
1025
-
1026
-
1027
- 36
1028
- 37
1029
- 38</pre>
1030
- </td>
1031
- <td>
1032
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 36</span>
1033
-
1034
- <span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
1035
- <span class='id identifier rubyid_id'>id</span>
1036
- <span class='kw'>end</span></pre>
1037
- </td>
1038
- </tr>
1039
- </table>
1040
778
  </div>
1041
779
 
1042
780
  </div>
@@ -1044,7 +782,7 @@
1044
782
  </div>
1045
783
 
1046
784
  <div id="footer">
1047
- Generated on Fri Jul 9 01:56:54 2021 by
785
+ Generated on Tue Feb 1 23:28:33 2022 by
1048
786
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1049
787
  0.9.26 (ruby-2.7.3).
1050
788
  </div>