mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
feat(strike): add chance of AAA/tanks to strike targets
This commit is contained in:
parent
b17e34351c
commit
49de53f1c9
@ -50,6 +50,8 @@ class GroundObjectsGenerator:
|
|||||||
else:
|
else:
|
||||||
cp = self.conflict.from_cp
|
cp = self.conflict.from_cp
|
||||||
|
|
||||||
|
consumed_farps = set()
|
||||||
|
|
||||||
for ground_object in cp.ground_objects:
|
for ground_object in cp.ground_objects:
|
||||||
if ground_object.dcs_identifier == "AA":
|
if ground_object.dcs_identifier == "AA":
|
||||||
|
|
||||||
@ -78,6 +80,16 @@ class GroundObjectsGenerator:
|
|||||||
print("Didn't find {} in static _map(s)!".format(ground_object.dcs_identifier))
|
print("Didn't find {} in static _map(s)!".format(ground_object.dcs_identifier))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if ground_object.group_id not in consumed_farps:
|
||||||
|
consumed_farps.add(ground_object.group_id)
|
||||||
|
if random.randint(0, 100) > 50:
|
||||||
|
farp_aa(
|
||||||
|
self.m,
|
||||||
|
side,
|
||||||
|
ground_object.string_identifier,
|
||||||
|
ground_object.position,
|
||||||
|
)
|
||||||
|
|
||||||
group = self.m.static_group(
|
group = self.m.static_group(
|
||||||
country=side,
|
country=side,
|
||||||
name=ground_object.string_identifier,
|
name=ground_object.string_identifier,
|
||||||
@ -88,3 +100,39 @@ class GroundObjectsGenerator:
|
|||||||
)
|
)
|
||||||
|
|
||||||
logging.info("generated {}object identifier {} with mission id {}".format("dead " if ground_object.is_dead else "", group.name, group.id))
|
logging.info("generated {}object identifier {} with mission id {}".format("dead " if ground_object.is_dead else "", group.name, group.id))
|
||||||
|
|
||||||
|
|
||||||
|
def farp_aa(mission_obj, country, name, position: mapping.Point):
|
||||||
|
"""
|
||||||
|
Add AAA to a FARP :)
|
||||||
|
:param mission_obj:
|
||||||
|
:param country:
|
||||||
|
:param name:
|
||||||
|
:param position:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
vg = unitgroup.VehicleGroup(mission_obj.next_group_id(), mission_obj.string(name))
|
||||||
|
|
||||||
|
units = [
|
||||||
|
AirDefence.SPAAA_ZSU_23_4_Shilka,
|
||||||
|
AirDefence.AAA_ZU_23_Closed,
|
||||||
|
AirDefence.AAA_ZU_23_Emplacement,
|
||||||
|
AirDefence.AAA_ZU_23_on_Ural_375,
|
||||||
|
AirDefence.AAA_ZU_23_Insurgent_Closed,
|
||||||
|
AirDefence.AAA_ZU_23_Insurgent_on_Ural_375,
|
||||||
|
Armor.MBT_T_55,
|
||||||
|
Armor.IFV_BMP_3,
|
||||||
|
]
|
||||||
|
|
||||||
|
v = mission_obj.vehicle(name + "_AAA", random.choice(units))
|
||||||
|
v.position.x = position.x - random.randint(5, 30)
|
||||||
|
v.position.y = position.y - random.randint(5, 30)
|
||||||
|
v.heading = random.randint(0, 359)
|
||||||
|
vg.add_unit(v)
|
||||||
|
|
||||||
|
wp = vg.add_waypoint(vg.units[0].position, PointAction.OffRoad, 0)
|
||||||
|
wp.ETA_locked = True
|
||||||
|
|
||||||
|
country.add_vehicle_group(vg)
|
||||||
|
return vg
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user