mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Make sure all cobinations of missmatched types and missing mod settings are gracefully handled by the Web UI. Fixes #609.
29 lines
708 B
JavaScript
29 lines
708 B
JavaScript
"use strict";
|
|
const { ModPack } = require("@clusterio/lib");
|
|
|
|
const pack = new ModPack();
|
|
pack.name = "test-settings";
|
|
pack.mods.set("test_mod", { name: "test_mod", enabled: true, version: "0.0.0" });
|
|
const settingTypes = [
|
|
"bool-setting",
|
|
"int-setting",
|
|
"double-setting",
|
|
"string-setting",
|
|
"color-setting",
|
|
];
|
|
const settingValues = {
|
|
"bool": false,
|
|
"int": 1,
|
|
"double": 0.5,
|
|
"string": "str",
|
|
"color": { r: 0, g: 1, b: 0, a: 1 },
|
|
// "missing":
|
|
};
|
|
for (const type of settingTypes) {
|
|
for (const [valueType, value] of Object.entries(settingValues)) {
|
|
pack.settings.startup.set(`${type}-with-${valueType}-value`, { value });
|
|
}
|
|
}
|
|
/* eslint-disable no-console */
|
|
console.log(pack.toModPackString());
|