@@ -370,7 +370,6 @@ function popUpCustomSorterCoder(){
370
370
lines . disabled = true ;
371
371
lines . spellcheck = false ;
372
372
let code = document . createElement ( "textarea" ) ;
373
- //code.style.display = "hidden";
374
373
code . id = "ModBuildingSorter_code" ;
375
374
code . value = BuildingSorter . customSorter ;
376
375
code . spellcheck = false ;
@@ -670,7 +669,7 @@ function updateWithPatchNote(oldVersion, newVersion, patchnotes){
670
669
} , 10000 ) ;
671
670
}
672
671
673
- class BuildingSorter {
672
+ class BuildingSorterClass {
674
673
get loadedVersion ( ) {
675
674
return this . _loadedVersion ;
676
675
}
@@ -1021,7 +1020,7 @@ class BuildingSorter {
1021
1020
if ( arr . length === 1 ) { //Version 1.3 or below.
1022
1021
arr = str . split ( "|" ) ;
1023
1022
if ( arr [ 0 ] && ! isNaN ( arr [ 0 ] ) ) {
1024
- this . currentSorter = parseInt ( arr [ 0 ] , 10 ) || 0 ;
1023
+ this . _currentSorter = parseInt ( arr [ 0 ] , 10 ) || 0 ;
1025
1024
loadedVersion = "1.0" ;
1026
1025
}
1027
1026
if ( arr [ 1 ] && ! isNaN ( arr [ 1 ] ) ) this . settings . animateBuildings = parseInt ( arr [ 1 ] , 10 ) === 1 ;
@@ -1039,7 +1038,7 @@ class BuildingSorter {
1039
1038
}
1040
1039
else { //Version 2 or higher
1041
1040
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 ;
1043
1042
if ( arr [ 2 ] ) {
1044
1043
let booleans = arr [ 2 ] . split ( "" ) ;
1045
1044
if ( booleans [ 0 ] ) this . settings . animateBuildings = parseInt ( booleans [ 0 ] , 10 ) === 1 ;
@@ -1063,10 +1062,10 @@ class BuildingSorter {
1063
1062
this . customSorter = arr [ 4 ] ;
1064
1063
}
1065
1064
}
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 ;
1070
1069
updateSorterButtons ( ) ;
1071
1070
updateBuildingAnimations ( ) ;
1072
1071
this . runCurrentSorter ( ) ;
@@ -1079,7 +1078,7 @@ class BuildingSorter {
1079
1078
1080
1079
incrementCurrentSorter ( ) {
1081
1080
this . _currentSorter ++ ;
1082
- if ( this . currentSorter === this . sorters . length ) this . currentSorter = 0 ;
1081
+ if ( this . currentSorter === this . sorters . length ) this . _currentSorter = 0 ;
1083
1082
if ( ! this . sorters [ this . currentSorter ] . enabled ) {
1084
1083
this . incrementCurrentSorter ( ) ;
1085
1084
}
@@ -1159,12 +1158,13 @@ class BuildingSorter {
1159
1158
} ) . catch ( console . error ) ;
1160
1159
}
1161
1160
}
1161
+ let BuildingSorter = new BuildingSorterClass ( ) ;
1162
1162
1163
1163
const readyCheck = setInterval ( ( ) => {
1164
1164
const theGame = Game || window . Game ;
1165
1165
if ( typeof theGame !== "undefined" && typeof theGame . ready !== "undefined" && theGame . ready ) {
1166
1166
startTime = Date . now ( ) ;
1167
- theGame . registerMod ( "BuildingSorter" , new BuildingSorter ( ) ) ;
1167
+ theGame . registerMod ( "BuildingSorter" , BuildingSorter ) ;
1168
1168
clearInterval ( readyCheck ) ;
1169
1169
1170
1170
//Check for external mods after 1s, 5s, 10s, 30s, 60s since mod was first loaded.
0 commit comments