refactor of previous commits

refactor to enum

typing and many other fixes

fix tests

attempt to fix some typescript

more typescript fixes

more typescript test fixes

revert all API changes

update to pydcs

mypy fixes

Use properties to check if player is blue/red/neutral

update requirements.txt

black -_-

bump pydcs and fix mypy

add opponent property

bump pydcs
This commit is contained in:
Eclipse/Druss99
2025-01-17 17:02:07 -05:00
committed by Raffson
parent 362ce66f80
commit 31c80dfd02
78 changed files with 739 additions and 350 deletions

View File

@@ -46,7 +46,7 @@ class AirCombat(JoinableCombat):
blue_flights = []
red_flights = []
for flight in self.flights:
if flight.squadron.player:
if flight.squadron.player.is_blue:
blue_flights.append(str(flight))
else:
red_flights.append(str(flight))
@@ -71,7 +71,7 @@ class AirCombat(JoinableCombat):
blue = []
red = []
for flight in self.flights:
if flight.squadron.player:
if flight.squadron.player.is_blue:
blue.append(flight)
else:
red.append(flight)

View File

@@ -6,6 +6,7 @@ from collections.abc import Iterator
from datetime import timedelta
from typing import Optional, TYPE_CHECKING
from game.theater.player import Player
from .aircombat import AirCombat
from .aircraftengagementzones import AircraftEngagementZones
from .atip import AtIp
@@ -31,8 +32,10 @@ class CombatInitiator:
def update_active_combats(self) -> None:
blue_a2a = AircraftEngagementZones.from_ato(self.game.blue.ato)
red_a2a = AircraftEngagementZones.from_ato(self.game.red.ato)
blue_sam = SamEngagementZones.from_theater(self.game.theater, player=True)
red_sam = SamEngagementZones.from_theater(self.game.theater, player=False)
blue_sam = SamEngagementZones.from_theater(
self.game.theater, player=Player.BLUE
)
red_sam = SamEngagementZones.from_theater(self.game.theater, player=Player.RED)
# Check each vulnerable flight to see if it has initiated combat. If any flight
# initiates combat, a single FrozenCombat will be created for all involved
@@ -46,7 +49,7 @@ class CombatInitiator:
if flight.state.in_combat:
return
if flight.squadron.player:
if flight.squadron.player.is_blue:
a2a = red_a2a
own_a2a = blue_a2a
sam = red_sam

View File

@@ -9,7 +9,7 @@ from shapely.ops import unary_union
from game.utils import dcs_to_shapely_point
if TYPE_CHECKING:
from game.theater import ConflictTheater, TheaterGroundObject
from game.theater import ConflictTheater, TheaterGroundObject, Player
from game.threatzones import ThreatPoly
@@ -31,7 +31,9 @@ class SamEngagementZones:
yield tgo
@classmethod
def from_theater(cls, theater: ConflictTheater, player: bool) -> SamEngagementZones:
def from_theater(
cls, theater: ConflictTheater, player: Player
) -> SamEngagementZones:
commit_regions = []
individual_zones = []
for cp in theater.control_points_for(player):