Skip to content

Commit

Permalink
Update population of warehouses to add allowHotStart key and use ints…
Browse files Browse the repository at this point in the history
… instead of strings as unit IDs. These changes affected multiplayer missions where units spawned on carriers / FARPs
  • Loading branch information
zhexu14 authored and rp- committed Feb 10, 2025
1 parent fea0826 commit 82a3490
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions dcs/mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,14 +1027,14 @@ def update_warehouses(self):
for ship_group in self.coalition[coalition_name].countries[country_name].ship_group:
for unit_ in ship_group.units:
if ships.ship_map[unit_.type].parking > 0:
self.warehouses.warehouses[str(unit_.id)] = terrain_.terrain.Warehouse().dict()
self.warehouses.warehouses[str(unit_.id)]['coalition'] = coalition_name_in_warehouse
self.warehouses.warehouses[int(unit_.id)] = terrain_.terrain.Warehouse().dict()
self.warehouses.warehouses[int(unit_.id)]['coalition'] = coalition_name_in_warehouse
# FARPs need a warehouse entry.
for static_group in self.coalition[coalition_name].countries[country_name].static_group:
for unit_ in static_group.units:
if isinstance(unit_, unit.BaseFARP):
self.warehouses.warehouses[str(unit_.id)] = terrain_.terrain.Warehouse().dict()
self.warehouses.warehouses[str(unit_.id)]['coalition'] = coalition_name_in_warehouse
self.warehouses.warehouses[int(unit_.id)] = terrain_.terrain.Warehouse().dict()
self.warehouses.warehouses[int(unit_.id)]['coalition'] = coalition_name_in_warehouse

def _flying_group_from_airport(self, _country, group: unitgroup.FlyingGroup,
maintask: Type[task.MainTask],
Expand Down
5 changes: 4 additions & 1 deletion dcs/terrain/terrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def __init__(self):
self.jet_init = 100
self.dynamic_spawn = False
self.dynamic_cargo = False
self.allow_hot_start = False

def load_from_dict(self, d):
self.coalition = d["coalition"]
Expand All @@ -159,6 +160,7 @@ def load_from_dict(self, d):
self.jet_init = d.get("jet_fuel", {}).get("InitFuel", 100)
self.dynamic_spawn = d.get("dynamicSpawn", False)
self.dynamic_cargo = d.get("dynamicCargo", False)
self.allow_hot_start = d.get("allowHotStart", False)

def dict(self):
d = {
Expand All @@ -180,7 +182,8 @@ def dict(self):
"diesel": {"InitFuel": self.diesel_init},
"jet_fuel": {"InitFuel": self.jet_init},
"dynamicSpawn": self.dynamic_spawn,
"dynamicCargo": self.dynamic_cargo
"dynamicCargo": self.dynamic_cargo,
"allowHotStart": self.allow_hot_start
}
return d

Expand Down

0 comments on commit 82a3490

Please sign in to comment.