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:
Pax1601
2025-08-04 20:03:40 +02:00
parent 89bd39cea8
commit e4af9b06d3
4 changed files with 38 additions and 22 deletions

View File

@@ -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
);