Generate WW2 Ship groups, added B17 to allies. Implemented modifiable doctrine to setup flight generator.

This commit is contained in:
Khopa
2020-06-13 18:53:43 +02:00
parent 601375d06f
commit cd41bcf45c
26 changed files with 501 additions and 128 deletions

View File

@@ -7,7 +7,7 @@ import logging
from game.data.building_data import DEFAULT_AVAILABLE_BUILDINGS
from gen import namegen
from gen.defenses.armor_group_generator import generate_armor_group
from gen.fleet.ship_group_generator import generate_carrier_group, generate_lha_group
from gen.fleet.ship_group_generator import generate_carrier_group, generate_lha_group, generate_ship_group
from gen.sam.sam_group_generator import generate_anti_air_group, generate_shorad_group
from theater import ControlPointType
from theater.base import *
@@ -81,6 +81,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
g.cp_id = cp.id
g.airbase_group = True
g.dcs_identifier = "CARRIER"
g.sea_object = True
g.obj_name = namegen.random_objective_name()
g.heading = 0
g.position = Point(cp.position.x, cp.position.y)
@@ -101,6 +102,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
g.cp_id = cp.id
g.airbase_group = True
g.dcs_identifier = "LHA"
g.sea_object = True
g.obj_name = namegen.random_objective_name()
g.heading = 0
g.position = Point(cp.position.x, cp.position.y)
@@ -114,7 +116,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
cp.name = random.choice(db.FACTIONS[faction]["lhanames"])
else:
for i in range(random.randint(2,6)):
for i in range(random.randint(3,6)):
print("GENERATE BASE DEFENSE")
point = find_location(True, cp.position, theater, 1000, 2800, [], True)
@@ -132,6 +134,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
g.cp_id = cp.id
g.airbase_group = True
g.dcs_identifier = "AA"
g.sea_object = False
g.obj_name = namegen.random_objective_name()
g.heading = 0
g.position = Point(point.x, point.y)
@@ -144,6 +147,35 @@ def generate_groundobjects(theater: ConflictTheater, game):
for ground_object in cp.ground_objects:
print(ground_object.groups)
for i in range(random.randint(2, 3)):
print("GENERATE SHIPS")
point = find_location(False, cp.position, theater, 5000, 40000, [], False)
print(point)
if point is None:
print("Couldn't find point for {} ships".format(cp))
continue
group_id = group_id + 1
g = TheaterGroundObject("aa")
g.group_id = group_id
g.object_id = 0
g.cp_id = cp.id
g.airbase_group = False
g.dcs_identifier = "AA"
g.sea_object = True
g.obj_name = namegen.random_objective_name()
g.heading = 0
g.position = Point(point.x, point.y)
group = generate_ship_group(game, g, faction)
g.groups = []
if group is not None:
g.groups.append(group)
cp.ground_objects.append(g)
def generate_airbase_defense_group(airbase_defense_group_id, ground_obj:TheaterGroundObject, faction, game, cp):
@@ -286,6 +318,7 @@ def generate_cp_ground_points(cp: ControlPoint, theater, game, group_id, templat
g.dcs_identifier = object["type"]
g.heading = object["heading"]
g.sea_object = False
g.position = Point(point.x + object["offset"].x, point.y + object["offset"].y)
if g.dcs_identifier == "AA":

View File

@@ -69,6 +69,7 @@ class TheaterGroundObject:
position = None # type: Point
groups = []
obj_name = ""
sea_object = False
def __init__(self, category: str):
self.category = category

View File

@@ -21,7 +21,54 @@ class ChannelTheater(ConflictTheater):
super(ChannelTheater, self).__init__()
self.abeville = ControlPoint.from_airport(thechannel.Abbeville_Drucat, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.detling = ControlPoint.from_airport(thechannel.Detling, LAND, SIZE_SMALL, IMPORTANCE_LOW)
#self.detling = ControlPoint.from_airport(thechannel.Detling, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.stomer = ControlPoint.from_airport(thechannel.Saint_Omer_Longuenesse, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.dunkirk = ControlPoint.from_airport(thechannel.Dunkirk_Mardyck, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.hawkinge = ControlPoint.from_airport(thechannel.Hawkinge, LAND, SIZE_SMALL, IMPORTANCE_LOW)
#self.highhalden = ControlPoint.from_airport(thechannel.High_Halden, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.lympne = ControlPoint.from_airport(thechannel.Lympne, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.manston = ControlPoint.from_airport(thechannel.Manston, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.merville = ControlPoint.from_airport(thechannel.Merville_Calonne, LAND, SIZE_SMALL, IMPORTANCE_LOW)
# England
self.add_controlpoint(self.hawkinge, connected_to=[self.lympne, self.manston])
self.add_controlpoint(self.lympne, connected_to=[self.hawkinge])
self.add_controlpoint(self.manston, connected_to=[self.hawkinge])
# France
self.add_controlpoint(self.dunkirk, connected_to=[self.stomer])
self.add_controlpoint(self.stomer, connected_to=[self.dunkirk, self.merville, self.abeville])
self.add_controlpoint(self.merville, connected_to=[self.stomer])
self.add_controlpoint(self.abeville, connected_to=[self.stomer])
#self.detling.captured = True
self.hawkinge.captured = True
self.dunkirk.captured = True
#self.highhalden.captured = True
self.lympne.captured = True
self.manston.captured = True
class ChannelTheaterComplete(ConflictTheater):
terrain = dcs.terrain.TheChannel()
overview_image = "thechannel.gif"
reference_points = {(thechannel.Abbeville_Drucat.position.x, thechannel.Abbeville_Drucat.position.y): (2400, 4100),
(thechannel.Detling.position.x, thechannel.Detling.position.y): (1100, 2000)}
landmap = load_landmap("resources\\channellandmap.p")
daytime_map = {
"dawn": (6, 8),
"day": (10, 17),
"dusk": (17, 18),
"night": (0, 5),
}
def __init__(self):
super(ChannelTheaterComplete, self).__init__()
self.abeville = ControlPoint.from_airport(thechannel.Abbeville_Drucat, LAND, SIZE_SMALL, IMPORTANCE_LOW)
#self.detling = ControlPoint.from_airport(thechannel.Detling, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.stomer = ControlPoint.from_airport(thechannel.Saint_Omer_Longuenesse, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.dunkirk = ControlPoint.from_airport(thechannel.Dunkirk_Mardyck, LAND, SIZE_SMALL, IMPORTANCE_LOW)
@@ -31,13 +78,11 @@ class ChannelTheater(ConflictTheater):
self.manston = ControlPoint.from_airport(thechannel.Manston, LAND, SIZE_SMALL, IMPORTANCE_LOW)
self.merville = ControlPoint.from_airport(thechannel.Merville_Calonne, LAND, SIZE_SMALL, IMPORTANCE_LOW)
# England
self.add_controlpoint(self.detling, connected_to=[self.highhalden])
self.add_controlpoint(self.hawkinge, connected_to=[self.lympne, self.manston])
self.add_controlpoint(self.highhalden, connected_to=[self.detling, self.lympne])
self.add_controlpoint(self.lympne, connected_to=[self.highhalden, self.hawkinge])
self.add_controlpoint(self.lympne, connected_to=[self.hawkinge, self.highhalden])
self.add_controlpoint(self.manston, connected_to=[self.hawkinge])
self.add_controlpoint(self.highhalden, connected_to=[self.lympne])
# France
self.add_controlpoint(self.dunkirk, connected_to=[self.stomer])
@@ -45,8 +90,9 @@ class ChannelTheater(ConflictTheater):
self.add_controlpoint(self.merville, connected_to=[self.stomer])
self.add_controlpoint(self.abeville, connected_to=[self.stomer])
self.detling.captured = True
#self.detling.captured = True
self.hawkinge.captured = True
#self.dunkirk.captured = True
self.highhalden.captured = True
self.lympne.captured = True
self.manston.captured = True