Skip to content

Commit

Permalink
When selecting only warriors, automatically switch to combat mode. wh…
Browse files Browse the repository at this point in the history
…en selecting only worker pawns, Automatically switch to build mode
  • Loading branch information
remmintan committed Apr 15, 2024
1 parent 215c4ed commit 2a67dec
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.remmintan.mods.minefortress.core.interfaces.combat.ITargetedSelectionManager;
import net.remmintan.mods.minefortress.core.interfaces.entities.pawns.IFortressAwareEntity;
import net.remmintan.mods.minefortress.core.interfaces.entities.pawns.ITargetedPawn;
import net.remmintan.mods.minefortress.core.interfaces.entities.pawns.IWarrior;
import net.remmintan.mods.minefortress.core.utils.GlobalProjectionCache;
import org.minefortress.renderer.CameraTools;
import org.minefortress.utils.ModUtils;
Expand Down Expand Up @@ -47,6 +48,12 @@ public void endSelection(double x, double y) {

if(!this.selectedPawns.isEmpty()) {
final var fortressManager = ModUtils.getFortressClientManager();
if (this.selectedPawns.stream().allMatch(it -> it instanceof IWarrior)) {
fortressManager.setState(FortressState.COMBAT);
} else if (this.selectedPawns.stream().noneMatch(it -> it instanceof IWarrior)) {
fortressManager.setState(FortressState.BUILD_EDITING);
}

if (fortressManager.getState() != FortressState.COMBAT) {
fortressManager.setState(FortressState.BUILD_EDITING);
}
Expand Down

0 comments on commit 2a67dec

Please sign in to comment.