mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixed errors after merge on helipad feature.
This commit is contained in:
parent
1e96aad484
commit
483640b0c6
@ -30,7 +30,6 @@ from .event.frontlineattack import FrontlineAttackEvent
|
|||||||
from .factions.faction import Faction
|
from .factions.faction import Faction
|
||||||
from .infos.information import Information
|
from .infos.information import Information
|
||||||
from .navmesh import NavMesh
|
from .navmesh import NavMesh
|
||||||
from .procurement import AircraftProcurementRequest
|
|
||||||
from .profiling import logged_duration
|
from .profiling import logged_duration
|
||||||
from .settings import Settings
|
from .settings import Settings
|
||||||
from .squadrons import AirWing
|
from .squadrons import AirWing
|
||||||
@ -192,7 +191,7 @@ class Game:
|
|||||||
@property
|
@property
|
||||||
def neutral_country(self):
|
def neutral_country(self):
|
||||||
"""Return the best fitting country that can be used as neutral faction in the generated mission"""
|
"""Return the best fitting country that can be used as neutral faction in the generated mission"""
|
||||||
countries_in_use = [self.player_country, self.enemy_country]
|
countries_in_use = [self.red.country_name, self.blue.country_name]
|
||||||
if UnitedNationsPeacekeepers not in countries_in_use:
|
if UnitedNationsPeacekeepers not in countries_in_use:
|
||||||
return UnitedNationsPeacekeepers
|
return UnitedNationsPeacekeepers
|
||||||
elif Switzerland.name not in countries_in_use:
|
elif Switzerland.name not in countries_in_use:
|
||||||
|
|||||||
@ -1,13 +1,23 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from dcs import Point
|
||||||
from dcs.unitgroup import StaticGroup
|
from dcs.unitgroup import StaticGroup
|
||||||
|
|
||||||
from game.point_with_heading import PointWithHeading
|
from game.point_with_heading import PointWithHeading
|
||||||
|
from game.utils import Heading
|
||||||
|
|
||||||
|
|
||||||
class Helipad(PointWithHeading):
|
class Helipad(PointWithHeading):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Helipad, self).__init__()
|
super(Helipad, self).__init__()
|
||||||
self.heading = 0
|
self.heading = Heading.from_degrees(0)
|
||||||
self.occupied = False
|
self.occupied = False
|
||||||
self.static_unit: Optional[StaticGroup] = None
|
self.static_unit: Optional[StaticGroup] = None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_point(point: Point, heading: Heading) -> "Helipad":
|
||||||
|
h = Helipad()
|
||||||
|
h.x = point.x
|
||||||
|
h.y = point.y
|
||||||
|
h.heading = heading
|
||||||
|
return h
|
||||||
|
|||||||
@ -51,11 +51,11 @@ from .controlpoint import (
|
|||||||
MissionTarget,
|
MissionTarget,
|
||||||
OffMapSpawn,
|
OffMapSpawn,
|
||||||
)
|
)
|
||||||
from .seasonalconditions import SeasonalConditions
|
|
||||||
from .frontline import FrontLine
|
from .frontline import FrontLine
|
||||||
from .landmap import Landmap, load_landmap, poly_contains
|
from .landmap import Landmap, load_landmap, poly_contains
|
||||||
from .latlon import LatLon
|
from .latlon import LatLon
|
||||||
from .projections import TransverseMercator
|
from .projections import TransverseMercator
|
||||||
|
from .seasonalconditions import SeasonalConditions
|
||||||
from ..helipad import Helipad
|
from ..helipad import Helipad
|
||||||
from ..point_with_heading import PointWithHeading
|
from ..point_with_heading import PointWithHeading
|
||||||
from ..positioned import Positioned
|
from ..positioned import Positioned
|
||||||
@ -89,7 +89,7 @@ class MizCampaignLoader:
|
|||||||
SHIPPING_LANE_UNIT_TYPE = HandyWind.id
|
SHIPPING_LANE_UNIT_TYPE = HandyWind.id
|
||||||
|
|
||||||
FOB_UNIT_TYPE = Unarmed.SKP_11.id
|
FOB_UNIT_TYPE = Unarmed.SKP_11.id
|
||||||
FARP_HELIPAD = "SINGLE_HELIPAD"
|
FARP_HELIPAD = "Invisible FARP"
|
||||||
|
|
||||||
OFFSHORE_STRIKE_TARGET_UNIT_TYPE = Fortification.Oil_platform.id
|
OFFSHORE_STRIKE_TARGET_UNIT_TYPE = Fortification.Oil_platform.id
|
||||||
SHIP_UNIT_TYPE = USS_Arleigh_Burke_IIa.id
|
SHIP_UNIT_TYPE = USS_Arleigh_Burke_IIa.id
|
||||||
@ -271,6 +271,7 @@ class MizCampaignLoader:
|
|||||||
def helipads(self) -> Iterator[StaticGroup]:
|
def helipads(self) -> Iterator[StaticGroup]:
|
||||||
for group in self.blue.static_group:
|
for group in self.blue.static_group:
|
||||||
if group.units[0].type == self.FARP_HELIPAD:
|
if group.units[0].type == self.FARP_HELIPAD:
|
||||||
|
print("helooooo")
|
||||||
yield group
|
yield group
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -482,7 +483,7 @@ class MizCampaignLoader:
|
|||||||
for static in self.helipads:
|
for static in self.helipads:
|
||||||
closest, distance = self.objective_info(static)
|
closest, distance = self.objective_info(static)
|
||||||
closest.helipads.append(
|
closest.helipads.append(
|
||||||
PointWithHeading.from_point(
|
Helipad.from_point(
|
||||||
static.position, Heading.from_degrees(static.units[0].heading)
|
static.position, Heading.from_degrees(static.units[0].heading)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -614,7 +614,7 @@ class HelipadGenerator:
|
|||||||
country=country,
|
country=country,
|
||||||
name=(name + "_fuel"),
|
name=(name + "_fuel"),
|
||||||
_type=Fortification.FARP_Fuel_Depot,
|
_type=Fortification.FARP_Fuel_Depot,
|
||||||
position=pad.position.point_from_heading(helipad.heading, 35),
|
position=pad.position.point_from_heading(helipad.heading.degrees, 35),
|
||||||
heading=pad.heading,
|
heading=pad.heading,
|
||||||
)
|
)
|
||||||
self.m.static_group(
|
self.m.static_group(
|
||||||
@ -622,8 +622,8 @@ class HelipadGenerator:
|
|||||||
name=(name + "_ammo"),
|
name=(name + "_ammo"),
|
||||||
_type=Fortification.FARP_Ammo_Dump_Coating,
|
_type=Fortification.FARP_Ammo_Dump_Coating,
|
||||||
position=pad.position.point_from_heading(
|
position=pad.position.point_from_heading(
|
||||||
helipad.heading, 35
|
helipad.heading.degrees, 35
|
||||||
).point_from_heading(helipad.heading + 90, 10),
|
).point_from_heading(helipad.heading.degrees + 90, 10),
|
||||||
heading=pad.heading,
|
heading=pad.heading,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user