gulf & nevada maps integration; updates to commisioning/start generation units logic; mission gen updates; carriers always on map

This commit is contained in:
Vasyl Horbachenko
2018-06-16 03:30:32 +03:00
parent 56c9f97417
commit 92e5514e8d
20 changed files with 368 additions and 162 deletions

View File

@@ -7,8 +7,8 @@ from .naming import *
from dcs.mission import *
DISTANCE_FACTOR = 4, 5
EXTRA_AA_MIN_DISTANCE = 70000
EXTRA_AA_POSITION_FROM_CP = 10000
EXTRA_AA_MIN_DISTANCE = 35000
EXTRA_AA_POSITION_FROM_CP = 550
class AAConflictGenerator:
def __init__(self, mission: Mission, conflict: Conflict):

View File

@@ -72,6 +72,8 @@ class AircraftConflictGenerator:
for unit_instance in group.units:
unit_instance.livery_id = db.PLANE_LIVERY_OVERRIDES[unit_type]
print("AC: {} {}".format(unit_type, len(group.units)))
def _generate_at_airport(self, name: str, side: Country, unit_type: FlyingType, count: int, client_count: int, airport: Airport = None) -> FlyingGroup:
assert count > 0
assert unit is not None

View File

@@ -8,6 +8,9 @@ from dcs.unittype import *
from dcs.task import *
from dcs.terrain.terrain import NoParkingSlotError
AWACS_DISTANCE = 150000
AWACS_ALT = 10000
class AWACSConflictGenerator:
def __init__(self, mission: Mission, conflict: Conflict, game):
@@ -22,5 +25,6 @@ class AWACSConflictGenerator:
country=self.conflict.attackers_side,
name=namegen.next_awacs_group_name(),
plane_type=plane,
altitude=AWACS_ALT,
airport=None,
position=self.conflict.position)
position=self.conflict.position.random_point_within(AWACS_DISTANCE, AWACS_DISTANCE))

View File

@@ -14,10 +14,8 @@ from dcs.point import *
from dcs.task import *
from dcs.country import *
def _opposite_heading(h):
return h+180
GROUND_DISTANCE_FACTOR = 2
GROUNDINTERCEPT_DISTANCE_FACTOR = 6
AIR_DISTANCE = 32000
INTERCEPT_ATTACKERS_HEADING = -45, 45
@@ -28,6 +26,10 @@ INTERCEPT_MAX_DISTANCE = 80000
INTERCEPT_MIN_DISTANCE = 45000
def _opposite_heading(h):
return h+180
class Conflict:
attackers_side = None # type: Country
defenders_side = None # type: Country
@@ -81,18 +83,18 @@ class Conflict:
return instance
@classmethod
def ground_intercept_conflict(self, attacker: Country, defender: Country, position: Point, heading: int, radials: typing.List[int]):
def ground_intercept_conflict(self, attacker: Country, defender: Country, heading: int, cp):
from theater.conflicttheater import SIZE_SMALL
instance = self()
instance.attackers_side = attacker
instance.defenders_side = defender
instance.position = position
instance.size = SIZE_SMALL
instance.radials = radials
instance.position = cp.position
instance.size = cp.size
instance.radials = cp.radials
instance.air_attackers_location = instance.position.point_from_heading(random.randint(*INTERCEPT_ATTACKERS_HEADING) + heading, AIR_DISTANCE)
instance.ground_defenders_location = instance.position
instance.ground_defenders_location = instance.position.point_from_heading(random.choice(cp.radials), instance.size * GROUNDINTERCEPT_DISTANCE_FACTOR)
return instance

View File

@@ -6,6 +6,7 @@ from dcs.mission import Mission
from dcs.triggers import *
from dcs.condition import *
from dcs.action import *
from dcs.task import *
from theater.weatherforecast import WeatherForecast
from theater.conflicttheater import Conflict
@@ -14,18 +15,17 @@ ACTIVATION_TRIGGER_SIZE = 80000
ACTIVATION_TRIGGER_MIN_DISTANCE = 5000
RANDOM_TIME = {
"night": 0,
"dusk": 5,
"dawn": 35,
"noon": 75,
"night": 5,
"dusk": 30,
"dawn": 30,
"day": 100,
}
RANDOM_WEATHER = {
0: 0, # thunderstorm
1: 5, # heavy rain
2: 20, # rain
3: 40, # random dynamic
0: 5, # thunderstorm
1: 20, # heavy rain
2: 30, # rain
3: 100, # random dynamic
}
@@ -36,17 +36,7 @@ class EnvironmentSettingsGenerator:
self.game = game
def _gen_random_time(self):
time_roll = random.randint(0, 100)
time_period = None
for k, v in RANDOM_TIME.items():
if v >= time_roll:
time_period = k
break
self.mission.random_daytime(time_period)
def _gen_random_time_2(self):
start_time = datetime.now(self.mission.start_time.tzinfo).date()
start_time = datetime.today()
daytime_map = {
"day": timedelta(hours=random.randrange(9, 18)),
"night": timedelta(hours=random.randrange(-3, 6)),
@@ -54,24 +44,24 @@ class EnvironmentSettingsGenerator:
"dawn": timedelta(hours=random.randrange(6, 9)),
}
time_roll = random.randint(0, 100)
time_period = None
for k, v in RANDOM_TIME.items():
if v >= time_roll:
if random.randint(0, 100) <= v:
time_period = k
break
print("generated {}".format(time_period))
start_time += daytime_map[time_period]
self.mission.start_time = start_time
def _gen_random_weather(self):
weather_roll = random.randint(0, 100)
weather_type = None
for k, v in RANDOM_TIME.items():
if v >= weather_roll:
for k, v in RANDOM_WEATHER.items():
if random.randint(0, 100) <= v:
weather_type = k
break
print("generated weather {}".format(weather_type))
if weather_type == 0:
self.mission.weather.random_thunderstorm()
elif weather_type == 1:
@@ -116,9 +106,10 @@ class EnvironmentSettingsGenerator:
player_coalition = self.game.player == "USA" and "blue" or "red"
enemy_coalition = player_coalition == "blue" and "red" or "blue"
self.mission.coalition[player_coalition].bullseye = self.conflict.position
self.mission.coalition[player_coalition].bullseye = {"x": self.conflict.position.x,
"y": self.conflict.position.y}
self._gen_random_time_2()
self._gen_random_time()
self._gen_random_weather()
self._set_allegiances(player_coalition, enemy_coalition)