mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-07 10:03:59 +00:00
Allow specifying abt in url params
This commit is contained in:
parent
e1cd08d2f9
commit
959a365de6
@ -3,8 +3,13 @@ const options = queryString.parse(location.search);
|
|||||||
|
|
||||||
export let queryParamOptions = {
|
export let queryParamOptions = {
|
||||||
embedProvider: null,
|
embedProvider: null,
|
||||||
|
abtVariant: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options.embed) {
|
if (options.embed) {
|
||||||
queryParamOptions.embedProvider = options.embed;
|
queryParamOptions.embedProvider = options.embed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.abt) {
|
||||||
|
queryParamOptions.abtVariant = options.abtVariant;
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { globalConfig } from "../../core/config";
|
import { globalConfig } from "../../core/config";
|
||||||
import { createLogger } from "../../core/logging";
|
import { createLogger } from "../../core/logging";
|
||||||
|
import { queryParamOptions } from "../../core/query_parameters";
|
||||||
import { randomInt } from "../../core/utils";
|
import { randomInt } from "../../core/utils";
|
||||||
import { BeltComponent } from "../../game/components/belt";
|
import { BeltComponent } from "../../game/components/belt";
|
||||||
import { StaticMapEntityComponent } from "../../game/components/static_map_entity";
|
import { StaticMapEntityComponent } from "../../game/components/static_map_entity";
|
||||||
@ -58,8 +59,13 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
if (err === FILE_NOT_FOUND) {
|
if (err === FILE_NOT_FOUND) {
|
||||||
|
if (typeof queryParamOptions.abtVariant === "string") {
|
||||||
|
this.abtVariant = queryParamOptions.abtVariant;
|
||||||
|
logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant);
|
||||||
|
} else {
|
||||||
this.abtVariant = String(randomInt(0, CURRENT_ABT_COUNT - 1));
|
this.abtVariant = String(randomInt(0, CURRENT_ABT_COUNT - 1));
|
||||||
logger.log("Set", CURRENT_ABT, "to", this.abtVariant);
|
logger.log("Set", CURRENT_ABT, "to", this.abtVariant);
|
||||||
|
}
|
||||||
this.app.storage.writeFileAsync("shapez_" + CURRENT_ABT + ".bin", this.abtVariant);
|
this.app.storage.writeFileAsync("shapez_" + CURRENT_ABT + ".bin", this.abtVariant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user