Merge pull request #527 from Pax1601/522-flashpulse-robot-lock-when-trying-to-give-orders-to-protected-units

Lock flashes on protected robot interaction
This commit is contained in:
Pax1601
2023-11-17 17:23:18 +01:00
committed by GitHub
2 changed files with 18 additions and 1 deletions

View File

@@ -260,6 +260,10 @@ export class UnitsManager {
if (options.showProtectionReminder === true && numProtectedUnits > selectedUnits.length && selectedUnits.length === 0) {
const messageText = (numProtectedUnits === 1) ? `Unit is protected` : `All selected units are protected`;
(getApp().getPopupsManager().get("infoPopup") as Popup).setText(messageText);
// Cheap way for now until we use more locks
let lock = <HTMLElement>document.querySelector("#unit-visibility-control button.lock");
lock.classList.add("prompt");
setTimeout(() => lock.classList.remove("prompt"), 4000);
}
if (options.onlyOnePerGroup) {
@@ -811,7 +815,7 @@ export class UnitsManager {
* @returns
*/
selectedUnitsDelete(explosion: boolean = false, explosionType: string = "") {
var selectedUnits = this.getSelectedUnits({ excludeProtected: true }); /* Can be applied to humans too */
var selectedUnits = this.getSelectedUnits({ excludeProtected: true, showProtectionReminder: true }); /* Can be applied to humans too */
const selectionContainsAHuman = selectedUnits.some((unit: Unit) => {
return unit.getHuman() === true;
});