mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added ability to delete original cloned units
Mostly useful to group units together
This commit is contained in:
@@ -199,8 +199,8 @@ export function followUnit(ID: number, targetID: number, offset: { "x": number,
|
||||
POST(data, callback);
|
||||
}
|
||||
|
||||
export function cloneUnits(units: {ID: number, location: LatLng}[], callback: CallableFunction = () => {}) {
|
||||
var command = { "units": units };
|
||||
export function cloneUnits(units: {ID: number, location: LatLng}[], deleteOriginal: boolean, callback: CallableFunction = () => {}) {
|
||||
var command = { "units": units, "deleteOriginal": deleteOriginal };
|
||||
var data = { "cloneUnits": command }
|
||||
POST(data, callback);
|
||||
}
|
||||
|
||||
@@ -555,7 +555,6 @@ export class UnitsManager {
|
||||
this.#showActionMessage(selectedUnits, `unit bombing point`);
|
||||
}
|
||||
|
||||
// TODO handle from lua
|
||||
selectedUnitsCreateGroup() {
|
||||
var selectedUnits = this.getSelectedUnits({ excludeHumans: true, onlyOnePerGroup: false });
|
||||
var units: { ID: number, location: LatLng }[] = [];
|
||||
@@ -563,13 +562,11 @@ export class UnitsManager {
|
||||
var unit = selectedUnits[idx];
|
||||
units.push({ ID: unit.ID, location: unit.getPosition() });
|
||||
}
|
||||
cloneUnits(units, () => {
|
||||
cloneUnits(units, true, () => {
|
||||
units.forEach((unit: any) => {
|
||||
deleteUnit(unit.ID, false, false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
@@ -608,7 +605,7 @@ export class UnitsManager {
|
||||
units.push({ ID: unit.ID, location: position });
|
||||
});
|
||||
|
||||
cloneUnits(units, (res: any) => {
|
||||
cloneUnits(units, false, (res: any) => {
|
||||
if (res.commandHash !== undefined) {
|
||||
markers.forEach((marker: TemporaryUnitMarker) => {
|
||||
marker.setCommandHash(res.commandHash);
|
||||
|
||||
Reference in New Issue
Block a user