diff --git a/game/armedforces/forcegroup.py b/game/armedforces/forcegroup.py index fd44265d..267c7077 100644 --- a/game/armedforces/forcegroup.py +++ b/game/armedforces/forcegroup.py @@ -289,12 +289,19 @@ class ForceGroup: # Align heading to GroundObject defined by the campaign designer unit.position.heading + rotation, ) - if unit.unit_type and unit.unit_type.dcs_unit_type in UNITS_WITH_RADAR: - # Head Radars towards the center of the conflict - unit.position.heading = ( - game.theater.heading_to_conflict_from(unit.position) - or unit.position.heading - ) + if unit.unit_type is not None: + if unit.unit_type.dcs_unit_type in UNITS_WITH_RADAR: + # Head Radars towards the center of the conflict + unit.position.heading = ( + game.theater.heading_to_conflict_from(unit.position) + or unit.position.heading + ) + if ( + isinstance(unit.unit_type, GroundUnitType) + and unit.unit_type.reversed_heading + ): + # Reverse the heading of the unit + unit.position.heading = unit.position.heading.opposite # Rotate unit around the center to align the orientation of the group unit.position.rotate(ground_object.position, rotation) diff --git a/game/dcs/groundunittype.py b/game/dcs/groundunittype.py index 35eea894..2ab2418c 100644 --- a/game/dcs/groundunittype.py +++ b/game/dcs/groundunittype.py @@ -55,6 +55,10 @@ class GroundUnitType(UnitType[Type[VehicleType]]): spawn_weight: int skynet_properties: SkynetProperties + # Defines if we should place the ground unit with an inverted heading. + # Some units like few Launchers have to be placed backwards to be able to fire. + reversed_heading: bool + @classmethod def named(cls, name: str) -> GroundUnitType: if not cls._loaded: @@ -117,4 +121,5 @@ class GroundUnitType(UnitType[Type[VehicleType]]): skynet_properties=SkynetProperties.from_data( data.get("skynet_properties", {}) ), + reversed_heading=data.get("reversed_heading", False), ) diff --git a/resources/layouts/defenses/Silkworm.miz b/resources/layouts/defenses/Silkworm.miz index 2e70364c..4a5cbd72 100644 Binary files a/resources/layouts/defenses/Silkworm.miz and b/resources/layouts/defenses/Silkworm.miz differ diff --git a/resources/layouts/defenses/missile.miz b/resources/layouts/defenses/missile.miz index 45dc6abc..875842eb 100644 Binary files a/resources/layouts/defenses/missile.miz and b/resources/layouts/defenses/missile.miz differ diff --git a/resources/units/ground_units/SA-11 Buk LN 9A310M1.yaml b/resources/units/ground_units/SA-11 Buk LN 9A310M1.yaml index 50bbbb70..e2a60f17 100644 --- a/resources/units/ground_units/SA-11 Buk LN 9A310M1.yaml +++ b/resources/units/ground_units/SA-11 Buk LN 9A310M1.yaml @@ -1,4 +1,5 @@ class: TELAR price: 30 +reversed_heading: true # Needs to be placed backwards! variants: SAM SA-11 Buk "Gadfly" Fire Dome TEL: null diff --git a/resources/units/ground_units/SA-17 Buk M1-2 LN 9A310M1-2.yaml b/resources/units/ground_units/SA-17 Buk M1-2 LN 9A310M1-2.yaml index cb9fe420..e8d46a38 100644 --- a/resources/units/ground_units/SA-17 Buk M1-2 LN 9A310M1-2.yaml +++ b/resources/units/ground_units/SA-17 Buk M1-2 LN 9A310M1-2.yaml @@ -1,4 +1,5 @@ class: TELAR price: 40 +reversed_heading: true # Needs to be placed backwards! variants: SAM SA-17 Buk M1-2 LN 9A310M1-2: null diff --git a/resources/units/ground_units/hy_launcher.yaml b/resources/units/ground_units/hy_launcher.yaml index db899b48..9b9d4e59 100644 --- a/resources/units/ground_units/hy_launcher.yaml +++ b/resources/units/ground_units/hy_launcher.yaml @@ -1,4 +1,5 @@ class: AntiShipMissile price: 0 +reversed_heading: true # Needs to be placed backwards! variants: AShM SS-N-2 Silkworm: null \ No newline at end of file