mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Warning now only shows when humans are in the selection.
This commit is contained in:
@@ -330,8 +330,17 @@ export class UnitsManager {
|
|||||||
|
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
#onKeyUp(event: KeyboardEvent) {
|
#onKeyUp(event: KeyboardEvent) {
|
||||||
if (!keyEventWasInInput(event) && event.key === "Delete" && confirm( "Are you sure you want to delete?" ) ) {
|
if (!keyEventWasInInput(event) && event.key === "Delete" ) {
|
||||||
this.selectedUnitsDelete();
|
|
||||||
|
const selectedUnits = this.getSelectedUnits();
|
||||||
|
const selectionContainsAHuman = selectedUnits.some( ( unit:Unit ) => {
|
||||||
|
return unit.getBaseData().AI === false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if ( !selectionContainsAHuman || confirm( "Your selection includes a human player. Deleting humans causes their vehicle to crash.\n\nAre you sure you want to do this?" ) ) {
|
||||||
|
this.selectedUnitsDelete();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user