mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
More refactoring of events
This commit is contained in:
@@ -6,6 +6,7 @@ import { SVGInjector } from "@tanem/svg-injector";
|
||||
import { DLINK, DataIndexes, GAME_MASTER, IRST, OPTIC, RADAR, VISUAL } from "../constants/constants";
|
||||
import { DataExtractor } from "../server/dataextractor";
|
||||
import { ObjectIconOptions } from "../interfaces";
|
||||
import { MapOptionsChangedEvent } from "../events";
|
||||
|
||||
export class Weapon extends CustomMarker {
|
||||
ID: number;
|
||||
@@ -50,9 +51,7 @@ export class Weapon extends CustomMarker {
|
||||
this.ID = ID;
|
||||
|
||||
/* Update the marker when the options change */
|
||||
document.addEventListener("mapOptionsChanged", (ev: CustomEventInit) => {
|
||||
this.#updateMarker();
|
||||
});
|
||||
MapOptionsChangedEvent.on(() => this.#updateMarker());
|
||||
}
|
||||
|
||||
getCategory() {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Weapon } from "./weapon";
|
||||
import { DataIndexes } from "../constants/constants";
|
||||
import { DataExtractor } from "../server/dataextractor";
|
||||
import { Contact } from "../interfaces";
|
||||
import { CommandModeOptionsChangedEvent } from "../events";
|
||||
|
||||
/** The WeaponsManager handles the creation and update of weapons. Data is strictly updated by the server ONLY. */
|
||||
export class WeaponsManager {
|
||||
@@ -11,7 +12,7 @@ export class WeaponsManager {
|
||||
constructor() {
|
||||
this.#weapons = {};
|
||||
|
||||
document.addEventListener("commandModeOptionsChanged", () => {
|
||||
CommandModeOptionsChangedEvent.on(() => {
|
||||
Object.values(this.#weapons).forEach((weapon: Weapon) => weapon.updateVisibility());
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user