From ec7b01918cc2aec22d4c408bdd460bf767377fbc Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Sun, 10 Apr 2022 23:02:02 -0600 Subject: [PATCH] Forgot about that. Whoops --- src/systems/undo.js | 8 +++----- 1 file 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 };