mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Move another helper function out of db.
This commit is contained in:
parent
9bdb81019b
commit
5cd2b91e28
31
game/db.py
31
game/db.py
@ -1,17 +1,6 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Type
|
|
||||||
|
|
||||||
# mypy can't resolve these if they're wildcard imports for some reason.
|
# mypy can't resolve these if they're wildcard imports for some reason.
|
||||||
from dcs.ships import (
|
|
||||||
CVN_71,
|
|
||||||
CVN_72,
|
|
||||||
CVN_73,
|
|
||||||
CVN_75,
|
|
||||||
CV_1143_5,
|
|
||||||
KUZNECOW,
|
|
||||||
Stennis,
|
|
||||||
)
|
|
||||||
from dcs.unittype import ShipType
|
|
||||||
|
|
||||||
# PATCH pydcs data with MODS
|
# PATCH pydcs data with MODS
|
||||||
|
|
||||||
@ -106,23 +95,3 @@ REWARDS = {
|
|||||||
"""
|
"""
|
||||||
---------- END OF CONFIGURATION SECTION
|
---------- END OF CONFIGURATION SECTION
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def upgrade_to_supercarrier(unit: Type[ShipType], name: str) -> Type[ShipType]:
|
|
||||||
if unit == Stennis:
|
|
||||||
if name == "CVN-71 Theodore Roosevelt":
|
|
||||||
return CVN_71
|
|
||||||
elif name == "CVN-72 Abraham Lincoln":
|
|
||||||
return CVN_72
|
|
||||||
elif name == "CVN-73 George Washington":
|
|
||||||
return CVN_73
|
|
||||||
elif name == "CVN-75 Harry S. Truman":
|
|
||||||
return CVN_75
|
|
||||||
elif name == "Carrier Strike Group 8":
|
|
||||||
return CVN_75
|
|
||||||
else:
|
|
||||||
return CVN_71
|
|
||||||
elif unit == KUZNECOW:
|
|
||||||
return CV_1143_5
|
|
||||||
else:
|
|
||||||
return unit
|
|
||||||
|
|||||||
@ -28,7 +28,16 @@ from dcs.action import DoScript, SceneryDestructionZone
|
|||||||
from dcs.condition import MapObjectIsDead
|
from dcs.condition import MapObjectIsDead
|
||||||
from dcs.country import Country
|
from dcs.country import Country
|
||||||
from dcs.point import StaticPoint
|
from dcs.point import StaticPoint
|
||||||
from dcs.ships import ship_map
|
from dcs.ships import (
|
||||||
|
CVN_71,
|
||||||
|
CVN_72,
|
||||||
|
CVN_73,
|
||||||
|
CVN_75,
|
||||||
|
CV_1143_5,
|
||||||
|
KUZNECOW,
|
||||||
|
Stennis,
|
||||||
|
ship_map,
|
||||||
|
)
|
||||||
from dcs.statics import Fortification, fortification_map, warehouse_map
|
from dcs.statics import Fortification, fortification_map, warehouse_map
|
||||||
from dcs.task import (
|
from dcs.task import (
|
||||||
ActivateBeaconCommand,
|
ActivateBeaconCommand,
|
||||||
@ -44,7 +53,6 @@ from dcs.unitgroup import ShipGroup, StaticGroup, VehicleGroup
|
|||||||
from dcs.unittype import ShipType, StaticType, VehicleType
|
from dcs.unittype import ShipType, StaticType, VehicleType
|
||||||
from dcs.vehicles import vehicle_map
|
from dcs.vehicles import vehicle_map
|
||||||
|
|
||||||
from game import db
|
|
||||||
from game.data.building_data import FORTIFICATION_UNITS, FORTIFICATION_UNITS_ID
|
from game.data.building_data import FORTIFICATION_UNITS, FORTIFICATION_UNITS_ID
|
||||||
from game.dcs.helpers import unit_type_from_name
|
from game.dcs.helpers import unit_type_from_name
|
||||||
from game.radio.radios import RadioFrequency, RadioRegistry
|
from game.radio.radios import RadioFrequency, RadioRegistry
|
||||||
@ -510,9 +518,29 @@ class CarrierGenerator(GenericCarrierGenerator):
|
|||||||
def get_carrier_type(self, group: ShipGroup) -> Type[ShipType]:
|
def get_carrier_type(self, group: ShipGroup) -> Type[ShipType]:
|
||||||
unit_type = super().get_carrier_type(group)
|
unit_type = super().get_carrier_type(group)
|
||||||
if self.game.settings.supercarrier:
|
if self.game.settings.supercarrier:
|
||||||
unit_type = db.upgrade_to_supercarrier(unit_type, self.control_point.name)
|
unit_type = self.upgrade_to_supercarrier(unit_type, self.control_point.name)
|
||||||
return unit_type
|
return unit_type
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def upgrade_to_supercarrier(unit: Type[ShipType], name: str) -> Type[ShipType]:
|
||||||
|
if unit == Stennis:
|
||||||
|
if name == "CVN-71 Theodore Roosevelt":
|
||||||
|
return CVN_71
|
||||||
|
elif name == "CVN-72 Abraham Lincoln":
|
||||||
|
return CVN_72
|
||||||
|
elif name == "CVN-73 George Washington":
|
||||||
|
return CVN_73
|
||||||
|
elif name == "CVN-75 Harry S. Truman":
|
||||||
|
return CVN_75
|
||||||
|
elif name == "Carrier Strike Group 8":
|
||||||
|
return CVN_75
|
||||||
|
else:
|
||||||
|
return CVN_71
|
||||||
|
elif unit == KUZNECOW:
|
||||||
|
return CV_1143_5
|
||||||
|
else:
|
||||||
|
return unit
|
||||||
|
|
||||||
def tacan_callsign(self) -> str:
|
def tacan_callsign(self) -> str:
|
||||||
# TODO: Assign these properly.
|
# TODO: Assign these properly.
|
||||||
if self.control_point.name == "Carrier Strike Group 8":
|
if self.control_point.name == "Carrier Strike Group 8":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user