mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
(WiP) Unit spawn menu
This commit is contained in:
@@ -290,7 +290,7 @@ export class Unit extends Marker {
|
||||
'Attack',
|
||||
'Follow'
|
||||
]
|
||||
getMap().showContextMenu(e.originalEvent, "Action: " + this.getData().unitName, options.map((option: string) => {return {tooltip: option, src: "", callback: (action: string) => this.#executeAction(action)}}));
|
||||
//getMap().showContextMenu(e.originalEvent, "Action: " + this.getData().unitName, options.map((option: string) => {return {tooltip: option, src: "", callback: (action: string) => this.#executeAction(action)}}));
|
||||
}
|
||||
|
||||
#executeAction(action: string) {
|
||||
|
||||
@@ -6,6 +6,24 @@ export class UnitDatabase {
|
||||
|
||||
}
|
||||
|
||||
getRoles()
|
||||
{
|
||||
var roles: string[] = [];
|
||||
for (let unit in this.units)
|
||||
{
|
||||
for (let loadout of this.units[unit].loadouts)
|
||||
{
|
||||
for (let role of loadout.roles)
|
||||
{
|
||||
role = role.toUpperCase();
|
||||
if (role !== "" && !roles.includes(role))
|
||||
roles.push(role);
|
||||
}
|
||||
}
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
getLabelsByRole(role: string)
|
||||
{
|
||||
var units = [];
|
||||
@@ -13,7 +31,7 @@ export class UnitDatabase {
|
||||
{
|
||||
for (let loadout of this.units[unit].loadouts)
|
||||
{
|
||||
if (loadout.roles.includes(role))
|
||||
if (loadout.roles.includes(role) || loadout.roles.includes(role.toLowerCase()))
|
||||
{
|
||||
units.push(this.units[unit].label)
|
||||
break;
|
||||
@@ -28,7 +46,7 @@ export class UnitDatabase {
|
||||
var loadouts = [];
|
||||
for (let loadout of this.units[unit].loadouts)
|
||||
{
|
||||
if (loadout.roles.includes(role) || loadout.roles.includes(""))
|
||||
if (loadout.roles.includes(role) || loadout.roles.includes(role.toLowerCase()) || loadout.roles.includes(""))
|
||||
{
|
||||
loadouts.push(loadout.name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user