mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix: Ground units spawned in group are on top of each other, no heading when importing units
Units spawned via map, context menu, or unit spawn menu now include a heading property and are offset in latitude to prevent overlap. Also ensures heading is set during import/export. Minor JSX formatting improvements in UnitSpawnMenu.
This commit is contained in:
parent
89bd39cea8
commit
e4af9b06d3
@ -1055,7 +1055,13 @@ export class Map extends L.Map {
|
||||
.getUnitsManager()
|
||||
.spawnUnits(
|
||||
this.#spawnRequestTable.category,
|
||||
Array(this.#spawnRequestTable.amount).fill(this.#spawnRequestTable.unit),
|
||||
Array(this.#spawnRequestTable.amount).fill(this.#spawnRequestTable.unit).map((unit, index) => {
|
||||
return {
|
||||
...unit,
|
||||
location: new L.LatLng(unit.location.lat + (this.#spawnRequestTable?.category === "groundunit" ? 0.00025 * index : 0.005 * index), unit.location.lng),
|
||||
heading: this.#spawnHeading,
|
||||
};
|
||||
}),
|
||||
this.#spawnRequestTable.coalition,
|
||||
false,
|
||||
undefined,
|
||||
|
||||
@ -660,7 +660,13 @@ export function SpawnContextMenu(props: {}) {
|
||||
.getUnitsManager()
|
||||
.spawnUnits(
|
||||
spawnRequestTable.category,
|
||||
Array(spawnRequestTable.amount).fill(spawnRequestTable.unit),
|
||||
Array(spawnRequestTable.amount).fill(spawnRequestTable.unit).map((unit, index) => {
|
||||
return {
|
||||
...unit,
|
||||
location: new LatLng(unit.location.lat + (spawnRequestTable?.category === "groundunit" ? 0.00025 * index : 0.005 * index), unit.location.lng),
|
||||
heading: unit.heading || 0,
|
||||
};
|
||||
}),
|
||||
spawnRequestTable.coalition,
|
||||
false
|
||||
);
|
||||
|
||||
@ -319,7 +319,7 @@ export function ImportExportModal(props: { open: boolean }) {
|
||||
if (selectionFilter[coalition][markerCategory] !== true) continue;
|
||||
|
||||
let unitsToSpawn = groupData.map((unitData: UnitData) => {
|
||||
return { unitType: unitData.name, location: unitData.position, liveryID: "", skill: "High" };
|
||||
return { unitType: unitData.name, location: unitData.position, liveryID: "", skill: "High", heading: unitData.heading || 0 };
|
||||
});
|
||||
|
||||
getApp().getUnitsManager().spawnUnits(category.toLocaleLowerCase(), unitsToSpawn, coalition, false);
|
||||
|
||||
@ -451,10 +451,9 @@ export function UnitSpawnMenu(props: {
|
||||
`}
|
||||
>
|
||||
{props.blueprint?.liveries && props.blueprint?.liveries[id].countries.length == 1 && (
|
||||
<img
|
||||
src={`images/countries/${country?.flagCode.toLowerCase()}.svg`}
|
||||
className={`h-6`}
|
||||
/>
|
||||
<img src={`images/countries/${country?.flagCode.toLowerCase()}.svg`} className={`
|
||||
h-6
|
||||
`} />
|
||||
)}
|
||||
|
||||
<div className="my-auto truncate">
|
||||
@ -521,12 +520,9 @@ export function UnitSpawnMenu(props: {
|
||||
<div className="my-auto flex flex-col gap-2">
|
||||
<span>Spawn heading</span>
|
||||
<div className="flex gap-1 text-sm text-gray-400">
|
||||
<FaQuestionCircle className={`my-auto`} />{" "}
|
||||
<div
|
||||
className={`my-auto`}
|
||||
>
|
||||
Drag to change
|
||||
</div>
|
||||
<FaQuestionCircle className={`my-auto`} /> <div className={`
|
||||
my-auto
|
||||
`}>Drag to change</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -632,7 +628,15 @@ export function UnitSpawnMenu(props: {
|
||||
.getUnitsManager()
|
||||
.spawnUnits(
|
||||
spawnRequestTable.category,
|
||||
Array(spawnRequestTable.amount).fill(spawnRequestTable.unit),
|
||||
Array(spawnRequestTable.amount)
|
||||
.fill(spawnRequestTable.unit)
|
||||
.map((unit, index) => {
|
||||
return {
|
||||
...unit,
|
||||
location: new LatLng(unit.location.lat + (spawnRequestTable?.category === "groundunit" ? 0.00025 * index : 0.005 * index), unit.location.lng),
|
||||
heading: unit.heading || 0,
|
||||
};
|
||||
}),
|
||||
spawnRequestTable.coalition,
|
||||
false,
|
||||
props.airbase?.getName() ?? undefined
|
||||
@ -912,9 +916,12 @@ export function UnitSpawnMenu(props: {
|
||||
`}
|
||||
>
|
||||
{props.blueprint?.liveries && props.blueprint?.liveries[id].countries.length == 1 && (
|
||||
<img src={`images/countries/${country?.flagCode.toLowerCase()}.svg`} className={`
|
||||
<img
|
||||
src={`images/countries/${country?.flagCode.toLowerCase()}.svg`}
|
||||
className={`
|
||||
h-6
|
||||
`} />
|
||||
`}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="my-auto truncate">
|
||||
@ -980,12 +987,9 @@ export function UnitSpawnMenu(props: {
|
||||
<div className="my-auto flex flex-col gap-2">
|
||||
<span className="text-white">Spawn heading</span>
|
||||
<div className="flex gap-1 text-sm text-gray-400">
|
||||
<FaQuestionCircle className={`my-auto`} />{" "}
|
||||
<div
|
||||
className={`my-auto`}
|
||||
>
|
||||
Drag to change
|
||||
</div>
|
||||
<FaQuestionCircle className={`my-auto`} /> <div className={`
|
||||
my-auto
|
||||
`}>Drag to change</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user