mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix: Fixed manager not respecting autoconnectwhentrue and srsport settings
This commit is contained in:
@@ -19,13 +19,17 @@ export function OlUnitListEntry(props: {
|
||||
if (["aircraft", "helicopter"].includes(props.blueprint.category)) {
|
||||
let roles = props.blueprint.loadouts?.flatMap((loadout) => loadout.roles).filter((role) => role !== "No task");
|
||||
if (roles !== undefined) {
|
||||
let uniqueRoles = roles?.reduce((acc, current) => {if (!acc.includes(current)) {acc.push(current)} return acc}, [] as string[])
|
||||
let uniqueRoles = roles?.reduce((acc, current) => {
|
||||
if (!acc.includes(current)) {
|
||||
acc.push(current);
|
||||
}
|
||||
return acc;
|
||||
}, [] as string[]);
|
||||
let mainRole = mode(roles);
|
||||
pillString = uniqueRoles.length > 6 ? "Multirole" : mainRole;
|
||||
}
|
||||
} else {
|
||||
if (props.blueprint.category)
|
||||
pillString = props.blueprint.type;
|
||||
if (props.blueprint.category) pillString = props.blueprint.type;
|
||||
}
|
||||
}
|
||||
return (
|
||||
@@ -39,14 +43,15 @@ export function OlUnitListEntry(props: {
|
||||
>
|
||||
{props.icon && <FontAwesomeIcon icon={props.icon} className="text-sm"></FontAwesomeIcon>}
|
||||
{props.silhouette && (
|
||||
<div className={`
|
||||
mr-2 flex h-6 w-6 rotate-90 content-center justify-center opacity-50
|
||||
invert
|
||||
`}>
|
||||
<img
|
||||
src={`./images/units/${props.silhouette}`}
|
||||
className="my-auto max-h-full max-w-full"
|
||||
/>
|
||||
<div
|
||||
className={`
|
||||
mr-2 flex h-6 w-6 rotate-90 content-center justify-center opacity-50
|
||||
invert
|
||||
`}
|
||||
>
|
||||
<img src={`./images/units/${props.silhouette}`} className={`
|
||||
my-auto max-h-full max-w-full
|
||||
`} />
|
||||
</div>
|
||||
)}
|
||||
<div className="flex-1 px-2 text-left font-normal">{props.blueprint.label}</div>
|
||||
|
||||
@@ -81,18 +81,18 @@ export function OlUnitSummary(props: { blueprint: UnitBlueprint; coalition: Coal
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-row gap-1 px-2">
|
||||
{props.blueprint.abilities?.split(" ").map((tag) => {
|
||||
return (
|
||||
{props.blueprint.abilities?.split(" ").map((ability) => {
|
||||
return <>{ ability.replaceAll(" ", "") !== "" &&
|
||||
<div
|
||||
key={tag}
|
||||
key={ability}
|
||||
className={`
|
||||
rounded-full bg-olympus-800 px-2 py-0.5 text-xs font-bold
|
||||
dark:text-olympus-50
|
||||
`}
|
||||
>
|
||||
{tag}
|
||||
{ability}
|
||||
</div>
|
||||
);
|
||||
}</>
|
||||
})}
|
||||
|
||||
<div
|
||||
|
||||
@@ -66,6 +66,7 @@ export function SpawnContextMenu(props: {}) {
|
||||
const [blueprints, setBlueprints] = useState([] as UnitBlueprint[]);
|
||||
const [roles, setRoles] = useState({ aircraft: [] as string[], helicopter: [] as string[] });
|
||||
const [types, setTypes] = useState({ groundunit: [] as string[], navyunit: [] as string[] });
|
||||
const [tags, setTags] = useState({ aircraft: [] as string[], helicopter: [] as string[], groundunit: [] as string[], navyunit: [] as string[] });
|
||||
const [commandModeOptions, setCommandModeOptions] = useState(COMMAND_MODE_OPTIONS_DEFAULTS);
|
||||
const [showCost, setShowCost] = useState(false);
|
||||
const [spawnCoalition, setSpawnCoalition] = useState("blue" as Coalition);
|
||||
@@ -102,6 +103,25 @@ export function SpawnContextMenu(props: {}) {
|
||||
.getDatabase()
|
||||
.getTypes((unit) => unit.category === "navyunit"),
|
||||
});
|
||||
|
||||
setTags({
|
||||
aircraft: getApp()
|
||||
?.getUnitsManager()
|
||||
.getDatabase()
|
||||
.getTags((unit) => unit.category === "aircraft"),
|
||||
helicopter: getApp()
|
||||
?.getUnitsManager()
|
||||
.getDatabase()
|
||||
.getTags((unit) => unit.category === "helicopter"),
|
||||
groundunit: getApp()
|
||||
?.getUnitsManager()
|
||||
.getDatabase()
|
||||
.getTags((unit) => unit.category === "groundunit"),
|
||||
navyunit: getApp()
|
||||
?.getUnitsManager()
|
||||
.getDatabase()
|
||||
.getTags((unit) => unit.category === "navyunit"),
|
||||
});
|
||||
});
|
||||
|
||||
CommandModeOptionsChangedEvent.on((commandModeOptions) => {
|
||||
@@ -314,15 +334,9 @@ export function SpawnContextMenu(props: {}) {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{blueprints?.length === 0 && (
|
||||
<span
|
||||
className={`
|
||||
{blueprints?.length === 0 && <span className={`
|
||||
text-gray-200
|
||||
`}
|
||||
>
|
||||
No aircraft available
|
||||
</span>
|
||||
)}
|
||||
`}>No aircraft available</span>}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -370,15 +384,9 @@ export function SpawnContextMenu(props: {}) {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{blueprints?.length === 0 && (
|
||||
<span
|
||||
className={`
|
||||
{blueprints?.length === 0 && <span className={`
|
||||
text-gray-200
|
||||
`}
|
||||
>
|
||||
No helicopter available
|
||||
</span>
|
||||
)}
|
||||
`}>No helicopter available</span>}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -429,15 +437,9 @@ export function SpawnContextMenu(props: {}) {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{blueprints?.length === 0 && (
|
||||
<span
|
||||
className={`
|
||||
{blueprints?.length === 0 && <span className={`
|
||||
text-gray-200
|
||||
`}
|
||||
>
|
||||
No air defence unit available
|
||||
</span>
|
||||
)}
|
||||
`}>No air defence unit available</span>}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -467,6 +469,29 @@ export function SpawnContextMenu(props: {}) {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{tags.groundunit
|
||||
.sort()
|
||||
.map((type) => {
|
||||
return (
|
||||
<div
|
||||
key={type}
|
||||
data-selected={selectedType === type}
|
||||
className={`
|
||||
cursor-pointer rounded-full bg-olympus-900
|
||||
px-2 py-0.5 text-xs font-bold text-olympus-50
|
||||
data-[selected='true']:bg-blue-500
|
||||
data-[selected='true']:text-gray-200
|
||||
`}
|
||||
onClick={() => {
|
||||
selectedType === type ? setSelectedType(null) : setSelectedType(type);
|
||||
}}
|
||||
>
|
||||
{type}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div
|
||||
className={`
|
||||
flex max-h-[350px] flex-col gap-1 overflow-y-scroll
|
||||
@@ -502,15 +527,9 @@ export function SpawnContextMenu(props: {}) {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{blueprints?.length === 0 && (
|
||||
<span
|
||||
className={`
|
||||
{blueprints?.length === 0 && <span className={`
|
||||
text-gray-200
|
||||
`}
|
||||
>
|
||||
No ground unit available
|
||||
</span>
|
||||
)}
|
||||
`}>No ground unit available</span>}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -558,15 +577,9 @@ export function SpawnContextMenu(props: {}) {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{blueprints?.length === 0 && (
|
||||
<span
|
||||
className={`
|
||||
{blueprints?.length === 0 && <span className={`
|
||||
text-gray-200
|
||||
`}
|
||||
>
|
||||
No navy unit available
|
||||
</span>
|
||||
)}
|
||||
`}>No navy unit available</span>}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user