Comparing version 3.2.0 to 3.2.1
@@ -157,3 +157,3 @@ "use strict"; | ||
for (var componentName in this._components) { | ||
components[componentName] = this._components[componentName].state; | ||
components[componentName] = Object.assign({}, this._components[componentName].state); | ||
} | ||
@@ -160,0 +160,0 @@ return { |
@@ -540,3 +540,4 @@ 'use strict'; | ||
// 'state': currentState, | ||
'action': action | ||
'action': action, | ||
'revert': action.revert | ||
}); | ||
@@ -572,2 +573,32 @@ } | ||
/** | ||
* @description - Rolls back the state of the manager by reverting actions, | ||
* instead of replacing the current state | ||
* @param {Number} - the number indicating at what state to roll back to | ||
*/ | ||
}, { | ||
key: 'rollback_actions', | ||
value: function rollback_actions(number) { | ||
if (number > this._stateCounter) { | ||
this._stateCounter = number; | ||
} | ||
var index = this._stateQueue.length - 1; | ||
if (index < 0) { | ||
return; | ||
} | ||
var currentNumber = this._stateQueue[index].number; | ||
while (currentNumber > number && index >= 0) { | ||
currentNumber = this._stateQueue[index].number; | ||
if (currentNumber != number) { | ||
this._stateQueue[index].revert(); | ||
index--; | ||
} | ||
} | ||
this._stateQueue.splice(0, index + 1); | ||
} | ||
/** | ||
* @description - Takes the entire state queue and re applies all of the states | ||
@@ -574,0 +605,0 @@ * This typically would happen after a rollback |
{ | ||
"name": "sam-ecs", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"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
51865
1301