mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Completed contextmenu, only missing is callback for smoke spawning
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { similarity } from "../other/utils";
|
||||
import { UnitDatabase } from "./unitdatabase"
|
||||
|
||||
export class AircraftDatabase extends UnitDatabase {
|
||||
|
||||
2766
client/src/units/groundunitsdatabase.ts
Normal file
2766
client/src/units/groundunitsdatabase.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ import { getMap, getUnitsManager } from '..';
|
||||
import { rad2deg } from '../other/utils';
|
||||
import { addDestination, attackUnit, changeAltitude, changeSpeed, createFormation as setLeader, deleteUnit, landAt, setAltitude, setReactionToThreat, setROE, setSpeed } from '../server/server';
|
||||
import { aircraftDatabase } from './aircraftdatabase';
|
||||
import { groundUnitsDatabase } from './groundunitsdatabase';
|
||||
|
||||
var pathIcon = new Icon({
|
||||
iconUrl: 'images/marker-icon.png',
|
||||
@@ -36,7 +37,7 @@ export class Unit extends Marker {
|
||||
if (type === "NavyUnit") return NavyUnit;
|
||||
}
|
||||
|
||||
constructor(ID: number, data: UnitData) {
|
||||
constructor(ID: number, data: UnitData, html: string) {
|
||||
super(new LatLng(0, 0), { riseOnHover: true });
|
||||
|
||||
this.ID = ID;
|
||||
@@ -49,33 +50,7 @@ export class Unit extends Marker {
|
||||
this.on('contextmenu', (e) => this.#onContextMenu(e));
|
||||
|
||||
var icon = new DivIcon({
|
||||
html: `
|
||||
<div class="unit unit-air" data-status="hold" data-coalition="${this.getMissionData().coalition}" data-is-in-hotgroup="false" data-is-selected="false">
|
||||
<div class="unit-selected-spotlight"></div>
|
||||
<div class="unit-marker-border"></div>
|
||||
<div class="unit-status"></div>
|
||||
<div class="unit-vvi"></div>
|
||||
<div class="unit-hotgroup">
|
||||
<div class="unit-hotgroup-id">4</div>
|
||||
</div>
|
||||
<div class="unit-marker"></div>
|
||||
<div class="unit-short-label">${aircraftDatabase.getShortLabelByName(this.getData().name)}</div>
|
||||
<div class="unit-fuel">
|
||||
<div class="unit-fuel-level" style="width:100%;"></div>
|
||||
</div>
|
||||
<div class="unit-ammo">
|
||||
<div class="unit-ammo-fox-1"></div>
|
||||
<div class="unit-ammo-fox-2"></div>
|
||||
<div class="unit-ammo-fox-3"></div>
|
||||
<div class="unit-ammo-other"></div>
|
||||
</div>
|
||||
<div class="unit-summary">
|
||||
<div class="unit-callsign">${this.getData().unitName}</div>
|
||||
<div class="unit-heading"></div>
|
||||
<div class="unit-altitude"></div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
html: html,
|
||||
className: 'ol-unit-marker',
|
||||
iconAnchor: [0, 0]
|
||||
});
|
||||
@@ -408,19 +383,55 @@ export class AirUnit extends Unit {
|
||||
|
||||
export class Aircraft extends AirUnit {
|
||||
constructor(ID: number, data: UnitData) {
|
||||
super(ID, data);
|
||||
super(ID, data,
|
||||
`<div class="unit unit-air" data-status="hold" data-coalition="${data.missionData.coalition}" data-is-in-hotgroup="false" data-is-selected="false">
|
||||
<div class="unit-selected-spotlight"></div>
|
||||
<div class="unit-marker-border"></div>
|
||||
<div class="unit-status"></div>
|
||||
<div class="unit-vvi"></div>
|
||||
<div class="unit-hotgroup">
|
||||
<div class="unit-hotgroup-id">4</div>
|
||||
</div>
|
||||
<div class="unit-marker"></div>
|
||||
<div class="unit-short-label">${aircraftDatabase.getShortLabelByName(data.name)}</div>
|
||||
<div class="unit-fuel">
|
||||
<div class="unit-fuel-level" style="width:100%;"></div>
|
||||
</div>
|
||||
<div class="unit-ammo">
|
||||
<div class="unit-ammo-fox-1"></div>
|
||||
<div class="unit-ammo-fox-2"></div>
|
||||
<div class="unit-ammo-fox-3"></div>
|
||||
<div class="unit-ammo-other"></div>
|
||||
</div>
|
||||
<div class="unit-summary">
|
||||
<div class="unit-callsign">${data.unitName}</div>
|
||||
<div class="unit-heading"></div>
|
||||
<div class="unit-altitude"></div>
|
||||
</div>
|
||||
</div>`);
|
||||
}
|
||||
}
|
||||
|
||||
export class Helicopter extends AirUnit {
|
||||
constructor(ID: number, data: UnitData) {
|
||||
super(ID, data);
|
||||
super(ID, data,
|
||||
``);
|
||||
}
|
||||
}
|
||||
|
||||
export class GroundUnit extends Unit {
|
||||
constructor(ID: number, data: UnitData) {
|
||||
super(ID, data);
|
||||
var role = groundUnitsDatabase.getByName(data.name)?.loadouts[0].roles[0];
|
||||
var roleType = "ground";
|
||||
if (role === "SAM")
|
||||
roleType = "sam"
|
||||
super(ID, data, `
|
||||
<div class="unit unit-${roleType}" data-coalition="${data.missionData.coalition}">
|
||||
<div class="unit-selected-spotlight"></div>
|
||||
<div class="unit-marker"></div>
|
||||
<div class="unit-short-label">${role?.substring(0, 1).toUpperCase()}</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
|
||||
getHidden() {
|
||||
@@ -430,7 +441,7 @@ export class GroundUnit extends Unit {
|
||||
|
||||
export class NavyUnit extends Unit {
|
||||
constructor(ID: number, data: UnitData) {
|
||||
super(ID, data);
|
||||
super(ID, data, "");
|
||||
}
|
||||
|
||||
getHidden() {
|
||||
@@ -440,7 +451,7 @@ export class NavyUnit extends Unit {
|
||||
|
||||
export class Weapon extends Unit {
|
||||
constructor(ID: number, data: UnitData) {
|
||||
super(ID, data);
|
||||
super(ID, data, "");
|
||||
this.setSelectable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ export class UnitDatabase {
|
||||
|
||||
}
|
||||
|
||||
getByName(name: string)
|
||||
{
|
||||
if (name in this.units)
|
||||
return this.units[name];
|
||||
return null;
|
||||
}
|
||||
|
||||
getByLabel(label: string)
|
||||
{
|
||||
for (let unit in this.units)
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
|
||||
|
||||
export var unitTypes: any = {};
|
||||
/* NAVY */
|
||||
unitTypes.navy = {};
|
||||
unitTypes.navy.blue = [
|
||||
"VINSON",
|
||||
"PERRY",
|
||||
"TICONDEROG"
|
||||
]
|
||||
|
||||
unitTypes.navy.red = [
|
||||
"ALBATROS",
|
||||
"KUZNECOW",
|
||||
"MOLNIYA",
|
||||
"MOSCOW",
|
||||
"NEUSTRASH",
|
||||
"PIOTR",
|
||||
"REZKY"
|
||||
]
|
||||
|
||||
unitTypes.navy.civil = [
|
||||
"ELNYA",
|
||||
"Dry-cargo ship-2",
|
||||
"Dry-cargo ship-1",
|
||||
"ZWEZDNY"
|
||||
]
|
||||
|
||||
unitTypes.navy.submarine = [
|
||||
"KILO",
|
||||
"SOM"
|
||||
]
|
||||
|
||||
unitTypes.navy.speedboat = [
|
||||
"speedboat"
|
||||
]
|
||||
|
||||
/* VEHICLES (GROUND) */
|
||||
unitTypes.vehicles = []
|
||||
unitTypes.vehicles.Howitzers = [
|
||||
"2B11 mortar",
|
||||
"SAU Gvozdika",
|
||||
"SAU Msta",
|
||||
"SAU Akatsia",
|
||||
"SAU 2-C9",
|
||||
"M-109"
|
||||
]
|
||||
|
||||
unitTypes.vehicles.IFV = [
|
||||
"AAV7",
|
||||
"BMD-1",
|
||||
"BMP-1",
|
||||
"BMP-2",
|
||||
"BMP-3",
|
||||
"Boman",
|
||||
"BRDM-2",
|
||||
"BTR-80",
|
||||
"BTR_D",
|
||||
"Bunker",
|
||||
"Cobra",
|
||||
"LAV-25",
|
||||
"M1043 HMMWV Armament",
|
||||
"M1045 HMMWV TOW",
|
||||
"M1126 Stryker ICV",
|
||||
"M-113",
|
||||
"M1134 Stryker ATGM",
|
||||
"M-2 Bradley",
|
||||
"Marder",
|
||||
"MCV-80",
|
||||
"MTLB",
|
||||
"Paratrooper RPG-16",
|
||||
"Paratrooper AKS-74",
|
||||
"Sandbox",
|
||||
"Soldier AK",
|
||||
"Infantry AK",
|
||||
"Soldier M249",
|
||||
"Soldier M4",
|
||||
"Soldier M4 GRG",
|
||||
"Soldier RPG",
|
||||
"TPZ"
|
||||
]
|
||||
|
||||
unitTypes.vehicles.MLRS = [
|
||||
"Grad-URAL",
|
||||
"Uragan_BM-27",
|
||||
"Smerch",
|
||||
"MLRS"
|
||||
]
|
||||
|
||||
unitTypes.vehicles.SAM = [
|
||||
"2S6 Tunguska",
|
||||
"Kub 2P25 ln",
|
||||
"5p73 s-125 ln",
|
||||
"S-300PS 5P85C ln",
|
||||
"S-300PS 5P85D ln",
|
||||
"SA-11 Buk LN 9A310M1",
|
||||
"Osa 9A33 ln",
|
||||
"Tor 9A331",
|
||||
"Strela-10M3",
|
||||
"Strela-1 9P31",
|
||||
"SA-11 Buk CC 9S470M1",
|
||||
"SA-8 Osa LD 9T217",
|
||||
"Patriot AMG",
|
||||
"Patriot ECS",
|
||||
"Gepard",
|
||||
"Hawk pcp",
|
||||
"SA-18 Igla manpad",
|
||||
"SA-18 Igla comm",
|
||||
"Igla manpad INS",
|
||||
"SA-18 Igla-S manpad",
|
||||
"SA-18 Igla-S comm",
|
||||
"Vulcan",
|
||||
"Hawk ln",
|
||||
"M48 Chaparral",
|
||||
"M6 Linebacker",
|
||||
"Patriot ln",
|
||||
"M1097 Avenger",
|
||||
"Patriot EPP",
|
||||
"Patriot cp",
|
||||
"Roland ADS",
|
||||
"S-300PS 54K6 cp",
|
||||
"Stinger manpad GRG",
|
||||
"Stinger manpad dsr",
|
||||
"Stinger comm dsr",
|
||||
"Stinger manpad",
|
||||
"Stinger comm",
|
||||
"ZSU-23-4 Shilka",
|
||||
"ZU-23 Emplacement Closed",
|
||||
"ZU-23 Emplacement",
|
||||
"ZU-23 Closed Insurgent",
|
||||
"Ural-375 ZU-23 Insurgent",
|
||||
"ZU-23 Insurgent",
|
||||
"Ural-375 ZU-23"
|
||||
]
|
||||
|
||||
unitTypes.vehicles.Radar = [
|
||||
"1L13 EWR",
|
||||
"Kub 1S91 str",
|
||||
"S-300PS 40B6M tr",
|
||||
"S-300PS 40B6MD sr",
|
||||
"55G6 EWR",
|
||||
"S-300PS 64H6E sr",
|
||||
"SA-11 Buk SR 9S18M1",
|
||||
"Dog Ear radar",
|
||||
"Hawk tr",
|
||||
"Hawk sr",
|
||||
"Patriot str",
|
||||
"Hawk cwar",
|
||||
"p-19 s-125 sr",
|
||||
"Roland Radar",
|
||||
"snr s-125 tr"
|
||||
]
|
||||
|
||||
unitTypes.vehicles.Structures = [
|
||||
"house1arm",
|
||||
"house2arm",
|
||||
"outpost_road",
|
||||
"outpost",
|
||||
"houseA_arm"
|
||||
]
|
||||
|
||||
unitTypes.vehicles.Tanks = [
|
||||
"Challenger2",
|
||||
"Leclerc",
|
||||
"Leopard1A3",
|
||||
"Leopard-2",
|
||||
"M-60",
|
||||
"M1128 Stryker MGS",
|
||||
"M-1 Abrams",
|
||||
"T-55",
|
||||
"T-72B",
|
||||
"T-80UD",
|
||||
"T-90"
|
||||
]
|
||||
|
||||
unitTypes.vehicles.Unarmed = [
|
||||
"Ural-4320 APA-5D",
|
||||
"ATMZ-5",
|
||||
"ATZ-10",
|
||||
"GAZ-3307",
|
||||
"GAZ-3308",
|
||||
"GAZ-66",
|
||||
"M978 HEMTT Tanker",
|
||||
"HEMTT TFFT",
|
||||
"IKARUS Bus",
|
||||
"KAMAZ Truck",
|
||||
"LAZ Bus",
|
||||
"Hummer",
|
||||
"M 818",
|
||||
"MAZ-6303",
|
||||
"Predator GCS",
|
||||
"Predator TrojanSpirit",
|
||||
"Suidae",
|
||||
"Tigr_233036",
|
||||
"Trolley bus",
|
||||
"UAZ-469",
|
||||
"Ural ATsP-6",
|
||||
"Ural-375 PBU",
|
||||
"Ural-375",
|
||||
"Ural-4320-31",
|
||||
"Ural-4320T",
|
||||
"VAZ Car",
|
||||
"ZiL-131 APA-80",
|
||||
"SKP-11",
|
||||
"ZIL-131 KUNG",
|
||||
"ZIL-4331"
|
||||
]
|
||||
Reference in New Issue
Block a user