mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Removed radials from control point data. (Not used anymore)
This commit is contained in:
parent
789b618e37
commit
9c1d36d18a
@ -64,33 +64,6 @@ IMPORTANCE_LOW = 1
|
|||||||
IMPORTANCE_MEDIUM = 1.2
|
IMPORTANCE_MEDIUM = 1.2
|
||||||
IMPORTANCE_HIGH = 1.4
|
IMPORTANCE_HIGH = 1.4
|
||||||
|
|
||||||
"""
|
|
||||||
ALL_RADIALS = [0, 45, 90, 135, 180, 225, 270, 315, ]
|
|
||||||
COAST_NS_E = [45, 90, 135, ]
|
|
||||||
COAST_EW_N = [315, 0, 45, ]
|
|
||||||
COAST_NSEW_E = [225, 270, 315, ]
|
|
||||||
COAST_NSEW_W = [45, 90, 135, ]
|
|
||||||
|
|
||||||
COAST_NS_W = [225, 270, 315, ]
|
|
||||||
COAST_EW_S = [135, 180, 225, ]
|
|
||||||
"""
|
|
||||||
|
|
||||||
LAND = [0, 45, 90, 135, 180, 225, 270, 315, ]
|
|
||||||
|
|
||||||
COAST_V_E = [0, 45, 90, 135, 180]
|
|
||||||
COAST_V_W = [180, 225, 270, 315, 0]
|
|
||||||
|
|
||||||
COAST_A_W = [315, 0, 45, 135, 180, 225, 270]
|
|
||||||
COAST_A_E = [0, 45, 90, 135, 180, 225, 315]
|
|
||||||
|
|
||||||
COAST_H_N = [270, 315, 0, 45, 90]
|
|
||||||
COAST_H_S = [90, 135, 180, 225, 270]
|
|
||||||
|
|
||||||
COAST_DL_E = [45, 90, 135, 180, 225]
|
|
||||||
COAST_DL_W = [225, 270, 315, 0, 45]
|
|
||||||
COAST_DR_E = [315, 0, 45, 90, 135]
|
|
||||||
COAST_DR_W = [135, 180, 225, 315]
|
|
||||||
|
|
||||||
FRONTLINE_MIN_CP_DISTANCE = 5000
|
FRONTLINE_MIN_CP_DISTANCE = 5000
|
||||||
|
|
||||||
def pairwise(iterable):
|
def pairwise(iterable):
|
||||||
@ -151,8 +124,6 @@ class MizCampaignLoader:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def control_point_from_airport(airport: Airport) -> ControlPoint:
|
def control_point_from_airport(airport: Airport) -> ControlPoint:
|
||||||
# TODO: Radials?
|
|
||||||
radials = LAND
|
|
||||||
|
|
||||||
# The wiki says this is a legacy property and to just use regular.
|
# The wiki says this is a legacy property and to just use regular.
|
||||||
size = SIZE_REGULAR
|
size = SIZE_REGULAR
|
||||||
@ -166,7 +137,7 @@ class MizCampaignLoader:
|
|||||||
else:
|
else:
|
||||||
importance = airport.periodicity / 10
|
importance = airport.periodicity / 10
|
||||||
|
|
||||||
cp = Airfield(airport, radials, size, importance)
|
cp = Airfield(airport, size, importance)
|
||||||
cp.captured = airport.is_blue()
|
cp.captured = airport.is_blue()
|
||||||
|
|
||||||
# Use the unlimited aircraft option to determine if an airfield should
|
# Use the unlimited aircraft option to determine if an airfield should
|
||||||
@ -514,11 +485,6 @@ class ConflictTheater:
|
|||||||
|
|
||||||
airbase = theater.terrain.airports[p["id"]]
|
airbase = theater.terrain.airports[p["id"]]
|
||||||
|
|
||||||
if "radials" in p.keys():
|
|
||||||
radials = p["radials"]
|
|
||||||
else:
|
|
||||||
radials = LAND
|
|
||||||
|
|
||||||
if "size" in p.keys():
|
if "size" in p.keys():
|
||||||
size = p["size"]
|
size = p["size"]
|
||||||
else:
|
else:
|
||||||
@ -529,7 +495,7 @@ class ConflictTheater:
|
|||||||
else:
|
else:
|
||||||
importance = IMPORTANCE_MEDIUM
|
importance = IMPORTANCE_MEDIUM
|
||||||
|
|
||||||
cp = Airfield(airbase, radials, size, importance)
|
cp = Airfield(airbase, size, importance)
|
||||||
elif p["type"] == "carrier":
|
elif p["type"] == "carrier":
|
||||||
cp = Carrier("carrier", Point(p["x"], p["y"]), p["id"])
|
cp = Carrier("carrier", Point(p["x"], p["y"]), p["id"])
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -156,11 +156,10 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
alt = 0
|
alt = 0
|
||||||
|
|
||||||
# TODO: Only airbases have IDs.
|
# TODO: Only airbases have IDs.
|
||||||
# TODO: Radials seem to be pointless.
|
|
||||||
# TODO: has_frontline is only reasonable for airbases.
|
# TODO: has_frontline is only reasonable for airbases.
|
||||||
# TODO: cptype is obsolete.
|
# TODO: cptype is obsolete.
|
||||||
def __init__(self, cp_id: int, name: str, position: Point,
|
def __init__(self, cp_id: int, name: str, position: Point,
|
||||||
at: db.StartingPosition, radials: List[int], size: int,
|
at: db.StartingPosition, size: int,
|
||||||
importance: float, has_frontline=True,
|
importance: float, has_frontline=True,
|
||||||
cptype=ControlPointType.AIRBASE):
|
cptype=ControlPointType.AIRBASE):
|
||||||
super().__init__(" ".join(re.split(r"[ \-]", name)[:2]), position)
|
super().__init__(" ".join(re.split(r"[ \-]", name)[:2]), position)
|
||||||
@ -179,7 +178,6 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
self.captured_invert = False
|
self.captured_invert = False
|
||||||
# TODO: Should be Airbase specific.
|
# TODO: Should be Airbase specific.
|
||||||
self.has_frontline = has_frontline
|
self.has_frontline = has_frontline
|
||||||
self.radials = radials
|
|
||||||
self.connected_points: List[ControlPoint] = []
|
self.connected_points: List[ControlPoint] = []
|
||||||
self.base: Base = Base()
|
self.base: Base = Base()
|
||||||
self.cptype = cptype
|
self.cptype = cptype
|
||||||
@ -228,16 +226,6 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
"""
|
"""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
|
||||||
def sea_radials(self) -> List[int]:
|
|
||||||
# TODO: fix imports
|
|
||||||
all_radials = [0, 45, 90, 135, 180, 225, 270, 315, ]
|
|
||||||
result = []
|
|
||||||
for r in all_radials:
|
|
||||||
if r not in self.radials:
|
|
||||||
result.append(r)
|
|
||||||
return result
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def total_aircraft_parking(self):
|
def total_aircraft_parking(self):
|
||||||
@ -287,17 +275,6 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
def is_connected(self, to) -> bool:
|
def is_connected(self, to) -> bool:
|
||||||
return to in self.connected_points
|
return to in self.connected_points
|
||||||
|
|
||||||
def find_radial(self, heading: int, ignored_radial: int = None) -> int:
|
|
||||||
closest_radial = 0
|
|
||||||
closest_radial_delta = 360
|
|
||||||
for radial in [x for x in self.radials if x != ignored_radial]:
|
|
||||||
delta = abs(radial - heading)
|
|
||||||
if delta < closest_radial_delta:
|
|
||||||
closest_radial = radial
|
|
||||||
closest_radial_delta = delta
|
|
||||||
|
|
||||||
return closest_radial
|
|
||||||
|
|
||||||
def find_ground_objects_by_obj_name(self, obj_name):
|
def find_ground_objects_by_obj_name(self, obj_name):
|
||||||
found = []
|
found = []
|
||||||
for g in self.ground_objects:
|
for g in self.ground_objects:
|
||||||
@ -390,10 +367,10 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
|
|
||||||
class Airfield(ControlPoint):
|
class Airfield(ControlPoint):
|
||||||
|
|
||||||
def __init__(self, airport: Airport, radials: List[int], size: int,
|
def __init__(self, airport: Airport, size: int,
|
||||||
importance: float, has_frontline=True):
|
importance: float, has_frontline=True):
|
||||||
super().__init__(airport.id, airport.name, airport.position, airport,
|
super().__init__(airport.id, airport.name, airport.position, airport,
|
||||||
radials, size, importance, has_frontline,
|
size, importance, has_frontline,
|
||||||
cptype=ControlPointType.AIRBASE)
|
cptype=ControlPointType.AIRBASE)
|
||||||
self.airport = airport
|
self.airport = airport
|
||||||
|
|
||||||
@ -481,7 +458,7 @@ class Carrier(NavalControlPoint):
|
|||||||
|
|
||||||
def __init__(self, name: str, at: Point, cp_id: int):
|
def __init__(self, name: str, at: Point, cp_id: int):
|
||||||
import game.theater.conflicttheater
|
import game.theater.conflicttheater
|
||||||
super().__init__(cp_id, name, at, at, game.theater.conflicttheater.LAND,
|
super().__init__(cp_id, name, at, at,
|
||||||
game.theater.conflicttheater.SIZE_SMALL, 1,
|
game.theater.conflicttheater.SIZE_SMALL, 1,
|
||||||
has_frontline=False,
|
has_frontline=False,
|
||||||
cptype=ControlPointType.AIRCRAFT_CARRIER_GROUP)
|
cptype=ControlPointType.AIRCRAFT_CARRIER_GROUP)
|
||||||
@ -505,7 +482,7 @@ class Lha(NavalControlPoint):
|
|||||||
|
|
||||||
def __init__(self, name: str, at: Point, cp_id: int):
|
def __init__(self, name: str, at: Point, cp_id: int):
|
||||||
import game.theater.conflicttheater
|
import game.theater.conflicttheater
|
||||||
super().__init__(cp_id, name, at, at, game.theater.conflicttheater.LAND,
|
super().__init__(cp_id, name, at, at,
|
||||||
game.theater.conflicttheater.SIZE_SMALL, 1,
|
game.theater.conflicttheater.SIZE_SMALL, 1,
|
||||||
has_frontline=False, cptype=ControlPointType.LHA_GROUP)
|
has_frontline=False, cptype=ControlPointType.LHA_GROUP)
|
||||||
|
|
||||||
@ -531,7 +508,7 @@ class OffMapSpawn(ControlPoint):
|
|||||||
|
|
||||||
def __init__(self, cp_id: int, name: str, position: Point):
|
def __init__(self, cp_id: int, name: str, position: Point):
|
||||||
from . import IMPORTANCE_MEDIUM, SIZE_REGULAR
|
from . import IMPORTANCE_MEDIUM, SIZE_REGULAR
|
||||||
super().__init__(cp_id, name, position, at=position, radials=[],
|
super().__init__(cp_id, name, position, at=position,
|
||||||
size=SIZE_REGULAR, importance=IMPORTANCE_MEDIUM,
|
size=SIZE_REGULAR, importance=IMPORTANCE_MEDIUM,
|
||||||
has_frontline=False, cptype=ControlPointType.OFF_MAP)
|
has_frontline=False, cptype=ControlPointType.OFF_MAP)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user