Air defence has its own spawn icon

This commit is contained in:
PeekabooSteam
2023-11-05 10:57:53 +00:00
parent 840033aa6a
commit aad0fd22ad
8 changed files with 86 additions and 32 deletions

View File

@@ -613,10 +613,10 @@ class LoadoutEditor {
title.innerText = "Loadout properties";
__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f").appendChild(title);
if (__classPrivateFieldGet(this, _LoadoutEditor_loadout, "f")) {
var laodout = __classPrivateFieldGet(this, _LoadoutEditor_loadout, "f");
(0, utils_1.addStringInput)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), "Name", laodout.name, "text", (value) => { laodout.name = value; __classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f").dispatchEvent(new Event("refresh")); });
(0, utils_1.addStringInput)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), "Code", laodout.code, "text", (value) => { laodout.code = value; });
(0, utils_1.addStringInput)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), "Roles", (0, utils_1.arrayToString)(laodout.roles), "text", (value) => { laodout.roles = (0, utils_1.stringToArray)(value); });
var loadout = __classPrivateFieldGet(this, _LoadoutEditor_loadout, "f");
(0, utils_1.addStringInput)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), "Name", loadout.name, "text", (value) => { loadout.name = value; __classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f").dispatchEvent(new Event("refresh")); });
(0, utils_1.addStringInput)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), "Code", loadout.code, "text", (value) => { loadout.code = value; });
(0, utils_1.addStringInput)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), "Roles", (0, utils_1.arrayToString)(loadout.roles), "text", (value) => { loadout.roles = (0, utils_1.stringToArray)(value); });
(0, utils_1.addLoadoutItemsEditor)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), __classPrivateFieldGet(this, _LoadoutEditor_loadout, "f"));
}
}
@@ -1034,25 +1034,11 @@ exports.addLoadoutsScroll = addLoadoutsScroll;
* @returns The string
*/
function arrayToString(array) {
var value = "[";
var firstRole = true;
array.forEach((role) => {
value += firstRole ? "" : ", ";
firstRole = false;
value += role;
});
value += "]";
return value;
return "[" + array.join(", ") + "]";
}
exports.arrayToString = arrayToString;
function stringToArray(input) {
input = input.replace("[", "").replace("]", "");
var values = input.split(",");
var result = [];
values.forEach((value) => {
result.push(value.trim());
});
return result;
return input.match(/(\w)+/g) || [];
}
exports.stringToArray = stringToArray;

View File

@@ -37,10 +37,10 @@ export class LoadoutEditor {
this.#contentDiv.appendChild(title);
if (this.#loadout) {
var laodout = this.#loadout;
addStringInput(this.#contentDiv, "Name", laodout.name, "text", (value: string) => {laodout.name = value; this.#contentDiv.dispatchEvent(new Event("refresh"));});
addStringInput(this.#contentDiv, "Code", laodout.code, "text", (value: string) => {laodout.code = value; });
addStringInput(this.#contentDiv, "Roles", arrayToString(laodout.roles), "text", (value: string) => {laodout.roles = stringToArray(value);});
var loadout = this.#loadout;
addStringInput(this.#contentDiv, "Name", loadout.name, "text", (value: string) => {loadout.name = value; this.#contentDiv.dispatchEvent(new Event("refresh"));});
addStringInput(this.#contentDiv, "Code", loadout.code, "text", (value: string) => {loadout.code = value; });
addStringInput(this.#contentDiv, "Roles", arrayToString(loadout.roles), "text", (value: string) => {loadout.roles = stringToArray(value);});
addLoadoutItemsEditor(this.#contentDiv, this.#loadout);
}
}

View File

@@ -269,5 +269,5 @@ export function arrayToString(array: string[]) {
export function stringToArray(input: string) {
return input.match( /(\w)+/g );
return input.match( /(\w)+/g ) || [];
}