mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-01 21:22:05 +00:00
Fix non-structures being deleteable (#4385)
Resolves #4307 ## Description: Adds a check for the "delete" element of the raidial menu, to make sure the unit attemped to be removed is a structure. Previously, non-structure units such as trains could be deleted using the menu. ## Please complete the following: - [ ] I have added screenshots for all UI updates (No UI updates) - [ ] I process any text displayed to the user through translateText() and I've added it to the en.json file (No text added) - [ ] I have added relevant tests to the test directory (Not sure how this works or if it's needed) ## Please put your Discord username so you can be contacted if a bug or regression is found: unne27 --------- Co-authored-by: unne27 <uno.gunnar.johansson@gmail.com>
This commit is contained in:
@@ -528,6 +528,7 @@ export const deleteUnitElement: MenuElement = {
|
||||
(unit) =>
|
||||
!unit.isUnderConstruction() &&
|
||||
unit.markedForDeletion() === false &&
|
||||
Structures.has(unit.type()) &&
|
||||
params.game.manhattanDist(unit.tile(), params.tile) <=
|
||||
DELETE_SELECTION_RADIUS,
|
||||
);
|
||||
@@ -552,8 +553,11 @@ export const deleteUnitElement: MenuElement = {
|
||||
.units()
|
||||
.filter(
|
||||
(unit) =>
|
||||
!unit.isUnderConstruction() &&
|
||||
unit.markedForDeletion() === false &&
|
||||
Structures.has(unit.type()) &&
|
||||
params.game.manhattanDist(unit.tile(), params.tile) <=
|
||||
DELETE_SELECTION_RADIUS,
|
||||
DELETE_SELECTION_RADIUS,
|
||||
);
|
||||
|
||||
const closestUnit = findClosestBy(myUnits, (unit) =>
|
||||
|
||||
Reference in New Issue
Block a user