mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge branch 'main' into 357-map-context-switching
This commit is contained in:
commit
826bf12bd6
@ -1,4 +1,33 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
DCS Olympus
|
||||
|
||||
A real-time AI unit control mod for DCS World
|
||||
|
||||
Copyright (C) 2023 Veltro & Gang
|
||||
|
||||
DCS Olympus (the "MATERIAL" or "Software") is provided completely free
|
||||
to users subject to the it under both the terms of version 3 of the GNU
|
||||
General Public License as published by the Free Software Foundation, and
|
||||
the additional terms set out below; except where such terms conflict with this
|
||||
disclaimer, in which case, the terms of this disclaimer shall prevail.
|
||||
|
||||
The authors and/or copyright holders of the Software have not received any
|
||||
financial benefit in connection with the Software. In any event, the
|
||||
Software is provided “as is”, without warranty of any kind, express or
|
||||
implied, including but not limited to the warranties of merchantability,
|
||||
fitness for a particular purpose and non-infringement. In no event shall
|
||||
the authors and/or copyright holders be liable for any claim, damages or
|
||||
other liability, whether in an action of contract, tort or otherwise,
|
||||
arising from, out of or in connection with the Software or the use or o
|
||||
ther dealings in the Software.
|
||||
|
||||
Any party making use of the Software in any manner agrees to be
|
||||
bound by the terms set out in this disclaimer, version 3 of the GNU
|
||||
General Public Licence, and the Additional Terms below.
|
||||
|
||||
THIS MATERIAL IS NOT MADE OR SUPPORTED BY EAGLE DYNAMICS SA.
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
@ -618,57 +647,14 @@ an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
END OF GNU GENERAL PUBLIC LICENCE
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
ADDITIONAL TERMS & CONDITIONS
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
1. Governing Law
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
Save where specifically provided for otherwise, the provisions of the
|
||||
GNU General Public Licence Version 3 above shall be governed by and
|
||||
interpreted in accordance with English Law and the parties submit to the
|
||||
exclusive jurisdiction of the English Courts.
|
||||
|
||||
17
build_package.bat
Normal file
17
build_package.bat
Normal file
@ -0,0 +1,17 @@
|
||||
cd src
|
||||
msbuild olympus.sln /t:Rebuild /p:Configuration=Release
|
||||
cd ..
|
||||
cd client
|
||||
call npm install
|
||||
rmdir /s /q "hgt"
|
||||
call npm run emit-declarations
|
||||
call npm run build
|
||||
cd "plugins\controltips"
|
||||
call npm run build
|
||||
cd "..\.."
|
||||
cd "plugins\databasemanager"
|
||||
call npm run build
|
||||
cd "..\.."
|
||||
call npm prune --production
|
||||
cd ..
|
||||
call "C:\Program Files (x86)\Inno Setup 6\iscc.exe" "installer\olympus.iss"
|
||||
2
client/.vscode/tasks.json
vendored
2
client/.vscode/tasks.json
vendored
@ -6,7 +6,7 @@
|
||||
{
|
||||
"label": "server",
|
||||
"type": "shell",
|
||||
"command": "npm run start",
|
||||
"command": "npm run debug",
|
||||
"isBackground": true
|
||||
}
|
||||
]
|
||||
|
||||
20
client/@types/olympus/index.d.ts
vendored
20
client/@types/olympus/index.d.ts
vendored
@ -151,8 +151,8 @@ declare module "constants/constants" {
|
||||
export const mapLayers: {
|
||||
"ArcGIS Satellite": {
|
||||
urlTemplate: string;
|
||||
maxZoom: number;
|
||||
minZoom: number;
|
||||
maxZoom: number;
|
||||
attribution: string;
|
||||
};
|
||||
"USGS Topo": {
|
||||
@ -222,8 +222,8 @@ declare module "constants/constants" {
|
||||
position = 13,
|
||||
speed = 14,
|
||||
heading = 15,
|
||||
isTanker = 16,
|
||||
isAWACS = 17,
|
||||
isActiveTanker = 16,
|
||||
isActiveAWACS = 17,
|
||||
onOff = 18,
|
||||
followRoads = 19,
|
||||
fuel = 20,
|
||||
@ -499,8 +499,8 @@ declare module "interfaces" {
|
||||
position: LatLng;
|
||||
speed: number;
|
||||
heading: number;
|
||||
isTanker: boolean;
|
||||
isAWACS: boolean;
|
||||
isActiveTanker: boolean;
|
||||
isActiveAWACS: boolean;
|
||||
onOff: boolean;
|
||||
followRoads: boolean;
|
||||
fuel: number;
|
||||
@ -1037,8 +1037,8 @@ declare module "unit/unit" {
|
||||
getPosition(): LatLng;
|
||||
getSpeed(): number;
|
||||
getHeading(): number;
|
||||
getIsTanker(): boolean;
|
||||
getIsAWACS(): boolean;
|
||||
getIsActiveTanker(): boolean;
|
||||
getIsActiveAWACS(): boolean;
|
||||
getOnOff(): boolean;
|
||||
getFollowRoads(): boolean;
|
||||
getFuel(): number;
|
||||
@ -1097,6 +1097,8 @@ declare module "unit/unit" {
|
||||
isInViewport(): boolean;
|
||||
canTargetPoint(): boolean;
|
||||
canRearm(): boolean;
|
||||
isTanker(): boolean;
|
||||
isAWACS(): boolean;
|
||||
/********************** Unit commands *************************/
|
||||
addDestination(latlng: L.LatLng): void;
|
||||
clearDestinations(): void;
|
||||
@ -1121,7 +1123,7 @@ declare module "unit/unit" {
|
||||
setOperateAs(operateAs: string): void;
|
||||
delete(explosion: boolean, immediate: boolean): void;
|
||||
refuel(): void;
|
||||
setAdvancedOptions(isTanker: boolean, isAWACS: boolean, TACAN: TACAN, radio: Radio, generalSettings: GeneralSettings): void;
|
||||
setAdvancedOptions(isActiveTanker: boolean, isActiveAWACS: boolean, TACAN: TACAN, radio: Radio, generalSettings: GeneralSettings): void;
|
||||
bombPoint(latlng: LatLng): void;
|
||||
carpetBomb(latlng: LatLng): void;
|
||||
bombBuilding(latlng: LatLng): void;
|
||||
@ -2064,7 +2066,7 @@ declare module "server/servermanager" {
|
||||
scenicAAA(ID: number, coalition: string, callback?: CallableFunction): void;
|
||||
missOnPurpose(ID: number, coalition: string, callback?: CallableFunction): void;
|
||||
landAtPoint(ID: number, latlng: LatLng, callback?: CallableFunction): void;
|
||||
setAdvacedOptions(ID: number, isTanker: boolean, isAWACS: boolean, TACAN: TACAN, radio: Radio, generalSettings: GeneralSettings, callback?: CallableFunction): void;
|
||||
setAdvacedOptions(ID: number, isActiveTanker: boolean, isActiveAWACS: boolean, TACAN: TACAN, radio: Radio, generalSettings: GeneralSettings, callback?: CallableFunction): void;
|
||||
setCommandModeOptions(restrictSpawns: boolean, restrictToCoalition: boolean, spawnPoints: {
|
||||
blue: number;
|
||||
red: number;
|
||||
|
||||
5578
client/package-lock.json
generated
5578
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,12 +5,15 @@
|
||||
"version": "v0.4.5-alpha",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "browserify .\\src\\index.ts --debug -o .\\public\\javascripts\\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] && copy.bat",
|
||||
"emit-declarations": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --outfile ./@types/olympus/index.d.ts",
|
||||
"copy": "copy.bat",
|
||||
"start": "npm run copy & concurrently --kill-others \"npm run watch\" \"nodemon --ignore ./public/databases/ ./bin/www\"",
|
||||
"start": "node ./bin/www",
|
||||
"debug": "npm run copy & concurrently --kill-others \"npm run watch\" \"nodemon --ignore ./public/databases/ ./bin/www\"",
|
||||
"watch": "watchify .\\src\\index.ts --debug -o .\\public\\javascripts\\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ]"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/turf": "^6.5.0",
|
||||
"body-parser": "^1.20.2",
|
||||
"cookie-parser": "~1.4.4",
|
||||
"debug": "~2.6.9",
|
||||
@ -25,7 +28,6 @@
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.21.4",
|
||||
"@tanem/svg-injector": "^10.1.55",
|
||||
"@turf/turf": "^6.5.0",
|
||||
"@types/formatcoords": "^1.1.0",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"@types/leaflet": "^1.9.0",
|
||||
|
||||
@ -273,6 +273,11 @@ _ControlTipsPlugin_element = new WeakMap(), _ControlTipsPlugin_app = new WeakMap
|
||||
"showIfUnitSelected": true,
|
||||
"minSelectedUnits": 2
|
||||
},
|
||||
{
|
||||
"key": `[Num 1-9]`,
|
||||
"action": "Add to hotgroup",
|
||||
"showIfUnitSelected": true
|
||||
},
|
||||
{
|
||||
"key": "CTRL",
|
||||
"action": "<em> ... more</em>",
|
||||
@ -292,6 +297,16 @@ _ControlTipsPlugin_element = new WeakMap(), _ControlTipsPlugin_app = new WeakMap
|
||||
"showIfUnitSelected": true,
|
||||
"minSelectedUnits": 2,
|
||||
"unitsMustBeControlled": true
|
||||
}, {
|
||||
"key": `[Num 1-9]`,
|
||||
"action": "Add hotgroup to selection",
|
||||
"callback": (tip) => {
|
||||
return (Object.values(__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getUnitsManager().getUnits()).some((unit) => {
|
||||
return unit.getHotgroup();
|
||||
}));
|
||||
},
|
||||
"showIfUnitSelected": true,
|
||||
"minSelectedUnits": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -351,6 +366,9 @@ _ControlTipsPlugin_element = new WeakMap(), _ControlTipsPlugin_app = new WeakMap
|
||||
if (!tipsIncludesActiveMouseover && typeof tip.mouseoverSelector === "string") {
|
||||
return false;
|
||||
}
|
||||
if (typeof tip.callback === "function" && !tip.callback(tip)) {
|
||||
return false;
|
||||
}
|
||||
element.innerHTML += `<div><span class="key">${tip.key}</span><span class="action">${tip.action}</span></div>`;
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import { OlympusPlugin } from "interfaces";
|
||||
import { OlympusApp } from "olympusapp";
|
||||
import { Unit } from "unit/unit";
|
||||
|
||||
|
||||
const SHOW_CONTROL_TIPS = "Show control tips"
|
||||
@ -279,6 +281,11 @@ export class ControlTipsPlugin implements OlympusPlugin {
|
||||
"showIfUnitSelected": true,
|
||||
"minSelectedUnits": 2
|
||||
},
|
||||
{
|
||||
"key": `[Num 1-9]`,
|
||||
"action": "Add to hotgroup",
|
||||
"showIfUnitSelected": true
|
||||
},
|
||||
{
|
||||
"key": "CTRL",
|
||||
"action": "<em> ... more</em>",
|
||||
@ -298,6 +305,16 @@ export class ControlTipsPlugin implements OlympusPlugin {
|
||||
"showIfUnitSelected": true,
|
||||
"minSelectedUnits": 2,
|
||||
"unitsMustBeControlled": true
|
||||
}, {
|
||||
"key": `[Num 1-9]`,
|
||||
"action": "Add hotgroup to selection",
|
||||
"callback": ( tip:object ) => {
|
||||
return (Object.values<Unit>( this.#app.getUnitsManager().getUnits() ).some( ( unit:Unit ) => {
|
||||
return unit.getAlive() && unit.getControlled() && unit.getHotgroup();
|
||||
}));
|
||||
},
|
||||
"showIfUnitSelected": true,
|
||||
"minSelectedUnits": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -375,6 +392,10 @@ export class ControlTipsPlugin implements OlympusPlugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( typeof tip.callback === "function" && !tip.callback( tip ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
element.innerHTML += `<div><span class="key">${tip.key}</span><span class="action">${tip.action}</span></div>`;
|
||||
|
||||
});
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
mkdir .\\..\\..\\public\\plugins\\databasemanager
|
||||
|
||||
copy .\\index.js .\\..\\..\\public\\plugins\\databasemanager\\index.js
|
||||
copy .\\plugin.json .\\..\\..\\public\\plugins\\databasemanager\\plugin.json
|
||||
copy .\\style.css .\\..\\..\\public\\plugins\\databasemanager\\style.css
|
||||
@ -38,7 +38,7 @@ class AirUnitEditor extends uniteditor_1.UnitEditor {
|
||||
* @param blueprint The blueprint to edit
|
||||
*/
|
||||
setBlueprint(blueprint) {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
this.blueprint = blueprint;
|
||||
if (this.blueprint !== null) {
|
||||
this.contentDiv2.replaceChildren();
|
||||
@ -48,23 +48,24 @@ class AirUnitEditor extends uniteditor_1.UnitEditor {
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Name", blueprint.name, "text", (value) => { blueprint.name = value; }, true);
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Label", blueprint.label, "text", (value) => { blueprint.label = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Short label", blueprint.shortLabel, "text", (value) => { blueprint.shortLabel = value; });
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Coalition", blueprint.coalition, ["", "blue", "red"]);
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"]);
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Coalition", blueprint.coalition, ["", "blue", "red"], (value) => { blueprint.coalition = value; });
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"], (value) => { blueprint.era = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Filename", (_a = blueprint.filename) !== null && _a !== void 0 ? _a : "", "text", (value) => { blueprint.filename = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Cost", (_b = String(blueprint.cost)) !== null && _b !== void 0 ? _b : "", "number", (value) => { blueprint.cost = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Rufels from", (_c = String(blueprint.refuelsFrom)) !== null && _c !== void 0 ? _c : "", "text", (value) => { blueprint.refuelsFrom = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Refuelling type", (_d = String(blueprint.refuellingType)) !== null && _d !== void 0 ? _d : "", "text", (value) => { blueprint.refuellingType = value; });
|
||||
(0, utils_1.addCheckboxInput)(this.contentDiv2, "Can target point", (_c = blueprint.canTargetPoint) !== null && _c !== void 0 ? _c : false, (value) => { blueprint.canTargetPoint = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Description", (_d = blueprint.description) !== null && _d !== void 0 ? _d : "", "text", (value) => { blueprint.description = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Abilities", (_e = blueprint.abilities) !== null && _e !== void 0 ? _e : "", "text", (value) => { blueprint.abilities = value; });
|
||||
/* Add a scrollable list of loadouts that the user can edit */
|
||||
var title = document.createElement("label");
|
||||
title.innerText = "Loadouts";
|
||||
this.contentDiv2.appendChild(title);
|
||||
(0, utils_1.addLoadoutsScroll)(this.contentDiv2, (_e = blueprint.loadouts) !== null && _e !== void 0 ? _e : [], (loadout) => {
|
||||
(0, utils_1.addLoadoutsScroll)(this.contentDiv2, (_f = blueprint.loadouts) !== null && _f !== void 0 ? _f : [], (loadout) => {
|
||||
var _a, _b;
|
||||
(_a = __classPrivateFieldGet(this, _AirUnitEditor_loadoutEditor, "f")) === null || _a === void 0 ? void 0 : _a.setLoadout(loadout);
|
||||
(_b = __classPrivateFieldGet(this, _AirUnitEditor_loadoutEditor, "f")) === null || _b === void 0 ? void 0 : _b.show();
|
||||
});
|
||||
(0, utils_1.addNewElementInput)(this.contentDiv2, (ev, input) => { this.addLoadout(input.value); });
|
||||
(_f = __classPrivateFieldGet(this, _AirUnitEditor_loadoutEditor, "f")) === null || _f === void 0 ? void 0 : _f.hide();
|
||||
(_g = __classPrivateFieldGet(this, _AirUnitEditor_loadoutEditor, "f")) === null || _g === void 0 ? void 0 : _g.hide();
|
||||
}
|
||||
}
|
||||
/** Add a new empty blueprint
|
||||
@ -79,7 +80,8 @@ class AirUnitEditor extends uniteditor_1.UnitEditor {
|
||||
label: "",
|
||||
shortLabel: "",
|
||||
era: "",
|
||||
loadouts: []
|
||||
loadouts: [],
|
||||
enabled: true
|
||||
};
|
||||
this.show();
|
||||
this.setBlueprint(this.database.blueprints[key]);
|
||||
@ -97,7 +99,8 @@ class AirUnitEditor extends uniteditor_1.UnitEditor {
|
||||
code: "",
|
||||
fuel: 1,
|
||||
items: [],
|
||||
roles: []
|
||||
roles: [],
|
||||
enabled: true
|
||||
});
|
||||
this.setBlueprint(this.blueprint);
|
||||
}
|
||||
@ -505,7 +508,7 @@ class GroundUnitEditor extends uniteditor_1.UnitEditor {
|
||||
* @param blueprint The blueprint to edit
|
||||
*/
|
||||
setBlueprint(blueprint) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
||||
__classPrivateFieldSet(this, _GroundUnitEditor_blueprint, blueprint, "f");
|
||||
if (__classPrivateFieldGet(this, _GroundUnitEditor_blueprint, "f") !== null) {
|
||||
this.contentDiv2.replaceChildren();
|
||||
@ -516,16 +519,20 @@ class GroundUnitEditor extends uniteditor_1.UnitEditor {
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Label", blueprint.label, "text", (value) => { blueprint.label = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Short label", blueprint.shortLabel, "text", (value) => { blueprint.shortLabel = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Type", (_a = blueprint.type) !== null && _a !== void 0 ? _a : "", "text", (value) => { blueprint.type = value; });
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Coalition", blueprint.coalition, ["", "blue", "red"]);
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"]);
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Coalition", blueprint.coalition, ["", "blue", "red"], (value) => { blueprint.coalition = value; });
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"], (value) => { blueprint.era = value; });
|
||||
//addStringInput(this.contentDiv2, "Filename", blueprint.filename?? "", "text", (value: string) => {blueprint.filename = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Cost", (_b = String(blueprint.cost)) !== null && _b !== void 0 ? _b : "", "number", (value) => { blueprint.cost = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Acquisition range [NM]", (_c = String(blueprint.acquisitionRange)) !== null && _c !== void 0 ? _c : "", "number", (value) => { blueprint.acquisitionRange = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Engagement range [NM]", (_d = String(blueprint.engagementRange)) !== null && _d !== void 0 ? _d : "", "number", (value) => { blueprint.engagementRange = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Acquisition range [m]", (_c = String(blueprint.acquisitionRange)) !== null && _c !== void 0 ? _c : "", "number", (value) => { blueprint.acquisitionRange = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Engagement range [m]", (_d = String(blueprint.engagementRange)) !== null && _d !== void 0 ? _d : "", "number", (value) => { blueprint.engagementRange = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Barrel height [m]", (_e = String(blueprint.barrelHeight)) !== null && _e !== void 0 ? _e : "", "number", (value) => { blueprint.barrelHeight = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Muzzle velocity [m/s]", (_f = String(blueprint.muzzleVelocity)) !== null && _f !== void 0 ? _f : "", "number", (value) => { blueprint.muzzleVelocity = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Aim time [s]", (_g = String(blueprint.aimTime)) !== null && _g !== void 0 ? _g : "", "number", (value) => { blueprint.aimTime = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Burst quantity", (_h = String(blueprint.shotsToFire)) !== null && _h !== void 0 ? _h : "", "number", (value) => { blueprint.shotsToFire = Math.round(parseFloat(value)); });
|
||||
(0, utils_1.addCheckboxInput)(this.contentDiv2, "Can target point", (_j = blueprint.canTargetPoint) !== null && _j !== void 0 ? _j : false, (value) => { blueprint.canTargetPoint = value; });
|
||||
(0, utils_1.addCheckboxInput)(this.contentDiv2, "Can rearm", (_k = blueprint.canRearm) !== null && _k !== void 0 ? _k : false, (value) => { blueprint.canRearm = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Description", (_l = blueprint.description) !== null && _l !== void 0 ? _l : "", "text", (value) => { blueprint.description = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Abilities", (_m = blueprint.abilities) !== null && _m !== void 0 ? _m : "", "text", (value) => { blueprint.abilities = value; });
|
||||
}
|
||||
}
|
||||
/** Add a new empty blueprint
|
||||
@ -539,7 +546,8 @@ class GroundUnitEditor extends uniteditor_1.UnitEditor {
|
||||
coalition: "",
|
||||
label: "",
|
||||
shortLabel: "",
|
||||
era: ""
|
||||
era: "",
|
||||
enabled: true
|
||||
};
|
||||
this.show();
|
||||
this.setBlueprint(this.database.blueprints[key]);
|
||||
@ -608,6 +616,7 @@ class LoadoutEditor {
|
||||
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); });
|
||||
(0, utils_1.addLoadoutItemsEditor)(__classPrivateFieldGet(this, _LoadoutEditor_contentDiv, "f"), __classPrivateFieldGet(this, _LoadoutEditor_loadout, "f"));
|
||||
}
|
||||
}
|
||||
@ -664,8 +673,8 @@ class NavyUnitEditor extends uniteditor_1.UnitEditor {
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Label", blueprint.label, "text", (value) => { blueprint.label = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Short label", blueprint.shortLabel, "text", (value) => { blueprint.shortLabel = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Type", (_a = blueprint.type) !== null && _a !== void 0 ? _a : "", "text", (value) => { blueprint.type = value; });
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Coalition", blueprint.coalition, ["", "blue", "red"]);
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"]);
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Coalition", blueprint.coalition, ["", "blue", "red"], (value) => { blueprint.coalition = value; });
|
||||
(0, utils_1.addDropdownInput)(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"], (value) => { blueprint.era = value; });
|
||||
//addStringInput(this.contentDiv2, "Filename", blueprint.filename?? "", "text", (value: string) => {blueprint.filename = value; });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Cost", (_b = String(blueprint.cost)) !== null && _b !== void 0 ? _b : "", "number", (value) => { blueprint.cost = parseFloat(value); });
|
||||
(0, utils_1.addStringInput)(this.contentDiv2, "Barrel height [m]", (_c = String(blueprint.barrelHeight)) !== null && _c !== void 0 ? _c : "", "number", (value) => { blueprint.barrelHeight = parseFloat(value); });
|
||||
@ -683,7 +692,8 @@ class NavyUnitEditor extends uniteditor_1.UnitEditor {
|
||||
coalition: "",
|
||||
label: "",
|
||||
shortLabel: "",
|
||||
era: ""
|
||||
era: "",
|
||||
enabled: true
|
||||
};
|
||||
this.show();
|
||||
this.setBlueprint(this.database.blueprints[key]);
|
||||
@ -733,7 +743,7 @@ class UnitEditor {
|
||||
* @param database The database that the editor will operate on
|
||||
*/
|
||||
setDatabase(database) {
|
||||
this.database = JSON.parse(JSON.stringify(database));
|
||||
this.database = JSON.parse(JSON.stringify({ blueprints: database.getBlueprints(true) }));
|
||||
}
|
||||
/** Show the editor
|
||||
*
|
||||
@ -780,7 +790,7 @@ exports.UnitEditor = UnitEditor;
|
||||
},{"./utils":8}],8:[function(require,module,exports){
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addLoadoutsScroll = exports.addBlueprintsScroll = exports.addNewElementInput = exports.addLoadoutItemsEditor = exports.addDropdownInput = exports.addStringInput = void 0;
|
||||
exports.stringToArray = exports.arrayToString = exports.addLoadoutsScroll = exports.addBlueprintsScroll = exports.addNewElementInput = exports.addLoadoutItemsEditor = exports.addCheckboxInput = exports.addDropdownInput = exports.addStringInput = void 0;
|
||||
/** This file contains a set of utility functions that are reused in the various editors and allows to declutter the classes
|
||||
*
|
||||
*/
|
||||
@ -818,7 +828,7 @@ exports.addStringInput = addStringInput;
|
||||
* @param value The initial value of the input
|
||||
* @param options The dropdown options
|
||||
*/
|
||||
function addDropdownInput(div, key, value, options) {
|
||||
function addDropdownInput(div, key, value, options, callback, disabled) {
|
||||
var row = document.createElement("div");
|
||||
var dt = document.createElement("dt");
|
||||
var dd = document.createElement("dd");
|
||||
@ -831,6 +841,8 @@ function addDropdownInput(div, key, value, options) {
|
||||
select.appendChild(el);
|
||||
});
|
||||
select.value = value;
|
||||
select.disabled = disabled !== null && disabled !== void 0 ? disabled : false;
|
||||
select.onchange = () => callback(select.value);
|
||||
dd.appendChild(select);
|
||||
row.appendChild(dt);
|
||||
row.appendChild(dd);
|
||||
@ -838,6 +850,31 @@ function addDropdownInput(div, key, value, options) {
|
||||
div.appendChild(row);
|
||||
}
|
||||
exports.addDropdownInput = addDropdownInput;
|
||||
/** Add a checkbox input in the form of String: [ value ]
|
||||
*
|
||||
* @param div The HTMLElement that will contain the input
|
||||
* @param key The key of the input, which will be used as label
|
||||
* @param value The initial value of the input
|
||||
* @param callback Callback called when the user enters a new value
|
||||
* @param disabled If true, the input will be disabled and read only
|
||||
*/
|
||||
function addCheckboxInput(div, key, value, callback, disabled) {
|
||||
var row = document.createElement("div");
|
||||
var dt = document.createElement("dt");
|
||||
var dd = document.createElement("dd");
|
||||
dt.innerText = key;
|
||||
var input = document.createElement("input");
|
||||
input.checked = value;
|
||||
input.type = "checkbox";
|
||||
input.disabled = disabled !== null && disabled !== void 0 ? disabled : false;
|
||||
input.onchange = () => callback(input.checked);
|
||||
dd.appendChild(input);
|
||||
row.appendChild(dt);
|
||||
row.appendChild(dd);
|
||||
row.classList.add("input-row");
|
||||
div.appendChild(row);
|
||||
}
|
||||
exports.addCheckboxInput = addCheckboxInput;
|
||||
/** Create a loadout items editor. This editor allows to add or remove loadout items, as well as changing their name and quantity
|
||||
*
|
||||
* @param div The HTMLElement that will contain the editor
|
||||
@ -847,6 +884,7 @@ function addLoadoutItemsEditor(div, loadout) {
|
||||
var itemsEl = document.createElement("div");
|
||||
itemsEl.classList.add("dm-scroll-container", "dm-items-container");
|
||||
/* Create a row for each loadout item to allow and change the name and quantity of the item itself */
|
||||
loadout.items.sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }));
|
||||
loadout.items.forEach((item, index) => {
|
||||
var rowDiv = document.createElement("div");
|
||||
var nameLabel = document.createElement("label");
|
||||
@ -922,13 +960,21 @@ function addBlueprintsScroll(div, database, callback) {
|
||||
scrollDiv.classList.add("dm-scroll-container");
|
||||
if (database !== null) {
|
||||
var blueprints = database.blueprints;
|
||||
for (let key in Object.keys(blueprints).sort()) {
|
||||
for (let key of Object.keys(blueprints).sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'base' }))) {
|
||||
var rowDiv = document.createElement("div");
|
||||
scrollDiv.appendChild(rowDiv);
|
||||
var text = document.createElement("label");
|
||||
text.textContent = key;
|
||||
text.onclick = () => callback(key);
|
||||
rowDiv.appendChild(text);
|
||||
let checkbox = document.createElement("input");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.checked = blueprints[key].enabled;
|
||||
checkbox.onclick = () => {
|
||||
console.log(checkbox.checked);
|
||||
blueprints[key].enabled = checkbox.checked;
|
||||
};
|
||||
rowDiv.appendChild(checkbox);
|
||||
/* This button allows to remove an element from the list. It requires a refresh. */
|
||||
var button = document.createElement("button");
|
||||
button.innerText = "X";
|
||||
@ -951,6 +997,7 @@ exports.addBlueprintsScroll = addBlueprintsScroll;
|
||||
function addLoadoutsScroll(div, loadouts, callback) {
|
||||
var loadoutsEl = document.createElement("div");
|
||||
loadoutsEl.classList.add("dm-scroll-container", "dm-loadout-container");
|
||||
loadouts.sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }));
|
||||
loadouts.forEach((loadout, index) => {
|
||||
var rowDiv = document.createElement("div");
|
||||
loadoutsEl.appendChild(rowDiv);
|
||||
@ -960,6 +1007,14 @@ function addLoadoutsScroll(div, loadouts, callback) {
|
||||
rowDiv.appendChild(text);
|
||||
/* The "Empty loadout" can not be removed */
|
||||
if (loadout.name !== "Empty loadout") {
|
||||
let checkbox = document.createElement("input");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.checked = loadout.enabled;
|
||||
checkbox.onclick = () => {
|
||||
console.log(checkbox.checked);
|
||||
loadout.enabled = checkbox.checked;
|
||||
};
|
||||
rowDiv.appendChild(checkbox);
|
||||
/* This button allows to remove an element from the list. It requires a refresh. */
|
||||
var button = document.createElement("button");
|
||||
button.innerText = "X";
|
||||
@ -973,5 +1028,32 @@ function addLoadoutsScroll(div, loadouts, callback) {
|
||||
div.appendChild(loadoutsEl);
|
||||
}
|
||||
exports.addLoadoutsScroll = addLoadoutsScroll;
|
||||
/** Converts an array of string into a single string like [val1, val2, val3]
|
||||
*
|
||||
* @param array The input array of strings
|
||||
* @returns The string
|
||||
*/
|
||||
function arrayToString(array) {
|
||||
var value = "[";
|
||||
var firstRole = true;
|
||||
array.forEach((role) => {
|
||||
value += firstRole ? "" : ", ";
|
||||
firstRole = false;
|
||||
value += role;
|
||||
});
|
||||
value += "]";
|
||||
return value;
|
||||
}
|
||||
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;
|
||||
}
|
||||
exports.stringToArray = stringToArray;
|
||||
|
||||
},{}]},{},[4]);
|
||||
|
||||
@ -264,24 +264,10 @@ export function addLoadoutsScroll(div: HTMLElement, loadouts: LoadoutBlueprint[]
|
||||
* @returns The string
|
||||
*/
|
||||
export function arrayToString(array: string[]) {
|
||||
var value = "[";
|
||||
var firstRole = true;
|
||||
array.forEach((role: string) => {
|
||||
value += firstRole? "": ", ";
|
||||
firstRole = false;
|
||||
value += role;
|
||||
})
|
||||
value += "]";
|
||||
return value;
|
||||
return "[" + array.join( ", " ) + "]";
|
||||
}
|
||||
|
||||
|
||||
export function stringToArray(input: string) {
|
||||
input = input.replace("[", "").replace("]", "");
|
||||
var values = input.split(",");
|
||||
var result: string[] = [];
|
||||
values.forEach((value: string) => {
|
||||
result.push(value.trim());
|
||||
})
|
||||
return result;
|
||||
return input.match( /(\w)+/g );
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
copy .\\node_modules\\leaflet\\dist\\leaflet.css .\\public\\stylesheets\\leaflet\\leaflet.css
|
||||
copy .\\node_modules\\leaflet.nauticscale\\dist\\leaflet.nauticscale.js .\\public\\javascripts\\leaflet.nauticscale.js
|
||||
@ -41,8 +41,7 @@
|
||||
"code": "AGM-65D*2, AGM-65H*2, CBU-97*2, CBU-87*2, TGP, ECM, AIM-9*2",
|
||||
"name": "AGM-65D*2, AGM-65H*2, CBU-97*2, CBU-87*2, TGP, ECM, AIM-9*2",
|
||||
"roles": [
|
||||
"CAS",
|
||||
"test"
|
||||
"CAS"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -3543,16 +3542,16 @@
|
||||
"quantity": 2
|
||||
},
|
||||
{
|
||||
"name": "SUU-25 x 8 LUU-2 - Target Marker Flares",
|
||||
"quantity": 2
|
||||
"name": "GAU 12 Gunpod w/SAPHEI-T",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "LAU-68 pod - 7 x 2.75\" Hydra, UnGd Rkts M156, Wht Phos",
|
||||
"quantity": 2
|
||||
},
|
||||
{
|
||||
"name": "GAU 12 Gunpod w/SAPHEI-T",
|
||||
"quantity": 1
|
||||
"name": "SUU-25 x 8 LUU-2 - Target Marker Flares",
|
||||
"quantity": 2
|
||||
}
|
||||
],
|
||||
"enabled": true,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -334,7 +334,14 @@
|
||||
"TUR"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 2 crew attack helicopter. Cobra",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
},
|
||||
"AH-64D_BLK_II": {
|
||||
"name": "AH-64D_BLK_II",
|
||||
@ -727,7 +734,14 @@
|
||||
"GRC"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 2 crew attack helicopter. Apache",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
},
|
||||
"Ka-50_3": {
|
||||
"name": "Ka-50_3",
|
||||
@ -1266,7 +1280,14 @@
|
||||
"RUS"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 1 crew attack helicopter. Blackshark",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
},
|
||||
"Mi-24P": {
|
||||
"name": "Mi-24P",
|
||||
@ -1745,7 +1766,14 @@
|
||||
"RUS"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 2 crew attack helicopter. Hind",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
},
|
||||
"Mi-26": {
|
||||
"name": "Mi-26",
|
||||
@ -1811,7 +1839,14 @@
|
||||
"DZA"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 5 crew transport helicopter. Halo",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
},
|
||||
"Mi-28N": {
|
||||
"name": "Mi-28N",
|
||||
@ -2288,7 +2323,14 @@
|
||||
"RUS"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 2 crew attack helicopter. Havoc",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
},
|
||||
"Mi-8MT": {
|
||||
"name": "Mi-8MT",
|
||||
@ -2798,7 +2840,14 @@
|
||||
"RUS"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 3 crew transport helicopter. Hip",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
},
|
||||
"SA342L": {
|
||||
"name": "SA342L",
|
||||
@ -3025,7 +3074,14 @@
|
||||
"SRB"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "1 engine, 2 crew scout helicopter. Gazelle",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
},
|
||||
"SA342M": {
|
||||
"name": "SA342M",
|
||||
@ -3282,7 +3338,14 @@
|
||||
"SRB"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "1 engine, 2 crew scout helicopter. Gazelle",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
},
|
||||
"SA342Mistral": {
|
||||
"name": "SA342Mistral",
|
||||
@ -3475,7 +3538,14 @@
|
||||
"CYP"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "1 engine, 2 crew scout helicopter. Gazelle",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
},
|
||||
"SH-60B": {
|
||||
"name": "SH-60B",
|
||||
@ -3485,7 +3555,24 @@
|
||||
"shortLabel": "S60",
|
||||
"loadouts": [
|
||||
{
|
||||
"items": [],
|
||||
"items": [
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
}
|
||||
],
|
||||
"enabled": true,
|
||||
"code": "",
|
||||
"name": "Empty loadout",
|
||||
@ -3498,6 +3585,30 @@
|
||||
{
|
||||
"name": "AGM-119B Penguin ASM",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"quantity": 1
|
||||
}
|
||||
],
|
||||
"enabled": true,
|
||||
@ -3506,6 +3617,20 @@
|
||||
"roles": [
|
||||
"Antiship Strike"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "asd",
|
||||
"code": "",
|
||||
"fuel": 1,
|
||||
"items": [],
|
||||
"roles": []
|
||||
},
|
||||
{
|
||||
"name": "asd",
|
||||
"code": "",
|
||||
"fuel": 1,
|
||||
"items": [],
|
||||
"roles": []
|
||||
}
|
||||
],
|
||||
"filename": "uh-60.png",
|
||||
@ -3527,7 +3652,14 @@
|
||||
"GRC"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 3 crew transport helicopter. Seahawk",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
},
|
||||
"UH-1H": {
|
||||
"name": "UH-1H",
|
||||
@ -3811,7 +3943,14 @@
|
||||
"USA"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 2 crew transport helicopter. Huey",
|
||||
"abilities": "",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
},
|
||||
"UH-60A": {
|
||||
"name": "UH-60A",
|
||||
@ -3866,6 +4005,13 @@
|
||||
"TUR"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Helicopter",
|
||||
"description": "2 engine, 3 crew transport helicopter. Blackhawk",
|
||||
"acquisitionRange": "",
|
||||
"engagementRange": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -140,6 +140,16 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#slow-delete-popup {
|
||||
align-self: center;
|
||||
display:flex;
|
||||
justify-self: center;
|
||||
position: absolute;
|
||||
width: fit-content;
|
||||
height: fit-content;
|
||||
z-index: 9999999999;
|
||||
}
|
||||
|
||||
#log-panel {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
|
||||
@ -97,14 +97,13 @@
|
||||
}
|
||||
|
||||
#loadout-items {
|
||||
margin-right: 20px;
|
||||
align-self: center;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
row-gap: 8px;
|
||||
column-gap: 8px;
|
||||
max-height: 90px;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
max-height: 108px;
|
||||
padding-right:40px;
|
||||
row-gap: 6px;
|
||||
}
|
||||
|
||||
#loadout-items>* {
|
||||
@ -122,7 +121,7 @@
|
||||
display: flex;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
padding: 4px 6px;
|
||||
padding: 3px 4px;
|
||||
}
|
||||
|
||||
#loadout-items>*::after {
|
||||
@ -137,7 +136,7 @@
|
||||
#fuel-percentage {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
margin-top: auto;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
#fuel-percentage::before {
|
||||
|
||||
@ -699,7 +699,7 @@ nav.ol-panel> :last-child {
|
||||
overflow: hidden;
|
||||
width: 70%;
|
||||
max-width: 1200px;
|
||||
z-index: 99999;
|
||||
z-index: 999999;
|
||||
}
|
||||
|
||||
@media (min-width: 1700px) {
|
||||
@ -796,7 +796,7 @@ nav.ol-panel> :last-child {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
#authentication-form {
|
||||
@ -807,6 +807,7 @@ nav.ol-panel> :last-child {
|
||||
margin: 10px 0px;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
row-gap: 10px;
|
||||
}
|
||||
|
||||
#authentication-form>div {
|
||||
@ -1147,7 +1148,7 @@ dl.ol-data-grid dd {
|
||||
background-color: var(--background-slate-blue);
|
||||
color: white;
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
z-index: 999999;
|
||||
}
|
||||
|
||||
.ol-panel.ol-dialog {
|
||||
@ -1177,8 +1178,10 @@ dl.ol-data-grid dd {
|
||||
}
|
||||
|
||||
.ol-dialog-footer {
|
||||
align-content: center;
|
||||
border-top: 1px solid var(--background-grey);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding-top: 15px;
|
||||
row-gap: 10px;
|
||||
}
|
||||
|
||||
@ -104,26 +104,26 @@ export const mapBounds = {
|
||||
export const mapLayers = {
|
||||
"ArcGIS Satellite": {
|
||||
urlTemplate: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
|
||||
maxZoom: 20,
|
||||
minZoom: 1,
|
||||
maxZoom: 16,
|
||||
attribution: "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, GetApp().getMap()ping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
|
||||
},
|
||||
"USGS Topo": {
|
||||
urlTemplate: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}',
|
||||
minZoom: 1,
|
||||
maxZoom: 20,
|
||||
maxZoom: 16,
|
||||
attribution: 'Tiles courtesy of the <a href="https://usgs.gov/">U.S. Geological Survey</a>'
|
||||
},
|
||||
"OpenStreetMap Mapnik": {
|
||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
minZoom: 1,
|
||||
maxZoom: 19,
|
||||
maxZoom: 16,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
},
|
||||
"OPENVKarte": {
|
||||
urlTemplate: 'https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png',
|
||||
minZoom: 1,
|
||||
maxZoom: 18,
|
||||
maxZoom: 16,
|
||||
attribution: 'Map <a href="https://memomaps.de/">memomaps.de</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
},
|
||||
"Esri.DeLorme": {
|
||||
@ -135,7 +135,7 @@ export const mapLayers = {
|
||||
"CyclOSM": {
|
||||
urlTemplate: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
|
||||
minZoom: 1,
|
||||
maxZoom: 20,
|
||||
maxZoom: 16,
|
||||
attribution: '<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}
|
||||
}
|
||||
@ -209,4 +209,7 @@ export const MGRS_PRECISION_10KM = 2;
|
||||
export const MGRS_PRECISION_1KM = 3;
|
||||
export const MGRS_PRECISION_100M = 4;
|
||||
export const MGRS_PRECISION_10M = 5;
|
||||
export const MGRS_PRECISION_1M = 6;
|
||||
export const MGRS_PRECISION_1M = 6;
|
||||
|
||||
export const DELETE_CYCLE_TIME = 0.05;
|
||||
export const DELETE_SLOW_THRESHOLD = 50;
|
||||
@ -18,6 +18,7 @@ export class MapContextMenu extends ContextMenu {
|
||||
#groundUnitSpawnMenu: GroundUnitSpawnMenu;
|
||||
#navyUnitSpawnMenu: NavyUnitSpawnMenu;
|
||||
#coalitionArea: CoalitionArea | null = null;
|
||||
#selectedUnitCategory: string = "";
|
||||
|
||||
/**
|
||||
*
|
||||
@ -39,9 +40,10 @@ export class MapContextMenu extends ContextMenu {
|
||||
|
||||
/* Event listeners */
|
||||
document.addEventListener("mapContextMenuShow", (e: any) => {
|
||||
if (this.getVisibleSubMenu() !== e.detail.type)
|
||||
if (this.getVisibleSubMenu() !== e.detail.type) {
|
||||
this.#showSubMenu(e.detail.type);
|
||||
else
|
||||
this.#selectedUnitCategory = e.detail.type;
|
||||
} else
|
||||
this.#hideSubMenus(e.detail.type);
|
||||
});
|
||||
|
||||
@ -65,9 +67,9 @@ export class MapContextMenu extends ContextMenu {
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("commandModeOptionsChanged", (e: any) => {
|
||||
//this.#refreshOptions();
|
||||
});
|
||||
// document.addEventListener("commandModeOptionsChanged", (e: any) => {
|
||||
// //this.#refreshOptions();
|
||||
// });
|
||||
|
||||
this.#aircraftSpawnMenu.getContainer().addEventListener("resize", () => this.clip());
|
||||
this.#helicopterSpawnMenu.getContainer().addEventListener("resize", () => this.clip());
|
||||
|
||||
@ -36,8 +36,21 @@ export class Dropdown {
|
||||
return this.#container;
|
||||
}
|
||||
|
||||
setOptions(optionsList: string[], sortAlphabetically: boolean = true) {
|
||||
this.#optionsList = optionsList.sort();
|
||||
setOptions(optionsList: string[], sort:""|"string"|"number" = "string") {
|
||||
|
||||
if ( sort === "number" ) {
|
||||
this.#optionsList = optionsList.sort( (optionA:string, optionB:string) => {
|
||||
const a = parseInt( optionA );
|
||||
const b = parseInt( optionB );
|
||||
if ( a > b )
|
||||
return 1;
|
||||
else
|
||||
return ( b > a ) ? -1 : 0;
|
||||
});
|
||||
} else if ( sort === "string" ) {
|
||||
this.#optionsList = optionsList.sort();
|
||||
}
|
||||
|
||||
if (this.#optionsList.length == 0) {
|
||||
optionsList = ["No options available"]
|
||||
this.#value.innerText = "No options available";
|
||||
|
||||
@ -13,11 +13,8 @@ import { navyUnitDatabase } from "../unit/databases/navyunitdatabase";
|
||||
import { UnitSpawnOptions, UnitSpawnTable } from "../interfaces";
|
||||
|
||||
export class UnitSpawnMenu {
|
||||
#container: HTMLElement;
|
||||
#unitDatabase: UnitDatabase;
|
||||
#countryCodes: any;
|
||||
#orderByRole: boolean;
|
||||
spawnOptions: UnitSpawnOptions = {
|
||||
protected showRangeCircles: boolean = false;
|
||||
protected spawnOptions: UnitSpawnOptions = {
|
||||
roleType: "",
|
||||
name: "",
|
||||
latlng: new LatLng(0, 0),
|
||||
@ -30,6 +27,11 @@ export class UnitSpawnMenu {
|
||||
altitude: undefined
|
||||
};
|
||||
|
||||
#container: HTMLElement;
|
||||
#unitDatabase: UnitDatabase;
|
||||
#countryCodes: any;
|
||||
#orderByRole: boolean;
|
||||
|
||||
/* Controls */
|
||||
#unitRoleTypeDropdown: Dropdown;
|
||||
#unitLabelDropdown: Dropdown;
|
||||
@ -244,6 +246,10 @@ export class UnitSpawnMenu {
|
||||
return this.#container;
|
||||
}
|
||||
|
||||
getVisible() {
|
||||
return !this.getContainer().classList.contains( "hide" );
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.#deployUnitButtonEl.disabled = true;
|
||||
this.#unitRoleTypeDropdown.reset();
|
||||
@ -286,9 +292,17 @@ export class UnitSpawnMenu {
|
||||
|
||||
showCirclesPreviews() {
|
||||
this.clearCirclesPreviews();
|
||||
|
||||
if ( !this.showRangeCircles || this.spawnOptions.name === "" || !this.getVisible() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var acquisitionRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.acquisitionRange ?? 0;
|
||||
var engagementRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.engagementRange ?? 0;
|
||||
let acquisitionRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.acquisitionRange ?? 0;
|
||||
let engagementRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.engagementRange ?? 0;
|
||||
|
||||
if ( acquisitionRange === 0 && engagementRange === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.#acquisitionCircle.setRadius(acquisitionRange);
|
||||
this.#engagementCircle.setRadius(engagementRange);
|
||||
@ -343,10 +357,7 @@ export class UnitSpawnMenu {
|
||||
|
||||
setMaxUnitCount(maxUnitCount: number) {
|
||||
/* Create the unit count options */
|
||||
var countOptions: string[] = [];
|
||||
for (let i = 1; i <= maxUnitCount; i++)
|
||||
countOptions.push(i.toString());
|
||||
this.#unitCountDropdown.setOptions(countOptions);
|
||||
this.#unitCountDropdown.setOptions( [...Array(maxUnitCount).keys()].map( n => (n+1).toString() ), "number");
|
||||
this.#unitCountDropdown.selectValue(0);
|
||||
}
|
||||
|
||||
@ -572,6 +583,9 @@ export class HelicopterSpawnMenu extends UnitSpawnMenu {
|
||||
}
|
||||
|
||||
export class GroundUnitSpawnMenu extends UnitSpawnMenu {
|
||||
|
||||
protected showRangeCircles: boolean = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ID - the ID of the HTML element which will contain the context menu
|
||||
|
||||
19
client/src/dialog/dialog.ts
Normal file
19
client/src/dialog/dialog.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Panel } from "../panels/panel";
|
||||
|
||||
export class Dialog extends Panel {
|
||||
|
||||
constructor( element:string ) {
|
||||
super( element );
|
||||
}
|
||||
|
||||
hide() {
|
||||
super.hide();
|
||||
document.getElementById( "gray-out" )?.classList.toggle("hide", true);
|
||||
}
|
||||
|
||||
show() {
|
||||
super.show();
|
||||
document.getElementById( "gray-out" )?.classList.toggle("hide", false);
|
||||
}
|
||||
|
||||
}
|
||||
@ -94,7 +94,7 @@ export class Map extends L.Map {
|
||||
super(ID, {
|
||||
zoomSnap: 0,
|
||||
zoomDelta: 0.25,
|
||||
preferCanvas: false,
|
||||
preferCanvas: true,
|
||||
doubleClickZoom: false,
|
||||
zoomControl: false,
|
||||
boxZoom: false,
|
||||
@ -400,6 +400,7 @@ export class Map extends L.Map {
|
||||
this.options.scrollWheelZoom = undefined;
|
||||
this.#centerUnit = null;
|
||||
}
|
||||
this.#updateCursor();
|
||||
}
|
||||
|
||||
getCenterUnit() {
|
||||
@ -714,6 +715,8 @@ export class Map extends L.Map {
|
||||
#panToUnit(unit: Unit) {
|
||||
var unitPosition = new L.LatLng(unit.getPosition().lat, unit.getPosition().lng);
|
||||
this.setView(unitPosition, this.getZoom(), { animate: false });
|
||||
this.#updateCursor();
|
||||
this.#updateDestinationCursors();
|
||||
}
|
||||
|
||||
#getMinimapBoundaries() {
|
||||
|
||||
@ -37,6 +37,7 @@ export class OlympusApp {
|
||||
|
||||
/* Managers */
|
||||
#contextManager!: ContextManager;
|
||||
#dialogManager!: Manager;
|
||||
#missionManager: MissionManager | null = null;
|
||||
#panelsManager: Manager | null = null;
|
||||
#pluginsManager: PluginsManager | null = null;
|
||||
@ -52,6 +53,10 @@ export class OlympusApp {
|
||||
}
|
||||
|
||||
// TODO add checks on null
|
||||
getDialogManager() {
|
||||
return this.#dialogManager as Manager;
|
||||
}
|
||||
|
||||
getMap() {
|
||||
return this.#map as Map;
|
||||
}
|
||||
@ -178,15 +183,14 @@ export class OlympusApp {
|
||||
|
||||
this.#map = new Map('map-container');
|
||||
|
||||
this.#serverManager = new ServerManager();
|
||||
this.#unitsManager = new UnitsManager();
|
||||
this.#weaponsManager = new WeaponsManager();
|
||||
this.#missionManager = new MissionManager();
|
||||
|
||||
this.#panelsManager = new Manager();
|
||||
this.#popupsManager = new Manager();
|
||||
this.#serverManager = new ServerManager();
|
||||
this.#shortcutManager = new ShortcutManager();
|
||||
this.#toolbarsManager = new Manager();
|
||||
this.#unitsManager = new UnitsManager();
|
||||
this.#weaponsManager = new WeaponsManager();
|
||||
|
||||
// Panels
|
||||
this.getPanelsManager()
|
||||
@ -200,7 +204,8 @@ export class OlympusApp {
|
||||
.add("unitList", new UnitListPanel("unit-list-panel", "unit-list-panel-content"))
|
||||
|
||||
// Popups
|
||||
this.getPopupsManager().add("infoPopup", new Popup("info-popup"));
|
||||
this.getPopupsManager()
|
||||
.add("infoPopup", new Popup("info-popup"));
|
||||
|
||||
// Toolbars
|
||||
this.getToolbarsManager().add("primaryToolbar", new PrimaryToolbar("primary-toolbar"))
|
||||
@ -366,13 +371,13 @@ export class OlympusApp {
|
||||
"altKey": false,
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
if (ev.ctrlKey && ev.shiftKey)
|
||||
this.getUnitsManager().selectedUnitsAddToHotgroup(parseInt(ev.code.substring(5)));
|
||||
this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5)), false); // "Select hotgroup X in addition to any units already selected"
|
||||
else if (ev.ctrlKey && !ev.shiftKey)
|
||||
this.getUnitsManager().selectedUnitsSetHotgroup(parseInt(ev.code.substring(5)));
|
||||
this.getUnitsManager().selectedUnitsSetHotgroup(parseInt(ev.code.substring(5))); // "These selected units are hotgroup X (forget any previous membership)"
|
||||
else if (!ev.ctrlKey && ev.shiftKey)
|
||||
this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5)), false);
|
||||
this.getUnitsManager().selectedUnitsAddToHotgroup(parseInt(ev.code.substring(5))); // "Add (append) these units to hotgroup X (in addition to any existing members)"
|
||||
else
|
||||
this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5)));
|
||||
this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5))); // "Select hotgroup X, deselect any units not in it."
|
||||
},
|
||||
"code": code
|
||||
});
|
||||
|
||||
@ -42,8 +42,8 @@ export class HotgroupPanel extends Panel {
|
||||
|
||||
this.getElement().appendChild(el);
|
||||
|
||||
el.addEventListener("click", () => {
|
||||
getApp().getUnitsManager().selectUnitsByHotgroup(hotgroup);
|
||||
el.addEventListener("click", ( ev:MouseEvent ) => {
|
||||
getApp().getUnitsManager().selectUnitsByHotgroup(hotgroup, (!ev.ctrlKey));
|
||||
});
|
||||
|
||||
el.addEventListener("mouseover", () => {
|
||||
|
||||
@ -541,14 +541,15 @@ export class ServerManager {
|
||||
}
|
||||
|
||||
setConnected(newConnected: boolean) {
|
||||
if (this.#connected != newConnected)
|
||||
if (this.#connected != newConnected) {
|
||||
newConnected ? (getApp().getPopupsManager().get("infoPopup") as Popup).setText("Connected to DCS Olympus server") : (getApp().getPopupsManager().get("infoPopup") as Popup).setText("Disconnected from DCS Olympus server");
|
||||
this.#connected = newConnected;
|
||||
|
||||
if (this.#connected) {
|
||||
document.querySelector("#splash-screen")?.classList.add("hide");
|
||||
document.querySelector("#gray-out")?.classList.add("hide");
|
||||
if (newConnected) {
|
||||
document.getElementById("splash-screen")?.classList.add("hide");
|
||||
document.getElementById("gray-out")?.classList.add("hide");
|
||||
}
|
||||
}
|
||||
|
||||
this.#connected = newConnected;
|
||||
}
|
||||
|
||||
getConnected() {
|
||||
|
||||
@ -1361,7 +1361,7 @@ export class AirUnit extends Unit {
|
||||
if (getApp().getUnitsManager().getSelectedUnits().length == 1) {
|
||||
options["center-map"] = { text: "Center map", tooltip: "Center the map on the unit and follow it", type: "and" };
|
||||
} else {
|
||||
/* Provision */
|
||||
options["follow"] = { text: "Follow", tooltip: "Follow the unit at a user defined distance and position", type: "or" };
|
||||
}
|
||||
|
||||
options["refuel"] = { text: "Air to air refuel", tooltip: "Refuel units at the nearest AAR Tanker. If no tanker is available the unit will RTB.", type: "and" }; // TODO Add some way of knowing which aircraft can AAR
|
||||
|
||||
@ -4,7 +4,7 @@ import { Unit } from "./unit";
|
||||
import { bearingAndDistanceToLatLng, deg2rad, getGroundElevation, getUnitDatabaseByCategory, keyEventWasInInput, latLngToMercator, mToFt, mercatorToLatLng, msToKnots, polyContains, polygonArea, randomPointInPoly, randomUnitBlueprint } from "../other/utils";
|
||||
import { CoalitionArea } from "../map/coalitionarea/coalitionarea";
|
||||
import { groundUnitDatabase } from "./databases/groundunitdatabase";
|
||||
import { DataIndexes, GAME_MASTER, IADSDensities, IDLE, MOVE_UNIT } from "../constants/constants";
|
||||
import { DELETE_CYCLE_TIME, DELETE_SLOW_THRESHOLD, DataIndexes, GAME_MASTER, IADSDensities, IDLE, MOVE_UNIT } from "../constants/constants";
|
||||
import { DataExtractor } from "../server/dataextractor";
|
||||
import { citiesDatabase } from "./citiesDatabase";
|
||||
import { aircraftDatabase } from "./databases/aircraftdatabase";
|
||||
@ -14,35 +14,40 @@ import { TemporaryUnitMarker } from "../map/markers/temporaryunitmarker";
|
||||
import { Popup } from "../popups/popup";
|
||||
import { HotgroupPanel } from "../panels/hotgrouppanel";
|
||||
import { Contact, UnitData, UnitSpawnTable } from "../interfaces";
|
||||
import { Dialog } from "../dialog/dialog";
|
||||
|
||||
/** The UnitsManager handles the creation, update, and control of units. Data is strictly updated by the server ONLY. This means that any interaction from the user will always and only
|
||||
* result in a command to the server, executed by means of a REST PUT request. Any subsequent change in data will be reflected only when the new data is sent back by the server. This strategy allows
|
||||
* to avoid client/server and client/client inconsistencies.
|
||||
*/
|
||||
export class UnitsManager {
|
||||
#units: { [ID: number]: Unit };
|
||||
#copiedUnits: UnitData[];
|
||||
#selectionEventDisabled: boolean = false;
|
||||
#deselectionEventDisabled: boolean = false;
|
||||
#requestDetectionUpdate: boolean = false;
|
||||
#selectionEventDisabled: boolean = false;
|
||||
#slowDeleteDialog!:Dialog;
|
||||
#units: { [ID: number]: Unit };
|
||||
|
||||
|
||||
constructor() {
|
||||
this.#units = {};
|
||||
this.#copiedUnits = [];
|
||||
this.#units = {};
|
||||
|
||||
document.addEventListener('commandModeOptionsChanged', () => { Object.values(this.#units).forEach((unit: Unit) => unit.updateVisibility()) });
|
||||
document.addEventListener('contactsUpdated', (e: CustomEvent) => { this.#requestDetectionUpdate = true });
|
||||
document.addEventListener('copy', () => this.selectedUnitsCopy());
|
||||
document.addEventListener('paste', () => this.pasteUnits());
|
||||
document.addEventListener('unitSelection', (e: CustomEvent) => this.#onUnitSelection(e.detail));
|
||||
document.addEventListener('unitDeselection', (e: CustomEvent) => this.#onUnitDeselection(e.detail));
|
||||
document.addEventListener('deleteSelectedUnits', () => this.selectedUnitsDelete());
|
||||
document.addEventListener('explodeSelectedUnits', () => this.selectedUnitsDelete(true));
|
||||
document.addEventListener('keyup', (event) => this.#onKeyUp(event));
|
||||
document.addEventListener('exportToFile', () => this.exportToFile());
|
||||
document.addEventListener('importFromFile', () => this.importFromFile());
|
||||
document.addEventListener('contactsUpdated', (e: CustomEvent) => { this.#requestDetectionUpdate = true });
|
||||
document.addEventListener('commandModeOptionsChanged', () => { Object.values(this.#units).forEach((unit: Unit) => unit.updateVisibility()) });
|
||||
document.addEventListener('selectedUnitsChangeSpeed', (e: any) => { this.selectedUnitsChangeSpeed(e.detail.type) });
|
||||
document.addEventListener('keyup', (event) => this.#onKeyUp(event));
|
||||
document.addEventListener('paste', () => this.pasteUnits());
|
||||
document.addEventListener('selectedUnitsChangeAltitude', (e: any) => { this.selectedUnitsChangeAltitude(e.detail.type) });
|
||||
document.addEventListener('selectedUnitsChangeSpeed', (e: any) => { this.selectedUnitsChangeSpeed(e.detail.type) });
|
||||
document.addEventListener('unitDeselection', (e: CustomEvent) => this.#onUnitDeselection(e.detail));
|
||||
document.addEventListener('unitSelection', (e: CustomEvent) => this.#onUnitSelection(e.detail));
|
||||
|
||||
this.#slowDeleteDialog = new Dialog( "slow-delete-dialog" );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -328,7 +333,7 @@ export class UnitsManager {
|
||||
const unit = selectedUnits[idx];
|
||||
|
||||
/* If a unit is following another unit, and that unit is also selected, send the command to the followed ("leader") unit */
|
||||
if (unit.getState() === "Follow") {
|
||||
if (unit.getState() === "follow") {
|
||||
const leader = this.getUnitByID(unit.getLeaderID())
|
||||
if (leader && leader.getSelected())
|
||||
leader.addDestination(latlng);
|
||||
@ -351,7 +356,7 @@ export class UnitsManager {
|
||||
var selectedUnits = this.getSelectedUnits({ excludeHumans: true, onlyOnePerGroup: true });
|
||||
for (let idx in selectedUnits) {
|
||||
const unit = selectedUnits[idx];
|
||||
if (unit.getState() === "Follow") {
|
||||
if (unit.getState() === "follow") {
|
||||
const leader = this.getUnitByID(unit.getLeaderID())
|
||||
if (leader && leader.getSelected())
|
||||
leader.clearDestinations();
|
||||
@ -561,29 +566,32 @@ export class UnitsManager {
|
||||
}
|
||||
|
||||
var selectedUnits = this.getSelectedUnits({ excludeHumans: true, onlyOnePerGroup: true });
|
||||
|
||||
var count = 1;
|
||||
var xr = 0; var yr = 1; var zr = -1;
|
||||
var layer = 1;
|
||||
for (let idx in selectedUnits) {
|
||||
var unit = selectedUnits[idx];
|
||||
if (offset != undefined)
|
||||
/* Offset is set, apply it */
|
||||
unit.followUnit(ID, { "x": offset.x * count, "y": offset.y * count, "z": offset.z * count });
|
||||
else {
|
||||
/* More complex formations with variable offsets */
|
||||
if (formation === "diamond") {
|
||||
var xl = xr * Math.cos(Math.PI / 4) - yr * Math.sin(Math.PI / 4);
|
||||
var yl = xr * Math.sin(Math.PI / 4) + yr * Math.cos(Math.PI / 4);
|
||||
unit.followUnit(ID, { "x": -yl * 50, "y": zr * 10, "z": xl * 50 });
|
||||
if (unit.ID !== ID) {
|
||||
if (offset != undefined)
|
||||
/* Offset is set, apply it */
|
||||
unit.followUnit(ID, { "x": offset.x * count, "y": offset.y * count, "z": offset.z * count });
|
||||
else {
|
||||
/* More complex formations with variable offsets */
|
||||
if (formation === "diamond") {
|
||||
var xl = xr * Math.cos(Math.PI / 4) - yr * Math.sin(Math.PI / 4);
|
||||
var yl = xr * Math.sin(Math.PI / 4) + yr * Math.cos(Math.PI / 4);
|
||||
unit.followUnit(ID, { "x": -yl * 50, "y": zr * 10, "z": xl * 50 });
|
||||
|
||||
if (yr == 0) { layer++; xr = 0; yr = layer; zr = -layer; }
|
||||
else {
|
||||
if (xr < layer) { xr++; zr--; }
|
||||
else { yr--; zr++; }
|
||||
if (yr == 0) { layer++; xr = 0; yr = layer; zr = -layer; }
|
||||
else {
|
||||
if (xr < layer) { xr++; zr--; }
|
||||
else { yr--; zr++; }
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
this.#showActionMessage(selectedUnits, `following unit ${this.getUnitByID(ID)?.getUnitName()}`);
|
||||
}
|
||||
@ -635,7 +643,7 @@ export class UnitsManager {
|
||||
try {
|
||||
groundElevation = parseFloat(response);
|
||||
} catch {
|
||||
console.log("Simulate fire fight: could not retrieve ground elevation")
|
||||
console.warn("Simulate fire fight: could not retrieve ground elevation")
|
||||
}
|
||||
for (let idx in selectedUnits) {
|
||||
selectedUnits[idx].simulateFireFight(latlng, groundElevation);
|
||||
@ -751,14 +759,24 @@ export class UnitsManager {
|
||||
return;
|
||||
}
|
||||
|
||||
var immediate = false;
|
||||
if (selectedUnits.length > 20)
|
||||
immediate = confirm(`You are trying to delete ${selectedUnits.length} units, do you want to delete them immediately? This may cause lag for players.`)
|
||||
|
||||
for (let idx in selectedUnits) {
|
||||
selectedUnits[idx].delete(explosion, immediate);
|
||||
const doDelete = (explosion = false, immediate = false) => {
|
||||
const selectedUnits = this.getSelectedUnits();
|
||||
for (let idx in selectedUnits) {
|
||||
selectedUnits[idx].delete(explosion, immediate);
|
||||
}
|
||||
this.#showActionMessage(selectedUnits, `deleted`);
|
||||
}
|
||||
this.#showActionMessage(selectedUnits, `deleted`);
|
||||
|
||||
if (selectedUnits.length >= DELETE_SLOW_THRESHOLD)
|
||||
this.#showSlowDeleteDialog(selectedUnits).then((action:any) => {
|
||||
if (action === "delete-slow")
|
||||
doDelete(explosion, false);
|
||||
else if (action === "delete-immediate")
|
||||
doDelete(explosion, true);
|
||||
})
|
||||
else
|
||||
doDelete(explosion);
|
||||
|
||||
}
|
||||
|
||||
/** Compute the destinations of every unit in the selected units. This function preserves the relative positions of the units, and rotates the whole formation by rotation.
|
||||
@ -1080,4 +1098,32 @@ export class UnitsManager {
|
||||
else if (units.length > 1)
|
||||
(getApp().getPopupsManager().get("infoPopup") as Popup).setText(`${units[0].getUnitName()} and ${units.length - 1} other units ${message}`);
|
||||
}
|
||||
|
||||
#showSlowDeleteDialog(selectedUnits:Unit[]) {
|
||||
let button:HTMLButtonElement | null = null;
|
||||
const deletionTime = Math.round( selectedUnits.length * DELETE_CYCLE_TIME ).toString();
|
||||
const dialog = this.#slowDeleteDialog;
|
||||
const element = dialog.getElement();
|
||||
const listener = (ev:MouseEvent) => {
|
||||
if (ev.target instanceof HTMLButtonElement && ev.target.matches("[data-action]"))
|
||||
button = ev.target;
|
||||
}
|
||||
|
||||
element.querySelectorAll(".deletion-count").forEach( el => el.innerHTML = selectedUnits.length.toString() );
|
||||
element.querySelectorAll(".deletion-time").forEach( el => el.innerHTML = deletionTime );
|
||||
dialog.show();
|
||||
|
||||
return new Promise((resolve) => {
|
||||
element.addEventListener("click", listener);
|
||||
|
||||
const interval = setInterval(() => {
|
||||
if (button instanceof HTMLButtonElement ) {
|
||||
clearInterval(interval);
|
||||
dialog.hide();
|
||||
element.removeEventListener("click", listener);
|
||||
resolve( button.getAttribute("data-action") );
|
||||
}
|
||||
}, 250);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -16,8 +16,35 @@
|
||||
|
||||
<div id="legal-stuff">
|
||||
<h5>DISCLAIMER</h5>
|
||||
<p> DCS Olympus (the "MATERIAL" or "Software") is provided completely free to users subject to the terms of the <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0 Licence</a> except where such terms conflict with this disclaimer, in which case, the terms of this disclaimer shall prevail.
|
||||
The authors and/or copyright holders of the Software have not received any financial benefit in connection with the Software. In any event, the Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors and/or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software. Any party making use of the Software in any manner agrees to be bound by the terms set out in this disclaimer. THIS MATERIAL IS NOT MADE OR SUPPORTED BY EAGLE DYNAMICS SA.
|
||||
<p>
|
||||
Copyright (C) 2023 Veltro & Gang
|
||||
</p>
|
||||
<p>
|
||||
DCS Olympus (the "MATERIAL" or "Software") is provided completely free
|
||||
to users subject to the it under both the terms of version 3 of the GNU
|
||||
General Public License as published by the Free Software Foundation, and
|
||||
the additional terms set out below; except where such terms conflict with this
|
||||
disclaimer, in which case, the terms of this disclaimer shall prevail.
|
||||
</p>
|
||||
<p>
|
||||
The authors and/or copyright holders of the Software have not received any
|
||||
financial benefit in connection with the Software. In any event, the
|
||||
Software is provided “as is”, without warranty of any kind, express or
|
||||
implied, including but not limited to the warranties of merchantability,
|
||||
fitness for a particular purpose and non-infringement. In no event shall
|
||||
the authors and/or copyright holders be liable for any claim, damages or
|
||||
other liability, whether in an action of contract, tort or otherwise,
|
||||
arising from, out of or in connection with the Software or the use or o
|
||||
ther dealings in the Software.
|
||||
</p>
|
||||
<p>
|
||||
Any party making use of the Software in any manner agrees to be
|
||||
bound by the terms set out in this disclaimer, version 3 of the GNU
|
||||
General Public Licence, and the Additional Terms below.
|
||||
</p>
|
||||
<p>
|
||||
THIS MATERIAL IS NOT MADE OR SUPPORTED BY EAGLE DYNAMICS SA.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -304,4 +331,27 @@
|
||||
<button class="ol-button-apply" data-on-click="applycommandModeOptions">Apply</button>
|
||||
<button class="ol-button-close" data-on-click="closeDialog">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="slow-delete-dialog" class="ol-panel ol-dialog hide" oncontextmenu="return false;">
|
||||
<div class="ol-dialog-header">
|
||||
<h3 id="unit-name">Confirm deletion method</h3>
|
||||
</div>
|
||||
|
||||
<div class="ol-dialog-content">
|
||||
<p>You are trying to delete a large amount of units (<span class="deletion-count"></span>), which can cause the server to lag for players.</p>
|
||||
<p>You may:
|
||||
<ul>
|
||||
<li>delete in batches (less lag but Olympus cannot process any additional orders until<br /> all units have been deleted);</li>
|
||||
<li>delete immediately (you can continue to give Olympus orders but players may<br />experience lag while this happens);</li>
|
||||
<li>cancel this instruction.</li>
|
||||
</ul></p>
|
||||
</div>
|
||||
|
||||
<div class="ol-dialog-footer ol-group">
|
||||
<button data-action="delete-slow">Delete in batches (~<span class="deletion-time"></span>s)</button>
|
||||
<button data-action="delete-immediate">Delete immediately</button>
|
||||
<button data-action="delete-cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<div id="loadout">
|
||||
<img id="loadout-silhouette"/>
|
||||
<div id="loadout-items">
|
||||
<div id="loadout-items" class="ol-scrollable">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
3
package-lock.json
generated
3
package-lock.json
generated
@ -1,3 +0,0 @@
|
||||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
cd client
|
||||
call npm prune --production
|
||||
cd ..
|
||||
call "C:\Program Files (x86)\Inno Setup 6\iscc.exe" "installer\olympus.iss"
|
||||
@ -1,6 +1,6 @@
|
||||
local version = "v0.4.5-alpha"
|
||||
|
||||
local debug = true -- True enables debug printing using DCS messages
|
||||
local debug = false -- True enables debug printing using DCS messages
|
||||
|
||||
-- .dll related variables
|
||||
Olympus.OlympusDLL = nil
|
||||
|
||||
@ -202,7 +202,7 @@ void GroundUnit::AIloop()
|
||||
|
||||
double lat = 0;
|
||||
double lng = 0;
|
||||
double randomBearing = bearing1 + (((double)(rand()) / (double)(RAND_MAX) - 0.5) * 2) * 15;
|
||||
double randomBearing = bearing1 + (((double)(rand()) / (double)(RAND_MAX) - 0.5) * 2) * 0; // TODO put defined constant here
|
||||
Geodesic::WGS84().Direct(position.lat, position.lng, randomBearing, r, lat, lng);
|
||||
|
||||
std::ostringstream taskSS;
|
||||
@ -214,7 +214,7 @@ void GroundUnit::AIloop()
|
||||
}
|
||||
|
||||
if (internalCounter == 0)
|
||||
internalCounter = 20 / 0.05;
|
||||
internalCounter = 20 / 0.05; // TODO make defined constant
|
||||
internalCounter--;
|
||||
|
||||
break;
|
||||
@ -285,7 +285,7 @@ void GroundUnit::AIloop()
|
||||
if (muzzleVelocity != 0)
|
||||
aimTime += distance / muzzleVelocity;
|
||||
|
||||
internalCounter = (aimTime + 2) / 0.05;
|
||||
internalCounter = (aimTime + 2) / 0.05; // TODO fix me you fucking monster
|
||||
|
||||
/* Compute where the target will be in aimTime seconds. We don't consider vertical velocity atm, since after all we are not really tring to hit */
|
||||
double aimDistance = target->getSpeed() * aimTime;
|
||||
@ -293,7 +293,7 @@ void GroundUnit::AIloop()
|
||||
double aimLng = 0;
|
||||
Geodesic::WGS84().Direct(target->getPosition().lat, target->getPosition().lng, target->getHeading() * 57.29577, aimDistance, aimLat, aimLng); /* TODO make util function */
|
||||
|
||||
/* Compute distance to the aim point */
|
||||
/* Compute distance to the aim point */ // TODO: why am I here?
|
||||
double dist;
|
||||
double bearing1;
|
||||
double bearing2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user