diff --git a/devNotes/twine JS b/devNotes/twine JS index fc97687892d68f75ac4816589bb024a314e96876..bbe5727bd65e3a275dfcc86c67452a4c12f530ae 100644 --- a/devNotes/twine JS +++ b/devNotes/twine JS @@ -6872,13 +6872,9 @@ window.addSlave = function addSlave(slave) { }; window.removeSlave = function removeSlave(index) { - delete State.variables.slaveIndices[State.variables.slaves[index].ID]; - for (var key in State.variables.slaveIndices) { - if (State.variables.slaveIndices[key] > index) { - State.variables.slaveIndices[key] -= 1; - } - } - return State.variables.slaves.deleteAt(index); + const ret = State.variables.slaves.deleteAt(index); + State.variables.slaveIndices = slaves2indices(); + return ret; }; window.slaves2indices = function slaves2indices() { @@ -9258,4 +9254,4 @@ window.setColors = function(colorMap){ } }); }); -} \ No newline at end of file +}