Skip to content

Commit b581c8d

Browse files
Bug fixes
1 parent 1835a48 commit b581c8d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

BuildingSorter.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ function popUpCustomSorterCoder(){
370370
lines.disabled = true;
371371
lines.spellcheck = false;
372372
let code = document.createElement("textarea");
373-
//code.style.display = "hidden";
374373
code.id = "ModBuildingSorter_code";
375374
code.value = BuildingSorter.customSorter;
376375
code.spellcheck = false;
@@ -670,7 +669,7 @@ function updateWithPatchNote(oldVersion, newVersion, patchnotes){
670669
}, 10000);
671670
}
672671

673-
class BuildingSorter {
672+
class BuildingSorterClass {
674673
get loadedVersion(){
675674
return this._loadedVersion;
676675
}
@@ -1021,7 +1020,7 @@ class BuildingSorter {
10211020
if(arr.length === 1){//Version 1.3 or below.
10221021
arr = str.split("|");
10231022
if(arr[0] && !isNaN(arr[0])){
1024-
this.currentSorter = parseInt(arr[0], 10) || 0;
1023+
this._currentSorter = parseInt(arr[0], 10) || 0;
10251024
loadedVersion = "1.0";
10261025
}
10271026
if(arr[1] && !isNaN(arr[1])) this.settings.animateBuildings = parseInt(arr[1], 10) === 1;
@@ -1039,7 +1038,7 @@ class BuildingSorter {
10391038
}
10401039
else{//Version 2 or higher
10411040
if(arr[0]) loadedVersion = arr[0];
1042-
if(arr[1]) this.currentSorter = parseInt(arr[1], 10) || 0;
1041+
if(arr[1]) this._currentSorter = parseInt(arr[1], 10) || 0;
10431042
if(arr[2]){
10441043
let booleans = arr[2].split("");
10451044
if(booleans[0]) this.settings.animateBuildings = parseInt(booleans[0], 10) === 1;
@@ -1063,10 +1062,10 @@ class BuildingSorter {
10631062
this.customSorter = arr[4];
10641063
}
10651064
}
1066-
this.loadedVersion = `${loadedVersion}`;
1067-
if(this.currentSorter < 0) this.currentSorter = 0;
1068-
if(this.currentSorter >= this.sorters.length) this.currentSorter = 0;
1069-
if(isNaN(this.currentSorter)) this.currentSorter = 0;
1065+
this._loadedVersion = `${loadedVersion}`;
1066+
if(this.currentSorter < 0) this._currentSorter = 0;
1067+
if(this.currentSorter >= this.sorters.length) this._currentSorter = 0;
1068+
if(isNaN(this.currentSorter)) this._currentSorter = 0;
10701069
updateSorterButtons();
10711070
updateBuildingAnimations();
10721071
this.runCurrentSorter();
@@ -1079,7 +1078,7 @@ class BuildingSorter {
10791078

10801079
incrementCurrentSorter(){
10811080
this._currentSorter++;
1082-
if(this.currentSorter === this.sorters.length) this.currentSorter = 0;
1081+
if(this.currentSorter === this.sorters.length) this._currentSorter = 0;
10831082
if(!this.sorters[this.currentSorter].enabled){
10841083
this.incrementCurrentSorter();
10851084
}
@@ -1159,12 +1158,13 @@ class BuildingSorter {
11591158
}).catch(console.error);
11601159
}
11611160
}
1161+
let BuildingSorter = new BuildingSorterClass();
11621162

11631163
const readyCheck = setInterval(() => {
11641164
const theGame = Game || window.Game;
11651165
if(typeof theGame !== "undefined" && typeof theGame.ready !== "undefined" && theGame.ready){
11661166
startTime = Date.now();
1167-
theGame.registerMod("BuildingSorter", new BuildingSorter());
1167+
theGame.registerMod("BuildingSorter", BuildingSorter);
11681168
clearInterval(readyCheck);
11691169

11701170
//Check for external mods after 1s, 5s, 10s, 30s, 60s since mod was first loaded.

0 commit comments

Comments
 (0)