mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add cheats for destroying and repairing runways.
This commit is contained in:
@@ -878,6 +878,7 @@ class Settings:
|
||||
enable_frontline_cheats: bool = False
|
||||
enable_base_capture_cheat: bool = False
|
||||
enable_transfer_cheat: bool = False
|
||||
enable_runway_state_cheat: bool = False
|
||||
|
||||
# LUA Plugins system
|
||||
plugins: Dict[str, bool] = field(default_factory=dict)
|
||||
|
||||
@@ -256,6 +256,10 @@ class RunwayStatus:
|
||||
# is reset.
|
||||
self.repair_turns_remaining = None
|
||||
|
||||
def repair(self) -> None:
|
||||
self.repair_turns_remaining = None
|
||||
self.damaged = False
|
||||
|
||||
def begin_repair(self) -> None:
|
||||
if self.repair_turns_remaining is not None:
|
||||
logging.error("Runway already under repair. Restarting.")
|
||||
@@ -264,8 +268,7 @@ class RunwayStatus:
|
||||
def process_turn(self) -> None:
|
||||
if self.repair_turns_remaining is not None:
|
||||
if self.repair_turns_remaining == 1:
|
||||
self.repair_turns_remaining = None
|
||||
self.damaged = False
|
||||
self.repair()
|
||||
else:
|
||||
self.repair_turns_remaining -= 1
|
||||
|
||||
@@ -977,6 +980,11 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC):
|
||||
def parking_slots(self) -> Iterator[ParkingSlot]:
|
||||
yield from []
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def runway_is_destroyable(self) -> bool:
|
||||
...
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def runway_status(self) -> RunwayStatus:
|
||||
@@ -1250,6 +1258,10 @@ class Airfield(ControlPoint, CTLD):
|
||||
def heading(self) -> Heading:
|
||||
return Heading.from_degrees(self.airport.runways[0].heading)
|
||||
|
||||
@property
|
||||
def runway_is_destroyable(self) -> bool:
|
||||
return True
|
||||
|
||||
def runway_is_operational(self) -> bool:
|
||||
return not self.runway_status.damaged
|
||||
|
||||
@@ -1341,6 +1353,10 @@ class NavalControlPoint(
|
||||
return g
|
||||
raise RuntimeError(f"Found no carrier/LHA group for {self.name}")
|
||||
|
||||
@property
|
||||
def runway_is_destroyable(self) -> bool:
|
||||
return False
|
||||
|
||||
def runway_is_operational(self) -> bool:
|
||||
# Necessary because it's possible for the carrier itself to have sunk
|
||||
# while its escorts are still alive.
|
||||
@@ -1521,6 +1537,10 @@ class OffMapSpawn(ControlPoint):
|
||||
logging.warning("TODO: Off map spawns have no runways.")
|
||||
return self.stub_runway_data()
|
||||
|
||||
@property
|
||||
def runway_is_destroyable(self) -> bool:
|
||||
return False
|
||||
|
||||
@property
|
||||
def runway_status(self) -> RunwayStatus:
|
||||
return RunwayStatus()
|
||||
@@ -1557,6 +1577,10 @@ class Fob(ControlPoint, RadioFrequencyContainer, CTLD):
|
||||
def symbol_set_and_entity(self) -> tuple[SymbolSet, Entity]:
|
||||
return SymbolSet.LAND_INSTALLATIONS, LandInstallationEntity.MILITARY_BASE
|
||||
|
||||
@property
|
||||
def runway_is_destroyable(self) -> bool:
|
||||
return False
|
||||
|
||||
def runway_is_operational(self) -> bool:
|
||||
return self.has_helipads or self.has_ground_spawns
|
||||
|
||||
|
||||
Reference in New Issue
Block a user