mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Allow factions to specify their cargo ship type.
https://github.com/dcs-liberation/dcs_liberation/issues/3039
This commit is contained in:
parent
d3b0ae30eb
commit
a343bdef23
@ -211,6 +211,8 @@ BAI/ANTISHIP/DEAD/STRIKE/BARCAP/CAS/OCA/AIR-ASSAULT (main) missions
|
|||||||
* **[Flight Planning]** Improved IP selection for targets that are near the center of a threat zone.
|
* **[Flight Planning]** Improved IP selection for targets that are near the center of a threat zone.
|
||||||
* **[Modding]** Factions can now specify the ship type to be used for cargo shipping. The Handy Wind will be used by default, but WW2 factions can pick something more appropriate.
|
* **[Modding]** Factions can now specify the ship type to be used for cargo shipping. The Handy Wind will be used by default, but WW2 factions can pick something more appropriate.
|
||||||
|
|
||||||
|
* **[Modding]** Factions can now specify the ship type to be used for cargo shipping. The Handy Wind will be used by default, but WW2 factions can pick something more appropriate.
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
* **[Data]** Fixed the class of the Samuel Chase so it can't be picked for a AAA or SHORAD site.
|
* **[Data]** Fixed the class of the Samuel Chase so it can't be picked for a AAA or SHORAD site.
|
||||||
|
|||||||
@ -45,6 +45,9 @@ class Faction:
|
|||||||
#: choose the default locale.
|
#: choose the default locale.
|
||||||
locales: Optional[List[str]]
|
locales: Optional[List[str]]
|
||||||
|
|
||||||
|
# The unit type to spawn for cargo shipping.
|
||||||
|
cargo_ship: ShipUnitType
|
||||||
|
|
||||||
# Country used by this faction
|
# Country used by this faction
|
||||||
country: Country
|
country: Country
|
||||||
|
|
||||||
@ -194,7 +197,11 @@ class Faction:
|
|||||||
"country ID"
|
"country ID"
|
||||||
) from ex
|
) from ex
|
||||||
|
|
||||||
faction = Faction(locales=json.get("locales"), country=country)
|
faction = Faction(
|
||||||
|
locales=json.get("locales"),
|
||||||
|
country=country,
|
||||||
|
cargo_ship=ShipUnitType.named(json.get("cargo_ship", "Handy Wind"))
|
||||||
|
)
|
||||||
|
|
||||||
faction.name = json.get("name", "")
|
faction.name = json.get("name", "")
|
||||||
if not faction.name:
|
if not faction.name:
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import itertools
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from dcs import Mission
|
from dcs import Mission
|
||||||
from dcs.ships import HandyWind
|
|
||||||
from dcs.unitgroup import ShipGroup
|
from dcs.unitgroup import ShipGroup
|
||||||
|
|
||||||
from game.transfers import CargoShip
|
from game.transfers import CargoShip
|
||||||
@ -30,15 +29,16 @@ class CargoShipGenerator:
|
|||||||
self.generate_cargo_ship(ship)
|
self.generate_cargo_ship(ship)
|
||||||
|
|
||||||
def generate_cargo_ship(self, ship: CargoShip) -> ShipGroup:
|
def generate_cargo_ship(self, ship: CargoShip) -> ShipGroup:
|
||||||
|
coalition = self.game.coalition_for(ship.player_owned)
|
||||||
waypoints = ship.route
|
waypoints = ship.route
|
||||||
|
|
||||||
country = self.game.coalition_for(ship.player_owned).faction.country
|
country = coalition.faction.country
|
||||||
country = self.mission.country(country.name)
|
country = self.mission.country(country.name)
|
||||||
|
|
||||||
group = self.mission.ship_group(
|
group = self.mission.ship_group(
|
||||||
country,
|
country,
|
||||||
ship.name,
|
ship.name,
|
||||||
HandyWind,
|
coalition.faction.cargo_ship.dcs_unit_type,
|
||||||
position=waypoints[0],
|
position=waypoints[0],
|
||||||
group_size=1,
|
group_size=1,
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user