mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Modified database editor
This commit is contained in:
parent
a0ac9eb285
commit
c5160c9baa
83
client/@types/olympus/index.d.ts
vendored
83
client/@types/olympus/index.d.ts
vendored
@ -241,6 +241,7 @@ declare module "constants/constants" {
|
||||
contacts = 36,
|
||||
activePath = 37,
|
||||
isLeader = 38,
|
||||
operateAs = 39,
|
||||
endOfData = 255
|
||||
}
|
||||
}
|
||||
@ -512,6 +513,7 @@ declare module "interfaces" {
|
||||
contacts: Contact[];
|
||||
activePath: LatLng[];
|
||||
isLeader: boolean;
|
||||
operateAs: string;
|
||||
}
|
||||
export interface LoadoutItemBlueprint {
|
||||
name: string;
|
||||
@ -532,7 +534,7 @@ declare module "interfaces" {
|
||||
label: string;
|
||||
shortLabel: string;
|
||||
type?: string;
|
||||
range?: string;
|
||||
rangeType?: string;
|
||||
loadouts?: LoadoutBlueprint[];
|
||||
filename?: string;
|
||||
liveries?: {
|
||||
@ -544,6 +546,14 @@ declare module "interfaces" {
|
||||
cost?: number;
|
||||
barrelHeight?: number;
|
||||
muzzleVelocity?: number;
|
||||
aimTime?: number;
|
||||
shotsToFire?: number;
|
||||
description?: string;
|
||||
abilities?: string;
|
||||
acquisitionRange?: number;
|
||||
engagementRange?: number;
|
||||
refuelsFrom?: string;
|
||||
refuelingType?: string;
|
||||
}
|
||||
export interface UnitSpawnOptions {
|
||||
roleType: string;
|
||||
@ -721,6 +731,7 @@ declare module "other/utils" {
|
||||
export function enumToReactionToThreat(reactionToThreat: number): string;
|
||||
export function enumToEmissioNCountermeasure(emissionCountermeasure: number): string;
|
||||
export function enumToCoalition(coalitionID: number): "" | "blue" | "red" | "neutral";
|
||||
export function coalitionToEnum(coalition: string): 0 | 1 | 2;
|
||||
export function convertDateAndTimeToDate(dateAndTime: DateAndTime): Date;
|
||||
export function createCheckboxOption(value: string, text: string, checked?: boolean, callback?: CallableFunction): HTMLElement;
|
||||
export function getCheckboxOptions(dropdown: Dropdown): {
|
||||
@ -752,6 +763,7 @@ declare module "controls/unitspawnmenu" {
|
||||
import { UnitSpawnOptions } from "interfaces";
|
||||
export class UnitSpawnMenu {
|
||||
#private;
|
||||
spawnOptions: UnitSpawnOptions;
|
||||
constructor(ID: string, unitDatabase: UnitDatabase, orderByRole: boolean);
|
||||
getContainer(): HTMLElement;
|
||||
reset(): void;
|
||||
@ -1023,6 +1035,7 @@ declare module "unit/unit" {
|
||||
getContacts(): Contact[];
|
||||
getActivePath(): LatLng[];
|
||||
getIsLeader(): boolean;
|
||||
getOperateAs(): string;
|
||||
static getConstructor(type: string): typeof GroundUnit | undefined;
|
||||
constructor(ID: number);
|
||||
getCategory(): string;
|
||||
@ -1078,6 +1091,7 @@ declare module "unit/unit" {
|
||||
setEmissionsCountermeasures(emissionCountermeasure: string): void;
|
||||
setOnOff(onOff: boolean): void;
|
||||
setFollowRoads(followRoads: boolean): void;
|
||||
setOperateAs(operateAs: string): void;
|
||||
delete(explosion: boolean, immediate: boolean): void;
|
||||
refuel(): void;
|
||||
setAdvancedOptions(isTanker: boolean, isAWACS: boolean, TACAN: TACAN, radio: Radio, generalSettings: GeneralSettings): void;
|
||||
@ -1086,8 +1100,20 @@ declare module "unit/unit" {
|
||||
bombBuilding(latlng: LatLng): void;
|
||||
fireAtArea(latlng: LatLng): void;
|
||||
simulateFireFight(latlng: LatLng, targetGroundElevation: number | null): void;
|
||||
scenicAAA(): void;
|
||||
missOnPurpose(): void;
|
||||
/***********************************************/
|
||||
getActions(): {
|
||||
[key: string]: {
|
||||
text: string;
|
||||
tooltip: string;
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
executeAction(e: any, action: string): void;
|
||||
/***********************************************/
|
||||
onAdd(map: Map): this;
|
||||
getActionOptions(): {};
|
||||
}
|
||||
export class AirUnit extends Unit {
|
||||
getIconOptions(): {
|
||||
@ -1102,6 +1128,13 @@ declare module "unit/unit" {
|
||||
showCallsign: boolean;
|
||||
rotateToHeading: boolean;
|
||||
};
|
||||
getActions(): {
|
||||
[key: string]: {
|
||||
text: string;
|
||||
tooltip: string;
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
export class Aircraft extends AirUnit {
|
||||
constructor(ID: number);
|
||||
@ -1125,6 +1158,13 @@ declare module "unit/unit" {
|
||||
showCallsign: boolean;
|
||||
rotateToHeading: boolean;
|
||||
};
|
||||
getActions(): {
|
||||
[key: string]: {
|
||||
text: string;
|
||||
tooltip: string;
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
getCategory(): string;
|
||||
getType(): string;
|
||||
}
|
||||
@ -1142,6 +1182,13 @@ declare module "unit/unit" {
|
||||
showCallsign: boolean;
|
||||
rotateToHeading: boolean;
|
||||
};
|
||||
getActions(): {
|
||||
[key: string]: {
|
||||
text: string;
|
||||
tooltip: string;
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
getMarkerCategory(): string;
|
||||
getCategory(): string;
|
||||
getType(): string;
|
||||
@ -1310,6 +1357,14 @@ declare module "popups/popup" {
|
||||
declare module "map/touchboxselect" {
|
||||
export var TouchBoxSelect: (new (...args: any[]) => any) & typeof import("leaflet").Class;
|
||||
}
|
||||
declare module "map/markers/destinationpreviewHandle" {
|
||||
import { LatLng } from "leaflet";
|
||||
import { CustomMarker } from "map/markers/custommarker";
|
||||
export class DestinationPreviewHandle extends CustomMarker {
|
||||
constructor(latlng: LatLng);
|
||||
createIcon(): void;
|
||||
}
|
||||
}
|
||||
declare module "map/map" {
|
||||
import * as L from "leaflet";
|
||||
import { MapContextMenu } from "contextmenus/mapcontextmenu";
|
||||
@ -1414,7 +1469,9 @@ declare module "panels/connectionstatuspanel" {
|
||||
import { Panel } from "panels/panel";
|
||||
export class ConnectionStatusPanel extends Panel {
|
||||
constructor(ID: string);
|
||||
update(connected: boolean): void;
|
||||
showDisconnected(): void;
|
||||
showConnected(): void;
|
||||
showServerPaused(): void;
|
||||
}
|
||||
}
|
||||
declare module "panels/hotgrouppanel" {
|
||||
@ -1615,7 +1672,7 @@ declare module "unit/unitsmanager" {
|
||||
*
|
||||
* @param hotgroup The hotgroup number
|
||||
*/
|
||||
selectUnitsByHotgroup(hotgroup: number): void;
|
||||
selectUnitsByHotgroup(hotgroup: number, deselectAllUnits?: boolean): void;
|
||||
/** Get all the currently selected units
|
||||
*
|
||||
* @param options Selection options
|
||||
@ -1728,6 +1785,11 @@ declare module "unit/unitsmanager" {
|
||||
* @param followRoads If true, units will follow roads
|
||||
*/
|
||||
selectedUnitsSetFollowRoads(followRoads: boolean): void;
|
||||
/** Instruct selected units to operate as a certain coalition
|
||||
*
|
||||
* @param operateAsBool If true, units will operate as blue
|
||||
*/
|
||||
selectedUnitsSetOperateAs(operateAsBool: boolean): void;
|
||||
/** Instruct units to attack a specific unit
|
||||
*
|
||||
* @param ID ID of the unit to attack
|
||||
@ -1768,6 +1830,14 @@ declare module "unit/unitsmanager" {
|
||||
* @param latlng Location to fire at
|
||||
*/
|
||||
selectedUnitsSimulateFireFight(latlng: LatLng): void;
|
||||
/** Instruct units to enter into scenic AAA mode. Units will shoot in the air without aiming
|
||||
*
|
||||
*/
|
||||
selectedUnitsScenicAAA(): void;
|
||||
/** Instruct units to enter into miss on purpose mode. Units will aim to the nearest enemy unit but not precisely.
|
||||
*
|
||||
*/
|
||||
selectedUnitsMissOnPurpose(): void;
|
||||
/*********************** Control operations on selected units ************************/
|
||||
/** See getUnitsCategories for more info
|
||||
*
|
||||
@ -1948,12 +2018,15 @@ declare module "server/servermanager" {
|
||||
setEmissionsCountermeasures(ID: number, emissionCountermeasure: string, callback?: CallableFunction): void;
|
||||
setOnOff(ID: number, onOff: boolean, callback?: CallableFunction): void;
|
||||
setFollowRoads(ID: number, followRoads: boolean, callback?: CallableFunction): void;
|
||||
setOperateAs(ID: number, operateAs: number, callback?: CallableFunction): void;
|
||||
refuel(ID: number, callback?: CallableFunction): void;
|
||||
bombPoint(ID: number, latlng: LatLng, callback?: CallableFunction): void;
|
||||
carpetBomb(ID: number, latlng: LatLng, callback?: CallableFunction): void;
|
||||
bombBuilding(ID: number, latlng: LatLng, callback?: CallableFunction): void;
|
||||
fireAtArea(ID: number, latlng: LatLng, callback?: CallableFunction): void;
|
||||
simulateFireFight(ID: number, latlng: LatLng, altitude: number, callback?: CallableFunction): void;
|
||||
scenicAAA(ID: number, coalition: string, callback?: CallableFunction): void;
|
||||
missOnPurpose(ID: number, coalition: string, callback?: CallableFunction): void;
|
||||
setAdvacedOptions(ID: number, isTanker: boolean, isAWACS: boolean, TACAN: TACAN, radio: Radio, generalSettings: GeneralSettings, callback?: CallableFunction): void;
|
||||
setCommandModeOptions(restrictSpawns: boolean, restrictToCoalition: boolean, spawnPoints: {
|
||||
blue: number;
|
||||
@ -1967,14 +2040,14 @@ declare module "server/servermanager" {
|
||||
getConnected(): boolean;
|
||||
setPaused(newPaused: boolean): void;
|
||||
getPaused(): boolean;
|
||||
getServerIsPaused(): boolean;
|
||||
}
|
||||
}
|
||||
declare module "panels/unitlistpanel" {
|
||||
import { OlympusApp } from "olympusapp";
|
||||
import { Panel } from "panels/panel";
|
||||
export class UnitListPanel extends Panel {
|
||||
#private;
|
||||
constructor(olympusApp: OlympusApp, panelElement: string, contentElement: string);
|
||||
constructor(panelElement: string, contentElement: string);
|
||||
doUpdate(): void;
|
||||
getContentElement(): HTMLElement;
|
||||
startUpdates(): void;
|
||||
|
||||
@ -44,6 +44,8 @@ export class AirUnitEditor extends UnitEditor {
|
||||
addDropdownInput(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"]);
|
||||
addStringInput(this.contentDiv2, "Filename", blueprint.filename ?? "", "text", (value: string) => { blueprint.filename = value; });
|
||||
addStringInput(this.contentDiv2, "Cost", String(blueprint.cost) ?? "", "number", (value: string) => { blueprint.cost = parseFloat(value); });
|
||||
addStringInput(this.contentDiv2, "Rufels from", String(blueprint.refuelsFrom) ?? "", "text", (value: string) => { blueprint.refuelsFrom = value; });
|
||||
addStringInput(this.contentDiv2, "Refueling type", String(blueprint.refuelingType) ?? "", "text", (value: string) => { blueprint.refuelingType = value; });
|
||||
|
||||
/* Add a scrollable list of loadouts that the user can edit */
|
||||
var title = document.createElement("label");
|
||||
|
||||
@ -157,7 +157,7 @@ export class DatabaseManagerPlugin implements OlympusPlugin {
|
||||
*/
|
||||
initialize(app: any) {
|
||||
this.#app = app;
|
||||
|
||||
|
||||
/* Load the databases and initialize the editors */
|
||||
this.#loadDatabases();
|
||||
|
||||
@ -173,9 +173,10 @@ export class DatabaseManagerPlugin implements OlympusPlugin {
|
||||
toolbar.getMainDropdown().setOptionsElements(arr);
|
||||
mainButton.onclick = () => {
|
||||
toolbar.getMainDropdown().close();
|
||||
this.toggle();
|
||||
if (this.#app?.getMissionManager().getCommandModeOptions().commandMode === "Game master")
|
||||
this.toggle();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -34,8 +34,12 @@ export class GroundUnitEditor extends UnitEditor {
|
||||
addDropdownInput(this.contentDiv2, "Era", blueprint.era, ["WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern"]);
|
||||
//addStringInput(this.contentDiv2, "Filename", blueprint.filename?? "", "text", (value: string) => {blueprint.filename = value; });
|
||||
addStringInput(this.contentDiv2, "Cost", String(blueprint.cost)?? "", "number", (value: string) => {blueprint.cost = parseFloat(value); });
|
||||
addStringInput(this.contentDiv2, "Acquisition range [NM]", String(blueprint.acquisitionRange)?? "", "number", (value: string) => {blueprint.acquisitionRange = parseFloat(value); });
|
||||
addStringInput(this.contentDiv2, "Engagement range [NM]", String(blueprint.engagementRange)?? "", "number", (value: string) => {blueprint.engagementRange = parseFloat(value); });
|
||||
addStringInput(this.contentDiv2, "Barrel height [m]", String(blueprint.barrelHeight)?? "", "number", (value: string) => {blueprint.barrelHeight = parseFloat(value); });
|
||||
addStringInput(this.contentDiv2, "Muzzle velocity [m/s]", String(blueprint.muzzleVelocity)?? "", "number", (value: string) => {blueprint.muzzleVelocity = parseFloat(value); });
|
||||
addStringInput(this.contentDiv2, "Aim time [s]", String(blueprint.aimTime)?? "", "number", (value: string) => {blueprint.aimTime = parseFloat(value); });
|
||||
addStringInput(this.contentDiv2, "Burst quantity", String(blueprint.shotsToFire)?? "", "number", (value: string) => {blueprint.shotsToFire = Math.round(parseFloat(value)); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,15 +9,16 @@
|
||||
z-index: 9999999;
|
||||
}
|
||||
|
||||
@media (orientation: landscape) {
|
||||
@media (min-width: 1200px) {
|
||||
.dm-container {
|
||||
flex-direction: row;
|
||||
}
|
||||
}
|
||||
|
||||
@media (orientation: portrait) {
|
||||
@media (max-width: 1200px) {
|
||||
.dm-container {
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,14 +57,6 @@
|
||||
border-radius: 0px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.dm-container>div:nth-child(2) {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.dm-container>div:nth-child(3) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.dm-content-container {
|
||||
position: relative;
|
||||
margin: 10px;
|
||||
@ -72,19 +65,40 @@
|
||||
row-gap: 5px;
|
||||
}
|
||||
|
||||
@media (orientation: landscape) {
|
||||
@media (min-width: 1200px) {
|
||||
.dm-content-container {
|
||||
height: calc(100% - 20px);
|
||||
min-width: 200px;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.dm-content-container:nth-of-type(1) {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.dm-content-container:nth-of-type(2) {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.dm-content-container:nth-of-type(3) {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (orientation: portrait) {
|
||||
@media (max-width: 1200px) {
|
||||
.dm-content-container {
|
||||
width: 100% - calc(20px);
|
||||
width: calc(100% - 20px);
|
||||
}
|
||||
|
||||
.dm-content-container:nth-of-type(1) {
|
||||
height: 30%;
|
||||
}
|
||||
|
||||
.dm-content-container:nth-of-type(2) {
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.dm-content-container:nth-of-type(3) {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.dm-content-container>label {
|
||||
@ -95,7 +109,7 @@
|
||||
.dm-scroll-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
overflow-y: scroll;
|
||||
max-height: 100%;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
@ -113,7 +127,6 @@
|
||||
height: 100%;
|
||||
width: calc(100% - 25px);
|
||||
padding: 2px;
|
||||
text-wrap: wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
@ -141,6 +154,15 @@
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.dm-content-container label {
|
||||
width: 100%;
|
||||
}
|
||||
.input-row {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.input-row>dt {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3485,7 +3485,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 +3515,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 +3547,20 @@
|
||||
"roles": [
|
||||
"Antiship Strike"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "asd",
|
||||
"code": "",
|
||||
"fuel": 1,
|
||||
"items": [],
|
||||
"roles": []
|
||||
},
|
||||
{
|
||||
"name": "asd",
|
||||
"code": "",
|
||||
"fuel": 1,
|
||||
"items": [],
|
||||
"roles": []
|
||||
}
|
||||
],
|
||||
"filename": "uh-60.png",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -200,13 +200,21 @@ export interface UnitBlueprint {
|
||||
label: string;
|
||||
shortLabel: string;
|
||||
type?: string;
|
||||
range?: string;
|
||||
rangeType?: string;
|
||||
loadouts?: LoadoutBlueprint[];
|
||||
filename?: string;
|
||||
liveries?: { [key: string]: { name: string, countries: string[] } };
|
||||
cost?: number;
|
||||
barrelHeight?: number;
|
||||
muzzleVelocity?: number;
|
||||
aimTime?: number;
|
||||
shotsToFire?: number;
|
||||
description?: string;
|
||||
abilities?: string;
|
||||
acquisitionRange?: number;
|
||||
engagementRange?: number;
|
||||
refuelsFrom?: string;
|
||||
refuelingType?: string;
|
||||
}
|
||||
|
||||
export interface UnitSpawnOptions {
|
||||
|
||||
@ -259,7 +259,7 @@ export function randomUnitBlueprint(unitDatabase: UnitDatabase, options: {type?:
|
||||
if (options.ranges) {
|
||||
unitBlueprints = unitBlueprints.filter((unitBlueprint: UnitBlueprint) => {
|
||||
//@ts-ignore
|
||||
return unitBlueprint.range? options.ranges.includes(unitBlueprint.range): true;
|
||||
return unitBlueprint.rangeType? options.ranges.includes(unitBlueprint.rangeType): true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ export class UnitDatabase {
|
||||
var filteredBlueprints = this.getBlueprints();
|
||||
var ranges: string[] = [];
|
||||
for (let unit in filteredBlueprints) {
|
||||
var range = filteredBlueprints[unit].range;
|
||||
var range = filteredBlueprints[unit].rangeType;
|
||||
if (range && range !== "" && !ranges.includes(range))
|
||||
ranges.push(range);
|
||||
}
|
||||
@ -127,7 +127,7 @@ export class UnitDatabase {
|
||||
var filteredBlueprints = this.getBlueprints();
|
||||
var unitswithrange = [];
|
||||
for (let unit in filteredBlueprints) {
|
||||
if (filteredBlueprints[unit].range === range) {
|
||||
if (filteredBlueprints[unit].rangeType === range) {
|
||||
unitswithrange.push(filteredBlueprints[unit]);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user