felecs 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -127,7 +127,7 @@
127
127
  </div>
128
128
 
129
129
  <div id="footer">
130
- Generated on Wed Feb 2 03:29:07 2022 by
130
+ Generated on Thu Feb 3 03:45:34 2022 by
131
131
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
132
132
  0.9.26 (ruby-2.7.3).
133
133
  </div>
@@ -100,6 +100,39 @@ module FelECS
100
100
  # def to_json() end
101
101
 
102
102
  class << self
103
+ # Selects every entity that has components of they type passed into
104
+ # this function and then executes the code block for those components
105
+ # and entities.
106
+ # @return [Nil]
107
+ def group(*component_managers, &block)
108
+ return nil if component_managers.empty?
109
+ if component_managers.length == 1
110
+ component_managers.first.each do |cmp|
111
+ block.call(cmp, cmp.entity)
112
+ end
113
+ else
114
+ arry = component_managers.first.select do |cmp|
115
+ ent = cmp.entity
116
+ keep = true
117
+ component_managers.drop(1).each do |mgr|
118
+ next unless ent.components[mgr].nil?
119
+ keep = false
120
+ break
121
+ end
122
+ keep
123
+ end
124
+ arry.each do |cmp|
125
+ ent = cmp.entity
126
+ cmp_arry = [cmp]
127
+ component_managers.drop(1).each do |cmp_mgr|
128
+ cmp_arry.push ent.component[cmp_mgr]
129
+ end
130
+ block.call(*cmp_arry, ent)
131
+ end
132
+ end
133
+ nil
134
+ end
135
+
103
136
  # Makes component managers behave like arrays with additional
104
137
  # methods for managing the array
105
138
  # @!visibility private
@@ -4,6 +4,6 @@
4
4
  # Keeps the version of the Gem
5
5
  module FelECS
6
6
  # The version of the Gem
7
- VERSION = '5.0.0'
7
+ VERSION = '5.0.1'
8
8
  end
9
9
  # :nocov:
@@ -100,6 +100,39 @@ module FelECS
100
100
  # def to_json() end
101
101
 
102
102
  class << self
103
+ # Selects every entity that has components of they type passed into
104
+ # this function and then executes the code block for those components
105
+ # and entities.
106
+ # @return [Nil]
107
+ def group(*component_managers, &block)
108
+ return nil if component_managers.empty?
109
+ if component_managers.length == 1
110
+ component_managers.first.each do |cmp|
111
+ block.call(cmp, cmp.entity)
112
+ end
113
+ else
114
+ arry = component_managers.first.select do |cmp|
115
+ ent = cmp.entity
116
+ keep = true
117
+ component_managers.drop(1).each do |mgr|
118
+ next unless ent.components[mgr].nil?
119
+ keep = false
120
+ break
121
+ end
122
+ keep
123
+ end
124
+ arry.each do |cmp|
125
+ ent = cmp.entity
126
+ cmp_arry = [cmp]
127
+ component_managers.drop(1).each do |cmp_mgr|
128
+ cmp_arry.push ent.component[cmp_mgr]
129
+ end
130
+ block.call(*cmp_arry, ent)
131
+ end
132
+ end
133
+ nil
134
+ end
135
+
103
136
  # Makes component managers behave like arrays with additional
104
137
  # methods for managing the array
105
138
  # @!visibility private
@@ -847,7 +880,7 @@ end
847
880
  # Keeps the version of the Gem
848
881
  module FelECS
849
882
  # The version of the Gem
850
- VERSION = '5.0.0'
883
+ VERSION = '5.0.1'
851
884
  end
852
885
  # :nocov:
853
886
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: felecs
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tradam
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-02 00:00:00.000000000 Z
11
+ date: 2022-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest-reporters
@@ -155,7 +155,6 @@ files:
155
155
  - Rakefile
156
156
  - bin/console
157
157
  - bin/setup
158
- - docs/CNAME
159
158
  - docs/FelECS.html
160
159
  - docs/FelECS/ComponentManager.html
161
160
  - docs/FelECS/Components.html
@@ -164,24 +163,12 @@ files:
164
163
  - docs/FelECS/Scenes.html
165
164
  - docs/FelECS/Stage.html
166
165
  - docs/FelECS/Systems.html
167
- - docs/FelFlame.html
168
- - docs/FelFlame/ComponentManager.html
169
- - docs/FelFlame/Components.html
170
- - docs/FelFlame/Entities.html
171
- - docs/FelFlame/Helper.html
172
- - docs/FelFlame/Helper/ComponentManager.html
173
- - docs/FelFlame/Order.html
174
- - docs/FelFlame/Scenes.html
175
- - docs/FelFlame/Stage.html
176
- - docs/FelFlame/Systems.html
177
- - docs/Felflame_.html
178
166
  - docs/_index.html
179
167
  - docs/class_list.html
180
168
  - docs/css/common.css
181
169
  - docs/css/full_list.css
182
170
  - docs/css/style.css
183
171
  - docs/file.README.html
184
- - docs/file.version.html
185
172
  - docs/file_list.html
186
173
  - docs/frames.html
187
174
  - docs/index.html
data/docs/CNAME DELETED
@@ -1 +0,0 @@
1
- felflame.tradam.fyi