mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
cleanups & minor fixesh
This commit is contained in:
parent
c152b49b88
commit
b697a8b40a
@ -344,6 +344,7 @@ UNIT_BY_COUNTRY = {
|
||||
|
||||
CARRIER_TYPE_BY_PLANE = {
|
||||
FA_18C_hornet: CVN_74_John_C__Stennis,
|
||||
F_14B: CVN_74_John_C__Stennis,
|
||||
Ka_50: LHA_1_Tarawa,
|
||||
SA342M: LHA_1_Tarawa,
|
||||
UH_1H: LHA_1_Tarawa,
|
||||
|
||||
@ -108,7 +108,7 @@ class Operation:
|
||||
at=global_cp.at)
|
||||
|
||||
if global_cp == self.departure_cp and not self.is_quick:
|
||||
if self.to_cp.captured:
|
||||
if not self.to_cp.captured:
|
||||
self.attackers_starting_position = ship
|
||||
else:
|
||||
self.defenders_starting_position = ship
|
||||
|
||||
@ -69,9 +69,15 @@ class AircraftConflictGenerator:
|
||||
else:
|
||||
client_count = 0
|
||||
|
||||
if flying_type == F_14B:
|
||||
# workaround since 2 and 3 tomcat collide on carrier
|
||||
group_size = 2
|
||||
else:
|
||||
group_size = 4
|
||||
|
||||
while count > 0:
|
||||
group_size = min(count, 4)
|
||||
client_size = max(min(client_count, 4), 0)
|
||||
group_size = min(count, group_size)
|
||||
client_size = max(min(client_count, group_size), 0)
|
||||
|
||||
yield (flying_type, group_size, client_size)
|
||||
count -= group_size
|
||||
@ -183,7 +189,9 @@ class AircraftConflictGenerator:
|
||||
return self._generate_inflight(name, side, unit_type, count, client_count, at)
|
||||
elif isinstance(at, Group):
|
||||
takeoff_ban = unit_type in db.CARRIER_TAKEOFF_BAN
|
||||
if not takeoff_ban:
|
||||
ai_ban = client_count == 0 and self.settings.only_player_takeoff
|
||||
|
||||
if not takeoff_ban and not ai_ban:
|
||||
return self._generate_at_group(name, side, unit_type, count, client_count, at)
|
||||
else:
|
||||
return self._generate_inflight(name, side, unit_type, count, client_count, at.position)
|
||||
|
||||
@ -49,8 +49,8 @@ class AirSupportConflictGenerator:
|
||||
)
|
||||
|
||||
tanker_group.points[0].tasks.append(ActivateBeaconCommand(channel=97 + i, unit_id=tanker_group.id, aa=False))
|
||||
tanker_group.tasks.append(SetInvisibleCommand(True))
|
||||
tanker_group.tasks.append(SetImmortalCommand(True))
|
||||
tanker_group.points[0].tasks.append(SetInvisibleCommand(True))
|
||||
tanker_group.points[0].tasks.append(SetImmortalCommand(True))
|
||||
|
||||
if is_awacs_enabled:
|
||||
awacs_unit = db.find_unittype(AWACS, self.conflict.attackers_side.name)[0]
|
||||
@ -65,5 +65,5 @@ class AirSupportConflictGenerator:
|
||||
start_type=StartType.Warm,
|
||||
)
|
||||
|
||||
awacs_flight.tasks.append(SetInvisibleCommand(True))
|
||||
awacs_flight.tasks.append(SetImmortalCommand(True))
|
||||
awacs_flight.points[0].tasks.append(SetInvisibleCommand(True))
|
||||
awacs_flight.points[0].tasks.append(SetImmortalCommand(True))
|
||||
|
||||
@ -35,14 +35,16 @@ class ShipGenerator:
|
||||
|
||||
def generate_cargo(self, units: db.ShipDict) -> typing.Collection[ShipGroup]:
|
||||
groups = []
|
||||
offset = 0
|
||||
for unit_type, unit_count in units.items():
|
||||
for _ in range(unit_count):
|
||||
offset += 1
|
||||
logging.info("shipgen: {} ({}) for {}".format(unit_type, unit_count, self.conflict.defenders_side))
|
||||
group = self.m.ship_group(
|
||||
country=self.conflict.defenders_side,
|
||||
name=namegen.next_unit_name(self.conflict.defenders_side, unit_type),
|
||||
_type=unit_type,
|
||||
position=self.conflict.ground_defenders_location.random_point_within(SHIP_RANDOM_SPREAD, SHIP_RANDOM_SPREAD),
|
||||
group_size=unit_count,
|
||||
position=self.conflict.ground_defenders_location.random_point_within(SHIP_RANDOM_SPREAD, SHIP_RANDOM_SPREAD).point_from_heading(0, offset * SHIP_RANDOM_SPREAD)
|
||||
)
|
||||
|
||||
group.add_waypoint(self.conflict.to_cp.position)
|
||||
|
||||
@ -134,7 +134,7 @@ class VisualGenerator:
|
||||
mission_units.add(db.unit_type_of(unit))
|
||||
|
||||
for unit_type in mission_units:
|
||||
self.mission.static_group(self.mission.country("USA"), "a", unit_type, Point(0, 0))
|
||||
self.mission.static_group(self.mission.country("USA"), "a", unit_type, Point(0, 300000), hidden=True)
|
||||
|
||||
def generate_target_smokes(self, target):
|
||||
spread = target.size * DESTINATION_SMOKE_DISTANCE_FACTOR
|
||||
|
||||
@ -76,10 +76,13 @@ def generate_groundobjects(theater: ConflictTheater):
|
||||
if cp.is_global:
|
||||
continue
|
||||
|
||||
amount = random.randrange(5, 7)
|
||||
if not cp.has_frontline:
|
||||
continue
|
||||
|
||||
amount = random.randrange(5, 6)
|
||||
for i in range(0, amount):
|
||||
available_categories = list(tpls)
|
||||
if i >= amount - 2:
|
||||
if i >= amount - 1:
|
||||
tpl_category = "aa"
|
||||
else:
|
||||
tpl_category = random.choice(available_categories)
|
||||
|
||||
@ -194,14 +194,19 @@ class EventMenu(Menu):
|
||||
self.error_label["text"] = "Need at least one player in flight {}".format(self.event.flight_name(task))
|
||||
return
|
||||
|
||||
if self.game.is_player_attack(self.event):
|
||||
if isinstance(self.event, FrontlineAttackEvent) or isinstance(self.event, FrontlinePatrolEvent):
|
||||
if self.event.from_cp.base.total_armor == 0:
|
||||
self.error_label["text"] = "No ground vehicles available to attack!"
|
||||
return
|
||||
|
||||
if self.game.is_player_attack(self.event):
|
||||
self.event.player_attacking(flights)
|
||||
else:
|
||||
if isinstance(self.event, FrontlineAttackEvent) or isinstance(self.event, FrontlinePatrolEvent):
|
||||
if self.event.to_cp.base.total_armor == 0:
|
||||
self.error_label["text"] = "No ground vehicles available to defend!"
|
||||
return
|
||||
|
||||
self.event.player_defending(flights)
|
||||
|
||||
self.game.initiate_event(self.event)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user