Comparing version 2.2.3 to 2.2.4
@@ -105,2 +105,3 @@ 'use strict'; | ||
this._processorsCachedEntityLists = {}; | ||
this._processorOrder = 0; | ||
@@ -534,2 +535,3 @@ /* keeps a set of all the hashes so to not get any collisions | ||
processor.order = this._processorOrder++; | ||
this._processors[processor.getName()] = processor; | ||
@@ -580,11 +582,36 @@ } | ||
value: function update() { | ||
for (var processorName in this._processors) { | ||
var processor = this._processors[processorName]; | ||
// get the list of entities with the components neededfor the processor | ||
if (!this._processorsCachedEntityLists[processorName] || this._processorsCachedEntityLists[processorName].invalid) { | ||
this._fetchProcessorEntityList(processorName, processor.getComponentNames()); | ||
var _this = this; | ||
var processorNameList = Object.keys(this._processors).sort(function (processorNameA, processorNameB) { | ||
return _this._processors[processorNameA].order - _this._processors[processorNameB].order; | ||
}); | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
try { | ||
for (var _iterator5 = processorNameList[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var processorName = _step5.value; | ||
var processor = this._processors[processorName]; | ||
// get the list of entities with the components neededfor the processor | ||
if (!this._processorsCachedEntityLists[processorName] || this._processorsCachedEntityLists[processorName].invalid) { | ||
this._fetchProcessorEntityList(processorName, processor.getComponentNames()); | ||
} | ||
var entityList = this._processorsCachedEntityLists[processorName].set; | ||
processor.update(entityList, this); | ||
} | ||
var entityList = this._processorsCachedEntityLists[processorName].set; | ||
processor.update(entityList, this); | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
} | ||
@@ -605,9 +632,9 @@ } | ||
var shouldInvalidate = true; | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
var _iteratorNormalCompletion6 = true; | ||
var _didIteratorError6 = false; | ||
var _iteratorError6 = undefined; | ||
try { | ||
for (var _iterator5 = this._processors[processorName].getComponentNames()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var componentName = _step5.value; | ||
for (var _iterator6 = this._processors[processorName].getComponentNames()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { | ||
var componentName = _step6.value; | ||
@@ -620,12 +647,12 @@ if (!(componentName in components)) { | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
_didIteratorError6 = true; | ||
_iteratorError6 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
if (!_iteratorNormalCompletion6 && _iterator6.return) { | ||
_iterator6.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
if (_didIteratorError6) { | ||
throw _iteratorError6; | ||
} | ||
@@ -706,9 +733,9 @@ } | ||
var set = cachedListObject.isSorted ? new SortedSet(Object.keys(this._entitiesByHash), cachedListObject.equal, cachedListObject.compare) : new FastSet(Object.keys(this._entitiesByHash)); | ||
var _iteratorNormalCompletion6 = true; | ||
var _didIteratorError6 = false; | ||
var _iteratorError6 = undefined; | ||
var _iteratorNormalCompletion7 = true; | ||
var _didIteratorError7 = false; | ||
var _iteratorError7 = undefined; | ||
try { | ||
for (var _iterator6 = componentSet[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { | ||
var component = _step6.value; | ||
for (var _iterator7 = componentSet[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { | ||
var component = _step7.value; | ||
@@ -725,12 +752,12 @@ /* none of the entities in the manager have a required component of the | ||
} catch (err) { | ||
_didIteratorError6 = true; | ||
_iteratorError6 = err; | ||
_didIteratorError7 = true; | ||
_iteratorError7 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion6 && _iterator6.return) { | ||
_iterator6.return(); | ||
if (!_iteratorNormalCompletion7 && _iterator7.return) { | ||
_iterator7.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError6) { | ||
throw _iteratorError6; | ||
if (_didIteratorError7) { | ||
throw _iteratorError7; | ||
} | ||
@@ -782,6 +809,5 @@ } | ||
value: function emit(eventType, arg) { | ||
//the event listener will get access to the manager itself | ||
if (this._emitFun) this._emitFun(eventType, arg); | ||
//the event listener will get access to the manager itself | ||
return this._emitter.emit(eventType, arg, this); | ||
@@ -818,9 +844,9 @@ } | ||
value: function fromJSON(obj) { | ||
var _iteratorNormalCompletion7 = true; | ||
var _didIteratorError7 = false; | ||
var _iteratorError7 = undefined; | ||
var _iteratorNormalCompletion8 = true; | ||
var _didIteratorError8 = false; | ||
var _iteratorError8 = undefined; | ||
try { | ||
for (var _iterator7 = obj.entities[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { | ||
var entityObj = _step7.value; | ||
for (var _iterator8 = obj.entities[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) { | ||
var entityObj = _step8.value; | ||
@@ -841,12 +867,12 @@ var hashValue = entityObj.hash; | ||
} catch (err) { | ||
_didIteratorError7 = true; | ||
_iteratorError7 = err; | ||
_didIteratorError8 = true; | ||
_iteratorError8 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion7 && _iterator7.return) { | ||
_iterator7.return(); | ||
if (!_iteratorNormalCompletion8 && _iterator8.return) { | ||
_iterator8.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError7) { | ||
throw _iteratorError7; | ||
if (_didIteratorError8) { | ||
throw _iteratorError8; | ||
} | ||
@@ -906,9 +932,9 @@ } | ||
entity._setHash(hash); | ||
var _iteratorNormalCompletion8 = true; | ||
var _didIteratorError8 = false; | ||
var _iteratorError8 = undefined; | ||
var _iteratorNormalCompletion9 = true; | ||
var _didIteratorError9 = false; | ||
var _iteratorError9 = undefined; | ||
try { | ||
for (var _iterator8 = componentList[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) { | ||
var componentObject = _step8.value; | ||
for (var _iterator9 = componentList[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) { | ||
var componentObject = _step9.value; | ||
@@ -926,12 +952,12 @@ if (componentObject.name in this._componentLibrary) { | ||
} catch (err) { | ||
_didIteratorError8 = true; | ||
_iteratorError8 = err; | ||
_didIteratorError9 = true; | ||
_iteratorError9 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion8 && _iterator8.return) { | ||
_iterator8.return(); | ||
if (!_iteratorNormalCompletion9 && _iterator9.return) { | ||
_iterator9.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError8) { | ||
throw _iteratorError8; | ||
if (_didIteratorError9) { | ||
throw _iteratorError9; | ||
} | ||
@@ -938,0 +964,0 @@ } |
{ | ||
"name": "sam-ecs", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"description": "A specialized entity component system", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45827
1140