Create a checked, releasable type for laser codes.

The release behavior isn't used yet, but I'm working on pre-allocating
laser codes for front lines and flights to make it easier for players to
pick the laser codes for their weapons.
This commit is contained in:
Dan Albert
2023-07-22 14:01:02 -07:00
committed by Raffson
parent cb6bffe3ec
commit 723e191f10
8 changed files with 180 additions and 7 deletions

View File

@@ -148,7 +148,7 @@ class FlightGroupConfigurator:
) -> None:
self.set_skill(unit, member)
if member.loadout.has_weapon_of_type(WeaponTypeEnum.TGP) and member.is_player:
laser_codes.append(self.laser_code_registry.alloc_laser_code())
laser_codes.append(self.laser_code_registry.alloc_laser_code().code)
else:
laser_codes.append(None)
settings = self.flight.coalition.game.settings

View File

@@ -144,13 +144,12 @@ class FlotGenerator:
# Add JTAC
if self.game.blue.faction.has_jtac:
code: int
freq = self.radio_registry.alloc_uhf()
# If the option fc3LaserCode is enabled, force all JTAC
# laser codes to 1113 to allow lasing for Su-25 Frogfoots and A-10A Warthogs.
# Otherwise use 1688 for the first JTAC, 1687 for the second etc.
if self.game.settings.plugins.get("ctld.fc3LaserCode"):
code = 1113
code = self.laser_code_registry.fc3_code
else:
code = self.laser_code_registry.alloc_laser_code()