mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Minor bug fixing, added patcher for Export.lua, added plugin options to enable/disable mod
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import { Marker, LatLng, Polyline, Icon } from 'leaflet';
|
||||
import { ConvertDDToDMS } from '../other/utils';
|
||||
import { getMap, getUnitsManager, getVisibilitySettings } from '..';
|
||||
import { getMap, getUnitsManager} from '..';
|
||||
import { UnitMarker, MarkerOptions, AircraftMarker, HelicopterMarker, GroundUnitMarker, NavyUnitMarker, WeaponMarker } from './unitmarker';
|
||||
import { addDestination, attackUnit, changeAltitude, changeSpeed, createFormation as setLeader, landAt, setAltitude, setReactionToThreat, setROE, setSpeed } from '../dcs/dcs';
|
||||
|
||||
interface visibilityOptions {
|
||||
dead: string;
|
||||
ai: string;
|
||||
uncontrolled: string;
|
||||
human: string;
|
||||
}
|
||||
|
||||
var pathIcon = new Icon({
|
||||
iconUrl: 'images/marker-icon.png',
|
||||
shadowUrl: 'images/marker-shadow.png',
|
||||
@@ -387,20 +393,33 @@ export class Unit {
|
||||
}
|
||||
|
||||
export class AirUnit extends Unit {
|
||||
getHidden() {
|
||||
if (this.AI == false && getVisibilitySettings().uncontrolled === "hidden")
|
||||
return true
|
||||
static visibility: visibilityOptions = {dead: "hidden", ai: "partial", uncontrolled: "partial", human: "partial"}
|
||||
static setVisibility(visibility: visibilityOptions)
|
||||
{
|
||||
getUnitsManager().forceUpdate();
|
||||
AirUnit.visibility = visibility;
|
||||
}
|
||||
|
||||
static getVisibility()
|
||||
{
|
||||
return AirUnit.visibility;
|
||||
}
|
||||
|
||||
getHidden() {
|
||||
if (this.alive)
|
||||
{
|
||||
if (this.flags.user && getVisibilitySettings().user === "hidden")
|
||||
return true
|
||||
else if (!this.flags.user && getVisibilitySettings().ai === "hidden")
|
||||
return true
|
||||
if (this.flags.user)
|
||||
return AirUnit.getVisibility().human === "hidden"
|
||||
|
||||
if (this.AI)
|
||||
return AirUnit.getVisibility().ai === "hidden"
|
||||
else
|
||||
return AirUnit.getVisibility().uncontrolled === "hidden"
|
||||
}
|
||||
else
|
||||
return getVisibilitySettings().dead === "hidden"
|
||||
return false;
|
||||
{
|
||||
return AirUnit.getVisibility().dead === "hidden"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,52 +438,87 @@ export class Helicopter extends AirUnit {
|
||||
}
|
||||
|
||||
export class GroundUnit extends Unit {
|
||||
static visibility: visibilityOptions = {dead: "hidden", ai: "partial", uncontrolled: "partial", human: "partial"}
|
||||
static setVisibility(visibility: visibilityOptions)
|
||||
{
|
||||
getUnitsManager().forceUpdate();
|
||||
GroundUnit.visibility = visibility;
|
||||
}
|
||||
|
||||
static getVisibility()
|
||||
{
|
||||
return GroundUnit.visibility;
|
||||
}
|
||||
|
||||
constructor(ID: number, options: MarkerOptions) {
|
||||
var marker = new GroundUnitMarker(options);
|
||||
super(ID, marker);
|
||||
}
|
||||
|
||||
getHidden() {
|
||||
if (this.AI == false && getVisibilitySettings().uncontrolled === "hidden")
|
||||
return true
|
||||
|
||||
if (this.alive)
|
||||
{
|
||||
if (this.flags.user && getVisibilitySettings().user === "hidden")
|
||||
return true
|
||||
else if (!this.flags.user && getVisibilitySettings().ai === "hidden")
|
||||
return true
|
||||
if (this.flags.user)
|
||||
return GroundUnit.getVisibility().human === "hidden"
|
||||
|
||||
if (this.AI)
|
||||
return GroundUnit.getVisibility().ai === "hidden"
|
||||
else
|
||||
return GroundUnit.getVisibility().uncontrolled === "hidden"
|
||||
}
|
||||
else
|
||||
return getVisibilitySettings().dead === "hidden"
|
||||
return false;
|
||||
{
|
||||
return GroundUnit.getVisibility().dead === "hidden"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class NavyUnit extends Unit {
|
||||
static visibility: visibilityOptions = {dead: "hidden", ai: "partial", uncontrolled: "partial", human: "partial"}
|
||||
static setVisibility(visibility: visibilityOptions)
|
||||
{
|
||||
getUnitsManager().forceUpdate();
|
||||
NavyUnit.visibility = visibility;
|
||||
}
|
||||
|
||||
static getVisibility()
|
||||
{
|
||||
return NavyUnit.visibility;
|
||||
}
|
||||
|
||||
constructor(ID: number, options: MarkerOptions) {
|
||||
var marker = new NavyUnitMarker(options);
|
||||
super(ID, marker);
|
||||
}
|
||||
|
||||
getHidden() {
|
||||
if (this.AI == false && getVisibilitySettings().uncontrolled === "hidden")
|
||||
return true
|
||||
|
||||
if (this.alive)
|
||||
{
|
||||
if (this.flags.user && getVisibilitySettings().user === "hidden")
|
||||
return true
|
||||
else if (!this.flags.user && getVisibilitySettings().ai === "hidden")
|
||||
return true
|
||||
if (this.AI)
|
||||
return NavyUnit.getVisibility().ai === "hidden"
|
||||
else
|
||||
return NavyUnit.getVisibility().uncontrolled === "hidden"
|
||||
}
|
||||
else
|
||||
return getVisibilitySettings().dead === "hidden"
|
||||
return false;
|
||||
{
|
||||
return NavyUnit.getVisibility().dead === "hidden"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Weapon extends Unit {
|
||||
static visibility: visibilityOptions = {dead: "hidden", ai: "partial", uncontrolled: "partial", human: "partial"}
|
||||
static setVisibility(visibility: visibilityOptions)
|
||||
{
|
||||
getUnitsManager().forceUpdate();
|
||||
Weapon.visibility = visibility;
|
||||
}
|
||||
|
||||
static getVisibility()
|
||||
{
|
||||
return Weapon.visibility;
|
||||
}
|
||||
|
||||
constructor(ID: number, marker: UnitMarker)
|
||||
{
|
||||
super(ID, marker);
|
||||
@@ -473,13 +527,9 @@ export class Weapon extends Unit {
|
||||
|
||||
getHidden() {
|
||||
if (this.alive)
|
||||
{
|
||||
if (!this.flags.user && getVisibilitySettings().weapon === "hidden")
|
||||
return true
|
||||
}
|
||||
return Weapon.getVisibility().uncontrolled === "hidden"
|
||||
else
|
||||
return getVisibilitySettings().dead === "hidden"
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as L from 'leaflet'
|
||||
import { Symbol } from 'milsymbol'
|
||||
import { getVisibilitySettings } from '..'
|
||||
import { AirUnit, GroundUnit, NavyUnit, Weapon } from './unit'
|
||||
|
||||
export interface MarkerOptions {
|
||||
unitName: string
|
||||
@@ -88,13 +88,13 @@ export class UnitMarker extends L.Marker {
|
||||
speedDiv.style.display = '';
|
||||
|
||||
/* If visibility is partial shown only icon and unit name. If none, shown only icon. */
|
||||
if (this.getVisibility() === "partial" || this.getVisibility() === "none")
|
||||
if (this.getVisibility() === "partial" || this.getVisibility() === "minimal")
|
||||
{
|
||||
unitNameDiv.style.display = 'none';
|
||||
altitudeDiv.style.display = 'none';
|
||||
speedDiv.style.display = 'none';
|
||||
}
|
||||
if (this.getVisibility() === "none" && nameDiv.style.display != 'none')
|
||||
if (this.getVisibility() === "minimal" && nameDiv.style.display != 'none')
|
||||
nameDiv.style.display = 'none';
|
||||
|
||||
nameDiv.style.left = (-(nameDiv.offsetWidth - container.offsetWidth) / 2) + "px";
|
||||
@@ -225,15 +225,19 @@ export class UnitMarker extends L.Marker {
|
||||
|
||||
export class AirUnitMarker extends UnitMarker {
|
||||
getVisibility() {
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
|
||||
if (this.getHuman())
|
||||
return getVisibilitySettings().user;
|
||||
else if (!this.getAlive())
|
||||
return "none";
|
||||
else
|
||||
return this.getAI()? getVisibilitySettings().ai: getVisibilitySettings().uncontrolled;
|
||||
if (this.getAlive())
|
||||
{
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
else if (this.getHuman())
|
||||
return AirUnit.getVisibility().human;
|
||||
else if (this.getAI())
|
||||
return AirUnit.getVisibility().ai;
|
||||
else
|
||||
return AirUnit.getVisibility().uncontrolled;
|
||||
}
|
||||
else
|
||||
return "minimal";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,38 +250,54 @@ export class HelicopterMarker extends AirUnitMarker {
|
||||
export class GroundUnitMarker extends UnitMarker {
|
||||
/* Are user driven units recognized as human? */
|
||||
getVisibility() {
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
|
||||
if (this.getHuman())
|
||||
return getVisibilitySettings().user;
|
||||
else if (!this.getAlive())
|
||||
return "none";
|
||||
else
|
||||
return this.getAI()? getVisibilitySettings().ai: getVisibilitySettings().uncontrolled;
|
||||
if (this.getAlive())
|
||||
{
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
else if (this.getHuman())
|
||||
return GroundUnit.getVisibility().human;
|
||||
else if (this.getAI())
|
||||
return GroundUnit.getVisibility().ai;
|
||||
else
|
||||
return GroundUnit.getVisibility().uncontrolled;
|
||||
}
|
||||
else
|
||||
return "minimal";
|
||||
}
|
||||
}
|
||||
|
||||
export class NavyUnitMarker extends UnitMarker {
|
||||
getVisibility() {
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
|
||||
if (!this.getAlive())
|
||||
return "none";
|
||||
else
|
||||
return this.getAI()? getVisibilitySettings().ai: getVisibilitySettings().uncontrolled;
|
||||
if (this.getAlive())
|
||||
{
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
else if (this.getHuman())
|
||||
return NavyUnit.getVisibility().human;
|
||||
else if (this.getAI())
|
||||
return NavyUnit.getVisibility().ai;
|
||||
else
|
||||
return NavyUnit.getVisibility().uncontrolled;
|
||||
}
|
||||
else
|
||||
return "minimal";
|
||||
}
|
||||
}
|
||||
|
||||
export class WeaponMarker extends UnitMarker {
|
||||
getVisibility() {
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
|
||||
if (!this.getAlive())
|
||||
return "none";
|
||||
else
|
||||
return getVisibilitySettings().weapon;
|
||||
if (this.getAlive())
|
||||
{
|
||||
if (this.getSelected())
|
||||
return "full";
|
||||
else if (this.getHuman())
|
||||
return Weapon.getVisibility().human;
|
||||
else if (this.getAI())
|
||||
return Weapon.getVisibility().ai;
|
||||
else
|
||||
return Weapon.getVisibility().uncontrolled;
|
||||
}
|
||||
else
|
||||
return "minimal";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user