diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-10 23:02:02 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-10 23:02:02 -0600 |
commit | ec7b01918cc2aec22d4c408bdd460bf767377fbc (patch) | |
tree | 78c2056a17b1167e8804fd75a0b1c125a61d6d2d | |
parent | 1bdfb42c3d5dd9a9ed416d97ae7f288f6d831a7e (diff) | |
download | bbiy-ec7b01918cc2aec22d4c408bdd460bf767377fbc.tar.gz bbiy-ec7b01918cc2aec22d4c408bdd460bf767377fbc.zip |
Forgot about that. Whoops
-rw-r--r-- | src/systems/undo.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/systems/undo.js b/src/systems/undo.js index fa36c93..29f5bec 100644 --- a/src/systems/undo.js +++ b/src/systems/undo.js @@ -3,7 +3,6 @@ game.system.Undo = (entitiesGrid) => { const update = (elapsedTime, entities, changedIds) => { if (changedIds.size) { - lastUndid = false; const state = {}; for (let id in entities) { if (entities[id].hasComponent("gridPosition")) { @@ -16,16 +15,15 @@ game.system.Undo = (entitiesGrid) => { } const undo = (entities) => { - states.map((state) => console.log(state[65].gridPosition)); let state = states.slice(0, -1).pop(); + if (states.length > 1) { + states.pop(); + } for (let id in state) { for (let componentName in state[id]) { entities[id].addComponent({name: componentName, ...state[id][componentName]}); } } - if (states.length > 1) { - states.pop(); - } } return { update, undo }; |