diff --git a/game/dcs/lasercodeconfig.py b/game/dcs/lasercodeconfig.py index a7bb090f..01c63fe2 100644 --- a/game/dcs/lasercodeconfig.py +++ b/game/dcs/lasercodeconfig.py @@ -6,18 +6,14 @@ from typing import Any class LaserCodeConfig(ABC): - def __init__(self, pylon: int) -> None: - self.pylon = pylon - @staticmethod def from_yaml(data: dict[str, Any]) -> LaserCodeConfig: - pylon = data["pylon"] if (property_def := data.get("property")) is not None: return SinglePropertyLaserCodeConfig( - pylon, property_def["id"], int(property_def["digits"]) + property_def["id"], int(property_def["digits"]) ) return MultiplePropertyLaserCodeConfig( - pylon, [(d["id"], d["digit"]) for d in data["properties"]] + [(d["id"], d["digit"]) for d in data["properties"]] ) @abstractmethod @@ -30,8 +26,7 @@ class LaserCodeConfig(ABC): class SinglePropertyLaserCodeConfig(LaserCodeConfig): - def __init__(self, pylon: int, property_id: str, digits: int) -> None: - super().__init__(pylon) + def __init__(self, property_id: str, digits: int) -> None: self.property_id = property_id self.digits = digits @@ -43,10 +38,7 @@ class SinglePropertyLaserCodeConfig(LaserCodeConfig): class MultiplePropertyLaserCodeConfig(LaserCodeConfig): - def __init__( - self, pylon: int, property_digit_mappings: list[tuple[str, int]] - ) -> None: - super().__init__(pylon) + def __init__(self, property_digit_mappings: list[tuple[str, int]]) -> None: self.property_digit_mappings = property_digit_mappings def iter_prop_ids(self) -> Iterator[str]: diff --git a/resources/units/aircraft/F-15ESE.yaml b/resources/units/aircraft/F-15ESE.yaml index f7dd3c3e..87643dda 100644 --- a/resources/units/aircraft/F-15ESE.yaml +++ b/resources/units/aircraft/F-15ESE.yaml @@ -36,23 +36,18 @@ tasks: Strike: 640 TARCAP: 240 laser_codes: - - pylon: 2 - property: + - property: id: Sta2LaserCode digits: 3 - - pylon: 4 - property: + - property: id: LCFTLaserCode digits: 3 - - pylon: 5 - property: + - property: id: Sta5LaserCode digits: 3 - - pylon: 12 - property: + - property: id: RCFTLaserCode digits: 3 - - pylon: 14 - property: + - property: id: Sta8LaserCode digits: 3 diff --git a/tests/dcs/test_lasercodeconfig.py b/tests/dcs/test_lasercodeconfig.py index a6acf11f..61e7ff98 100644 --- a/tests/dcs/test_lasercodeconfig.py +++ b/tests/dcs/test_lasercodeconfig.py @@ -6,7 +6,7 @@ from game.dcs.lasercodeconfig import ( def test_singlepropertylasercodeproperty() -> None: - config = SinglePropertyLaserCodeConfig(0, "code", 3) + config = SinglePropertyLaserCodeConfig("code", 3) assert list(config.iter_prop_ids()) == ["code"] assert config.property_dict_for_code(1688) == {"code": 688} assert config.property_dict_for_code(1000) == {"code": 0} @@ -16,7 +16,6 @@ def test_singlepropertylasercodeproperty() -> None: def test_multiplepropertylasercodeproperty() -> None: config = MultiplePropertyLaserCodeConfig( - 0, [ ("digit0", 0), ("digit1", 1), @@ -46,7 +45,6 @@ def test_lasercodeconfig_from_yaml() -> None: config = LaserCodeConfig.from_yaml( {"pylon": 0, "property": {"id": "code", "digits": 3}} ) - assert config.pylon == 0 assert config.property_dict_for_code(1688) == {"code": 688} config = LaserCodeConfig.from_yaml( @@ -59,7 +57,6 @@ def test_lasercodeconfig_from_yaml() -> None: ], } ) - assert config.pylon == 1 assert config.property_dict_for_code(1688) == { "digit0": 8, "digit1": 8,