mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge branch 'develop' into helipads
# Conflicts: # game/data/weapons.py # game/db.py # game/theater/conflicttheater.py # resources/factions/france_1995.json # resources/factions/insurgents.json # resources/factions/iraq_1991.json # resources/factions/syria_1967_with_ww2_weapons.json # resources/factions/syria_2011.json
This commit is contained in:
@@ -8,7 +8,6 @@ DEFAULT_AVAILABLE_BUILDINGS = [
|
||||
"oil",
|
||||
"ware",
|
||||
"farp",
|
||||
"fob",
|
||||
"power",
|
||||
"derrick",
|
||||
]
|
||||
@@ -21,7 +20,6 @@ WW2_GERMANY_BUILDINGS = [
|
||||
"ww2bunker",
|
||||
"allycamp",
|
||||
"allycamp",
|
||||
"fob",
|
||||
]
|
||||
WW2_ALLIES_BUILDINGS = [
|
||||
"fuel",
|
||||
@@ -30,7 +28,6 @@ WW2_ALLIES_BUILDINGS = [
|
||||
"allycamp",
|
||||
"allycamp",
|
||||
"allycamp",
|
||||
"fob",
|
||||
]
|
||||
|
||||
FORTIFICATION_BUILDINGS = [
|
||||
|
||||
@@ -145,20 +145,26 @@ _WEAPON_FALLBACKS = [
|
||||
Weapons.LAU_117_with_AGM_65E___Maverick_E__Laser_ASM___Lg_Whd_,
|
||||
), # internal pylons harrier
|
||||
# AGM-154 JSOW
|
||||
(Weapons.AGM_154A___JSOW_CEB__CBU_type_, Weapons.GBU_12),
|
||||
(
|
||||
Weapons.AGM_154A___JSOW_CEB__CBU_type_,
|
||||
Weapons.AGM_62_Walleye_II___Guided_Weapon_Mk_5__TV_Guided_,
|
||||
),
|
||||
(
|
||||
Weapons.BRU_55_with_2_x_AGM_154A___JSOW_CEB__CBU_type_,
|
||||
Weapons.BRU_33_with_2_x_GBU_12___500lb_Laser_Guided_Bomb,
|
||||
Weapons.AGM_62_Walleye_II___Guided_Weapon_Mk_5__TV_Guided_,
|
||||
),
|
||||
(
|
||||
Weapons.BRU_57_with_2_x_AGM_154A___JSOW_CEB__CBU_type_,
|
||||
None,
|
||||
Weapons.AGM_62_Walleye_II___Guided_Weapon_Mk_5__TV_Guided_,
|
||||
), # doesn't exist on any aircraft yet
|
||||
(Weapons.AGM_154B___JSOW_Anti_Armour, Weapons.CBU_105___10_x_SFW__CBU_with_WCMD),
|
||||
(Weapons.AGM_154C___JSOW_Unitary_BROACH, Weapons.GBU_12),
|
||||
(
|
||||
Weapons.AGM_154C___JSOW_Unitary_BROACH,
|
||||
Weapons.AGM_62_Walleye_II___Guided_Weapon_Mk_5__TV_Guided_,
|
||||
),
|
||||
(
|
||||
Weapons.BRU_55_with_2_x_AGM_154C___JSOW_Unitary_BROACH,
|
||||
Weapons.BRU_33_with_2_x_GBU_12___500lb_Laser_Guided_Bomb,
|
||||
Weapons.AGM_62_Walleye_II___Guided_Weapon_Mk_5__TV_Guided_,
|
||||
),
|
||||
# AGM-45 Shrike
|
||||
(Weapons.AGM_45A_Shrike_ARM, None),
|
||||
|
||||
10
game/db.py
10
game/db.py
@@ -498,12 +498,14 @@ PRICES = {
|
||||
Armor.IFV_BMP_1: 14,
|
||||
Armor.IFV_BMP_2: 16,
|
||||
Armor.IFV_BMP_3: 18,
|
||||
Armor.LT_PT_76: 9,
|
||||
Armor.ZBD_04A: 12,
|
||||
Armor.ZTZ_96B: 30,
|
||||
Armor.Scout_Cobra: 4,
|
||||
Armor.APC_M113: 6,
|
||||
Armor.Scout_HMMWV: 2,
|
||||
Armor.ATGM_HMMWV: 8,
|
||||
Armor.ATGM_VAB_Mephisto: 12,
|
||||
Armor.IFV_M2A2_Bradley: 12,
|
||||
Armor.IFV_M1126_Stryker_ICV: 10,
|
||||
Armor.SPG_Stryker_MGS: 14,
|
||||
@@ -519,6 +521,7 @@ PRICES = {
|
||||
Armor.MBT_Merkava_IV: 25,
|
||||
Armor.APC_TPz_Fuchs: 5,
|
||||
Armor.MBT_Challenger_II: 25,
|
||||
Armor.MBT_Chieftain_Mk_3: 20,
|
||||
Armor.IFV_Marder: 10,
|
||||
Armor.IFV_Warrior: 10,
|
||||
Armor.IFV_LAV_25: 7,
|
||||
@@ -534,6 +537,7 @@ PRICES = {
|
||||
Artillery.Mortar_2B11_120mm: 4,
|
||||
Artillery.SPH_Dana_vz77_152mm: 26,
|
||||
Artillery.PLZ_05: 25,
|
||||
Artillery.SPH_T155_Firtina_155mm: 28,
|
||||
Unarmed.LUV_UAZ_469_Jeep: 3,
|
||||
Unarmed.Truck_Ural_375: 3,
|
||||
Infantry.Infantry_M4: 1,
|
||||
@@ -885,6 +889,7 @@ UNIT_BY_TASK = {
|
||||
Armor.IFV_BMP_3,
|
||||
Armor.IFV_BMP_3,
|
||||
Armor.IFV_BMD_1,
|
||||
Armor.LT_PT_76,
|
||||
Armor.ZBD_04A,
|
||||
Armor.ZBD_04A,
|
||||
Armor.ZBD_04A,
|
||||
@@ -913,6 +918,8 @@ UNIT_BY_TASK = {
|
||||
Armor.APC_TPz_Fuchs,
|
||||
Armor.ATGM_HMMWV,
|
||||
Armor.ATGM_HMMWV,
|
||||
Armor.ATGM_VAB_Mephisto,
|
||||
Armor.ATGM_VAB_Mephisto,
|
||||
Armor.Scout_HMMWV,
|
||||
Armor.Scout_HMMWV,
|
||||
Armor.IFV_M2A2_Bradley,
|
||||
@@ -941,6 +948,7 @@ UNIT_BY_TASK = {
|
||||
Armor.MBT_Leclerc,
|
||||
Armor.MBT_Leopard_2A6M,
|
||||
Armor.MBT_Challenger_II,
|
||||
Armor.MBT_Chieftain_Mk_3,
|
||||
Armor.MBT_Merkava_IV,
|
||||
Armor.MT_Pz_Kpfw_V_Panther_Ausf_G,
|
||||
Armor.Tk_PzIV_H,
|
||||
@@ -1002,6 +1010,7 @@ UNIT_BY_TASK = {
|
||||
Artillery.MLRS_9K57_Uragan_BM_27_220mm,
|
||||
Artillery.MLRS_9A52_Smerch_HE_300mm,
|
||||
Artillery.SPH_Dana_vz77_152mm,
|
||||
Artillery.SPH_T155_Firtina_155mm,
|
||||
Artillery.PLZ_05,
|
||||
Artillery.SPG_M12_GMC_155mm,
|
||||
Armor.SPG_Sturmpanzer_IV_Brummbar,
|
||||
@@ -1241,7 +1250,6 @@ REWARDS = {
|
||||
"fuel": 2,
|
||||
"ammo": 2,
|
||||
"farp": 1,
|
||||
"fob": 1,
|
||||
# TODO: Should generate no cash once they generate units.
|
||||
"factory": 10,
|
||||
"comms": 10,
|
||||
|
||||
16
game/game.py
16
game/game.py
@@ -34,6 +34,7 @@ from .procurement import AircraftProcurementRequest, ProcurementAi
|
||||
from .profiling import logged_duration
|
||||
from .settings import Settings
|
||||
from .theater import ConflictTheater
|
||||
from .theater.bullseye import Bullseye
|
||||
from .theater.transitnetwork import TransitNetwork, TransitNetworkBuilder
|
||||
from .threatzones import ThreatZones
|
||||
from .transfers import PendingTransfers
|
||||
@@ -130,6 +131,9 @@ class Game:
|
||||
self.blue_ato = AirTaskingOrder()
|
||||
self.red_ato = AirTaskingOrder()
|
||||
|
||||
self.blue_bullseye = Bullseye(Point(0, 0))
|
||||
self.red_bullseye = Bullseye(Point(0, 0))
|
||||
|
||||
self.aircraft_inventory = GlobalAircraftInventory(self.theater.controlpoints)
|
||||
|
||||
self.transfers = PendingTransfers(self)
|
||||
@@ -201,6 +205,11 @@ class Game:
|
||||
return self.player_faction
|
||||
return self.enemy_faction
|
||||
|
||||
def bullseye_for(self, player: bool) -> Bullseye:
|
||||
if player:
|
||||
return self.blue_bullseye
|
||||
return self.red_bullseye
|
||||
|
||||
def _roll(self, prob, mult):
|
||||
if self.settings.version == "dev":
|
||||
# always generate all events for dev
|
||||
@@ -337,10 +346,17 @@ class Game:
|
||||
|
||||
return TurnState.CONTINUE
|
||||
|
||||
def set_bullseye(self) -> None:
|
||||
player_cp, enemy_cp = self.theater.closest_opposing_control_points()
|
||||
self.blue_bullseye = Bullseye(enemy_cp.position)
|
||||
self.red_bullseye = Bullseye(player_cp.position)
|
||||
|
||||
def initialize_turn(self) -> None:
|
||||
self.events = []
|
||||
self._generate_events()
|
||||
|
||||
self.set_bullseye()
|
||||
|
||||
# Update statistics
|
||||
self.game_stats.update(self)
|
||||
|
||||
|
||||
@@ -108,8 +108,12 @@ class Operation:
|
||||
|
||||
@classmethod
|
||||
def _setup_mission_coalitions(cls):
|
||||
cls.current_mission.coalition["blue"] = Coalition("blue")
|
||||
cls.current_mission.coalition["red"] = Coalition("red")
|
||||
cls.current_mission.coalition["blue"] = Coalition(
|
||||
"blue", bullseye=cls.game.blue_bullseye.to_pydcs()
|
||||
)
|
||||
cls.current_mission.coalition["red"] = Coalition(
|
||||
"red", bullseye=cls.game.red_bullseye.to_pydcs()
|
||||
)
|
||||
|
||||
p_country = cls.game.player_country
|
||||
e_country = cls.game.enemy_country
|
||||
@@ -171,13 +175,16 @@ class Operation:
|
||||
gen.add_dynamic_runway(dynamic_runway)
|
||||
|
||||
for tanker in airsupportgen.air_support.tankers:
|
||||
gen.add_tanker(tanker)
|
||||
if tanker.blue:
|
||||
gen.add_tanker(tanker)
|
||||
|
||||
for aewc in airsupportgen.air_support.awacs:
|
||||
gen.add_awacs(aewc)
|
||||
if aewc.blue:
|
||||
gen.add_awacs(aewc)
|
||||
|
||||
for jtac in jtacs:
|
||||
gen.add_jtac(jtac)
|
||||
if jtac.blue:
|
||||
gen.add_jtac(jtac)
|
||||
|
||||
for flight in airgen.flights:
|
||||
gen.add_flight(flight)
|
||||
@@ -317,13 +324,8 @@ class Operation:
|
||||
|
||||
# Setup combined arms parameters
|
||||
cls.current_mission.groundControl.pilot_can_control_vehicles = cls.ca_slots > 0
|
||||
if cls.game.player_country in [
|
||||
country.name
|
||||
for country in cls.current_mission.coalition["blue"].countries.values()
|
||||
]:
|
||||
cls.current_mission.groundControl.blue_tactical_commander = cls.ca_slots
|
||||
else:
|
||||
cls.current_mission.groundControl.red_tactical_commander = cls.ca_slots
|
||||
cls.current_mission.groundControl.blue_tactical_commander = cls.ca_slots
|
||||
cls.current_mission.groundControl.blue_observer = 1
|
||||
|
||||
# Options
|
||||
forcedoptionsgen = ForcedOptionsGenerator(cls.current_mission, cls.game)
|
||||
@@ -453,7 +455,7 @@ class Operation:
|
||||
|
||||
for tanker in airsupportgen.air_support.tankers:
|
||||
luaData["Tankers"][tanker.callsign] = {
|
||||
"dcsGroupName": tanker.dcsGroupName,
|
||||
"dcsGroupName": tanker.group_name,
|
||||
"callsign": tanker.callsign,
|
||||
"variant": tanker.variant,
|
||||
"radio": tanker.freq.mhz,
|
||||
@@ -463,14 +465,14 @@ class Operation:
|
||||
if airsupportgen.air_support.awacs:
|
||||
for awacs in airsupportgen.air_support.awacs:
|
||||
luaData["AWACs"][awacs.callsign] = {
|
||||
"dcsGroupName": awacs.dcsGroupName,
|
||||
"dcsGroupName": awacs.group_name,
|
||||
"callsign": awacs.callsign,
|
||||
"radio": awacs.freq.mhz,
|
||||
}
|
||||
|
||||
for jtac in jtacs:
|
||||
luaData["JTACs"][jtac.callsign] = {
|
||||
"dcsGroupName": jtac.dcsGroupName,
|
||||
"dcsGroupName": jtac.group_name,
|
||||
"callsign": jtac.callsign,
|
||||
"zone": jtac.region,
|
||||
"dcsUnit": jtac.unit_name,
|
||||
|
||||
26
game/theater/bullseye.py
Normal file
26
game/theater/bullseye.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, TYPE_CHECKING
|
||||
|
||||
from dcs import Point
|
||||
|
||||
from game.theater import LatLon
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game.theater import ConflictTheater
|
||||
|
||||
|
||||
@dataclass
|
||||
class Bullseye:
|
||||
position: Point
|
||||
|
||||
@classmethod
|
||||
def from_pydcs(cls, bulls: Dict[str, float]) -> Bullseye:
|
||||
return cls(Point(bulls["x"], bulls["y"]))
|
||||
|
||||
def to_pydcs(self) -> Dict[str, float]:
|
||||
return {"x": self.position.x, "y": self.position.y}
|
||||
|
||||
def to_lat_lon(self, theater: ConflictTheater) -> LatLon:
|
||||
return theater.point_to_ll(self.position)
|
||||
@@ -41,6 +41,7 @@ from dcs.unitgroup import (
|
||||
)
|
||||
from dcs.vehicles import AirDefence, Armor, MissilesSS, Unarmed
|
||||
|
||||
from .latlon import LatLon
|
||||
from ..helipad import Helipad
|
||||
from ..scenery_group import SceneryGroup
|
||||
from pyproj import CRS, Transformer
|
||||
@@ -583,15 +584,6 @@ class ReferencePoint:
|
||||
image_coordinates: Point
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class LatLon:
|
||||
latitude: float
|
||||
longitude: float
|
||||
|
||||
def as_list(self) -> List[float]:
|
||||
return [self.latitude, self.longitude]
|
||||
|
||||
|
||||
class ConflictTheater:
|
||||
terrain: Terrain
|
||||
|
||||
|
||||
11
game/theater/latlon.py
Normal file
11
game/theater/latlon.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class LatLon:
|
||||
latitude: float
|
||||
longitude: float
|
||||
|
||||
def as_list(self) -> List[float]:
|
||||
return [self.latitude, self.longitude]
|
||||
@@ -845,12 +845,7 @@ class FobGroundObjectGenerator(AirbaseGroundObjectGenerator):
|
||||
return True
|
||||
|
||||
def generate_fob(self) -> None:
|
||||
try:
|
||||
category = self.faction.building_set[self.faction.building_set.index("fob")]
|
||||
except IndexError:
|
||||
logging.exception("Faction has no fob buildings defined")
|
||||
return
|
||||
|
||||
category = "fob"
|
||||
obj_name = self.control_point.name
|
||||
template = random.choice(list(self.templates[category].values()))
|
||||
point = self.control_point.position
|
||||
|
||||
Reference in New Issue
Block a user