debriefing based on events, not world state; tweaked visualgen; vehicles will not group in single location during capture op; fixed triggers for carrier ops; fixed naval ops; correct speed for inflight heli spawns; awacs will not change it's freq

This commit is contained in:
Vasyl Horbachenko
2018-07-13 04:33:07 +03:00
parent 4ce7480df8
commit 4cbd30fdbc
69 changed files with 100 additions and 33800 deletions

View File

@@ -14,6 +14,9 @@ SPREAD_DISTANCE_FACTOR = 1, 2
ESCORT_ENGAGEMENT_MAX_DIST = 100000
WORKAROUND_WAYP_DIST = 1000
WARM_START_HELI_AIRSPEED = 200
WARM_START_HELI_ALT = 1000
WARM_START_ALTITUDE = 3000
WARM_START_AIRSPEED = 550
@@ -114,7 +117,13 @@ class AircraftConflictGenerator:
assert count > 0
assert unit is not None
alt = WARM_START_ALTITUDE + random.randint(50, 200)
if unit_type in helicopters.helicopter_map:
alt = WARM_START_HELI_ALT + random.randint(50, 200)
speed = WARM_START_HELI_AIRSPEED
else:
alt = WARM_START_ALTITUDE + random.randint(50, 200)
speed = WARM_START_AIRSPEED
pos = Point(at.x + random.randint(100, 200), at.y + random.randint(100, 200))
return self.m.flight_group(
@@ -124,7 +133,7 @@ class AircraftConflictGenerator:
airport=None,
position=pos,
altitude=alt,
speed=WARM_START_AIRSPEED,
speed=speed,
maintask=None,
start_type=StartType.Warm,
group_size=count)

View File

@@ -34,7 +34,8 @@ class ArmorConflictGenerator:
position=self._group_point(at),
group_size=1,
move_formation=PointAction.OffRoad)
wayp = group.add_waypoint(self.conflict.position.point_from_heading(0, 500))
initial_position = self.conflict.position.point_from_heading(0, 500)
wayp = group.add_waypoint(self._group_point(initial_position))
wayp.tasks = []
def generate(self, attackers: db.ArmorDict, defenders: db.ArmorDict):

View File

@@ -23,8 +23,10 @@ class AWACSConflictGenerator:
self.mission.awacs_flight(
country=self.mission.country(self.game.player),
name=namegen.next_awacs_group_name(),
name=namegen.next_awacs_name(self.mission.country(self.game.player),),
plane_type=plane,
altitude=AWACS_ALT,
airport=None,
position=self.conflict.position.random_point_within(AWACS_DISTANCE, AWACS_DISTANCE))
position=self.conflict.position.random_point_within(AWACS_DISTANCE, AWACS_DISTANCE),
frequency=251
)

View File

@@ -34,7 +34,7 @@ INTERCEPT_ATTACKERS_DISTANCE = 100000
INTERCEPT_MAX_DISTANCE = 160000
INTERCEPT_MIN_DISTANCE = 100000
NAVAL_INTERCEPT_DISTANCE_FACTOR = 0.4
NAVAL_INTERCEPT_DISTANCE_FACTOR = 1
NAVAL_INTERCEPT_DISTANCE_MAX = 40000
NAVAL_INTERCEPT_STEP = 5000
@@ -94,6 +94,10 @@ class Conflict:
self.air_attackers_location = air_attackers_location
self.air_defenders_location = air_defenders_location
@property
def to_size(self):
return self.to_cp.size * GROUND_DISTANCE_FACTOR
@classmethod
def frontline_position(cls, from_cp: ControlPoint, to_cp: ControlPoint):
distance = max(from_cp.position.distance_to_point(to_cp.position) * FRONT_SMOKE_DISTANCE_FACTOR * to_cp.base.strength, FRONT_SMOKE_MIN_DISTANCE)
@@ -234,9 +238,9 @@ class Conflict:
radial = random.choice(to_cp.sea_radials)
initial_distance = min(int(from_cp.position.distance_to_point(to_cp.position) * NAVAL_INTERCEPT_DISTANCE_FACTOR), NAVAL_INTERCEPT_DISTANCE_MAX)
position = to_cp.position.point_from_heading(radial, initial_distance)
initial_position = to_cp.position.point_from_heading(radial, initial_distance)
for offset in range(0, initial_distance, NAVAL_INTERCEPT_STEP):
position = to_cp.position.point_from_heading(_opposite_heading(radial), initial_distance - offset)
position = initial_position.point_from_heading(_opposite_heading(radial), offset)
if not theater.is_on_land(position):
break

View File

@@ -6,10 +6,18 @@ class NameGenerator:
def next_unit_name(self, country, unit_type):
self.number += 1
return "{}|{}|{}".format(country.id, self.number, db.unit_type_name(unit_type))
return "unit|{}|{}|{}|".format(country.id, self.number, db.unit_type_name(unit_type))
def next_basedefense_name(self):
return "basedefense_aa"
return "basedefense_aa|0|0|"
def next_awacs_name(self, country):
self.number += 1
return "awacs|{}|{}|0|".format(country.id, self.number)
def next_carrier_name(self, country):
self.number += 1
return "carrier|{}|{}|0|".format(country.id, self.number)
namegen = NameGenerator()

View File

@@ -17,7 +17,7 @@ class ShipGenerator:
def generate_carrier(self, type: ShipType, country: str, at: Point) -> ShipGroup:
return self.m.ship_group(
country=self.m.country(country),
name=namegen.next_transport_group_name(),
name=namegen.next_carrier_name(self.m.country(country)),
_type=type,
position=at)
@@ -26,7 +26,7 @@ class ShipGenerator:
for unit_type, unit_count in units.items():
group = self.m.ship_group(
country=self.conflict.defenders_side,
name=namegen.next_transport_group_name(),
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,

View File

@@ -101,9 +101,11 @@ class TriggersGenerator:
push_trigger_zone = self.mission.triggers.add_triggerzone(self.conflict.from_cp.position, PUSH_TRIGGER_SIZE, name="Push zone")
push_trigger = TriggerOnce(Event.NoEvent, "Push trigger")
push_trigger.add_condition(AllOfCoalitionOutsideZone(player_coalition, push_trigger_zone.id))
for group in push_by_trigger:
push_trigger.add_condition(AllOfGroupOutsideZone(group.id, push_trigger_zone.id))
push_trigger.add_action(AITaskPush(group.id, 1))
message_string = self.mission.string("Task force is in the air, proceed with the objective (activate waypoint 3).")
push_trigger.add_action(MessageToAll(message_string, clearview=True))
push_trigger.add_action(SetFlagValue())

View File

@@ -63,11 +63,12 @@ __original_static_dict = Static.dict
Static.dict = __monkey_static_dict
FRONT_SMOKE_LENGTH = 80000
FRONT_SMOKE_SPACING = 600
FRONT_SMOKE_RANDOM_SPREAD = 3000
FRONT_SMOKE_SPACING = 800
FRONT_SMOKE_RANDOM_SPREAD = 4000
FRONT_SMOKE_TYPE_CHANCES = {
10: MassiveSmoke,
60: BigSmoke,
2: MassiveSmoke,
15: BigSmoke,
30: Smoke,
100: Smoke,
}