Skip to content

Commit

Permalink
bugfix: Keep track of parent script when running Loader.runScript v…
Browse files Browse the repository at this point in the history
…ia ctx so it can be restored
  • Loading branch information
theBGuy committed Jan 28, 2025
1 parent d6af2cb commit 497b82d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions d2bs/kolbot/libs/core/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,13 @@ const Loader = {
return false;
}

Loader.currentScript = global[script];

if (isIncluded("scripts/" + script + ".js")) {
const ctx = {};
const ctx = {
_parent: Loader.currentScript
};
Loader.currentScript = global[script];

try {
if (Loader.currentScript instanceof Runnable) {
const { startArea, bossid, preAction } = Loader.currentScript;
Expand Down Expand Up @@ -429,7 +432,7 @@ const Loader = {
Loader.currentScript.cleanup(ctx);
}
}
Loader.currentScript = null;
Loader.currentScript = ctx._parent;
Loader.tempList.pop();

if (reconfiguration) {
Expand Down

0 comments on commit 497b82d

Please sign in to comment.