fix numerous UI elements using is_ownfor

This commit is contained in:
Eclipse/Druss99
2025-10-14 21:42:40 -04:00
committed by Raffson
parent 624f2a00fd
commit 3d788e3ae8
12 changed files with 33 additions and 21 deletions

View File

@@ -38,7 +38,7 @@ class IBuilder(ABC, Generic[FlightPlanT, LayoutT]):
self._generate_package_waypoints_if_needed(dump_debug_info)
self._flight_plan = self.build(dump_debug_info)
except NavMeshError as ex:
color = "blue" if self.flight.squadron.player else "red"
color = "blue" if self.flight.squadron.player.is_blue else "red"
raise PlanningError(
f"Could not plan {color} {self.flight.flight_type.value} from "
f"{self.flight.departure} to {self.package.target}"

View File

@@ -27,7 +27,7 @@ class FrontLineStanceTask(TheaterCommanderTask, ABC):
@staticmethod
def management_allowed(state: TheaterState) -> bool:
return (
not state.context.coalition.player
not state.context.coalition.player.is_blue
or state.context.settings.automate_front_line_stance
)

View File

@@ -45,7 +45,7 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]):
def preconditions_met(self, state: TheaterState) -> bool:
if (
state.context.coalition.player
state.context.coalition.player.is_blue
and state.context.settings.auto_ato_behavior is AutoAtoBehavior.Disabled
):
return False
@@ -102,7 +102,7 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]):
return 1
def fulfill_mission(self, state: TheaterState) -> bool:
color = "blue" if state.context.coalition.player else "red"
color = "blue" if state.context.coalition.player.is_blue else "red"
self.propose_flights()
fulfiller = PackageFulfiller(
state.context.coalition,
@@ -214,7 +214,7 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]):
settings = state.context.coalition.game.settings
margin = 100 - (
settings.ownfor_autoplanner_aggressiveness
if state.context.coalition.player
if state.context.coalition.player.is_blue
else settings.opfor_autoplanner_aggressiveness
)
threat_range = iads_threat.max_threat_range() * (margin / 100)

View File

@@ -12,7 +12,7 @@ from game.theater import MissionTarget
class PlanAewc(PackagePlanningTask[MissionTarget]):
def preconditions_met(self, state: TheaterState) -> bool:
if (
state.context.coalition.player
state.context.coalition.player.is_blue
and not state.context.settings.auto_ato_behavior_awacs
):
return False

View File

@@ -14,7 +14,7 @@ MARGIN = 4 # assume 4 aircraft can land without refueling
class PlanRecovery(PackagePlanningTask[ControlPoint]):
def preconditions_met(self, state: TheaterState) -> bool:
if (
state.context.coalition.player
state.context.coalition.player.is_blue
and not state.context.settings.auto_ato_behavior_tankers
):
return False

View File

@@ -12,7 +12,7 @@ from game.theater import MissionTarget
class PlanRefueling(PackagePlanningTask[MissionTarget]):
def preconditions_met(self, state: TheaterState) -> bool:
if (
state.context.coalition.player
state.context.coalition.player.is_blue
and not state.context.settings.auto_ato_behavior_tankers
):
return False

View File

@@ -866,7 +866,7 @@ class HelipadGenerator:
if self.game.position_culled(helipad):
cull_farp_statics = True
if self.cp.coalition.player:
if self.cp.coalition.player.is_blue:
for package in self.cp.coalition.ato.packages:
for flight in package.flights:
if flight.squadron.location == self.cp:
@@ -998,7 +998,7 @@ class GroundSpawnRoadbaseGenerator:
cull_farp_statics = True
elif self.game.position_culled(ground_spawn[0]):
cull_farp_statics = True
if self.cp.coalition.player:
if self.cp.coalition.player.is_blue:
for package in self.cp.coalition.ato.packages:
for flight in package.flights:
if flight.squadron.location == self.cp:
@@ -1277,7 +1277,7 @@ class GroundSpawnGenerator:
cull_farp_statics = True
elif self.game.position_culled(vtol_pad[0]):
cull_farp_statics = True
if self.cp.coalition.player:
if self.cp.coalition.player.is_blue:
for package in self.cp.coalition.ato.packages:
for flight in package.flights:
if flight.squadron.location == self.cp: