mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
aa spawn on available radials instead of random
This commit is contained in:
parent
4ba0a5b90f
commit
4cd3c24b49
26
__init__.py
26
__init__.py
@ -35,19 +35,6 @@ theater.senaki.base.aa = {
|
||||
AirDefence.AAA_ZU_23_on_Ural_375: 2,
|
||||
}
|
||||
|
||||
op = game.mission.CaptureOperation(
|
||||
mission=m,
|
||||
attacker=m.country("USA"),
|
||||
defender=m.country("Russia"),
|
||||
from_cp=theater.senaki,
|
||||
to_cp=theater.batumi,
|
||||
cas={A_10C: 2},
|
||||
escort={F_15C: 2},
|
||||
attack={Armor.MBT_M1A2_Abrams: 4},
|
||||
intercept={Su_27: 4},
|
||||
defense={Armor.MBT_T_55: 4},
|
||||
aa={AirDefence.AAA_ZU_23_Insurgent_on_Ural_375: 3})
|
||||
|
||||
op = game.mission.InterceptOperation(
|
||||
mission=m,
|
||||
attacker=m.country("USA"),
|
||||
@ -67,6 +54,19 @@ op = game.mission.GroundInterceptOperation(
|
||||
target={Unarmed.Transport_ZIL_4331: 10},
|
||||
strikegroup={A_10C: 2}
|
||||
)
|
||||
|
||||
op = game.mission.CaptureOperation(
|
||||
mission=m,
|
||||
attacker=m.country("USA"),
|
||||
defender=m.country("Russia"),
|
||||
from_cp=theater.senaki,
|
||||
to_cp=theater.batumi,
|
||||
cas={A_10C: 2},
|
||||
escort={F_15C: 2},
|
||||
attack={Armor.MBT_M1A2_Abrams: 4},
|
||||
intercept={Su_27: 4},
|
||||
defense={Armor.MBT_T_55: 4},
|
||||
aa={AirDefence.AAA_ZU_23_Insurgent_on_Ural_375: 3})
|
||||
op.generate()
|
||||
|
||||
if not os.path.exists("./build"):
|
||||
|
||||
@ -5,6 +5,7 @@ from dcs.mission import *
|
||||
from dcs.unitgroup import *
|
||||
from dcs.vehicles import *
|
||||
from theater.controlpoint import *
|
||||
from theater.conflicttheater import *
|
||||
from theater.base import *
|
||||
|
||||
from gen.armor import *
|
||||
@ -71,7 +72,8 @@ class InterceptOperation(Operation):
|
||||
attacker=attacker,
|
||||
defender=defender,
|
||||
position=destination.position,
|
||||
heading=randint(0, 360)
|
||||
heading=randint(0, 360),
|
||||
radials=ALL_RADIALS
|
||||
)
|
||||
|
||||
super(InterceptOperation, self).__init__(mission, conflict)
|
||||
@ -98,7 +100,8 @@ class GroundInterceptOperation(Operation):
|
||||
attacker=attacker,
|
||||
defender=defender,
|
||||
position=position,
|
||||
heading=randint(0, 360)
|
||||
heading=randint(0, 360),
|
||||
radials=ALL_RADIALS
|
||||
)
|
||||
|
||||
super(GroundInterceptOperation, self).__init__(mission, conflict)
|
||||
|
||||
@ -26,10 +26,9 @@ class AAConflictGenerator:
|
||||
|
||||
def generate(self, units: typing.Dict[UnitType, int]):
|
||||
for type, count in units.items():
|
||||
for _ in range(count):
|
||||
p = self.conflict.ground_defenders_location.random_point_within(
|
||||
self.conflict.size * DISTANCE_FACTOR[1],
|
||||
self.conflict.size * DISTANCE_FACTOR[0])
|
||||
for _, radial in zip(range(count), self.conflict.radials):
|
||||
distance = randint(self.conflict.size * DISTANCE_FACTOR[0], self.conflict.size * DISTANCE_FACTOR[1])
|
||||
p = self.conflict.position.point_from_heading(radial, distance)
|
||||
|
||||
self.m.vehicle_group(
|
||||
country=self.conflict.defenders_side,
|
||||
|
||||
@ -26,13 +26,25 @@ INTERCEPT_ATTACKERS_DISTANCE = 60000
|
||||
INTERCEPT_DEFENDERS_DISTANCE = 30000
|
||||
|
||||
class Conflict:
|
||||
attackers_side = None # type: Country
|
||||
defenders_side = None # type: Country
|
||||
position = None # type: Point
|
||||
size = None # type: int
|
||||
radials = None # type: typing.List[int]
|
||||
|
||||
ground_attackers_location = None # type: Point
|
||||
ground_defenders_location = None # type: Point
|
||||
air_attackers_location = None # type: Point
|
||||
air_defenders_location = None # type: Point
|
||||
|
||||
@classmethod
|
||||
def capture_conflict(self, attacker: Country, attack_heading: int, defender: Country, defense_heading: int, position: Point, size: int):
|
||||
def capture_conflict(self, attacker: Country, attack_heading: int, defender: Country, defense_heading: int, position: Point, size: int, radials: typing.List[int]):
|
||||
instance = self()
|
||||
instance.attackers_side = attacker
|
||||
instance.defenders_side = defender
|
||||
instance.position = position
|
||||
instance.size = size
|
||||
instance.radials = radials
|
||||
|
||||
instance.ground_attackers_location = instance.position.point_from_heading(attack_heading, instance.size * GROUND_DISTANCE_FACTOR)
|
||||
instance.ground_defenders_location = instance.position.point_from_heading(defense_heading, instance.size * GROUND_DISTANCE_FACTOR)
|
||||
@ -43,7 +55,7 @@ class Conflict:
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
def intercept_conflict(self, attacker: Country, defender: Country, position: Point, heading: int):
|
||||
def intercept_conflict(self, attacker: Country, defender: Country, position: Point, heading: int, radials: typing.List[int]):
|
||||
from theater.conflicttheater import SIZE_REGULAR
|
||||
|
||||
instance = self()
|
||||
@ -52,6 +64,7 @@ class Conflict:
|
||||
|
||||
instance.position = position
|
||||
instance.size = SIZE_REGULAR
|
||||
instance.radials = radials
|
||||
|
||||
instance.air_attackers_location = instance.position.point_from_heading(random.randint(*INTERCEPT_ATTACKERS_HEADING) + heading, INTERCEPT_ATTACKERS_DISTANCE)
|
||||
instance.air_defenders_location = instance.position.point_from_heading(random.randint(*INTERCEPT_DEFENDERS_HEADING) + heading, INTERCEPT_DEFENDERS_DISTANCE)
|
||||
@ -59,7 +72,7 @@ class Conflict:
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
def ground_intercept_conflict(self, attacker: Country, defender: Country, position: Point, heading):
|
||||
def ground_intercept_conflict(self, attacker: Country, defender: Country, position: Point, heading: int, radials: typing.List[int]):
|
||||
from theater.conflicttheater import SIZE_SMALL
|
||||
|
||||
instance = self()
|
||||
@ -68,6 +81,7 @@ class Conflict:
|
||||
|
||||
instance.position = position
|
||||
instance.size = SIZE_SMALL
|
||||
instance.radials = radials
|
||||
|
||||
instance.air_attackers_location = instance.position.point_from_heading(random.randint(*INTERCEPT_ATTACKERS_HEADING) + heading, AIR_DISTANCE)
|
||||
instance.ground_defenders_location = instance.position
|
||||
|
||||
@ -7,7 +7,7 @@ class CaucasusTheater(ConflictTheater):
|
||||
kutaisi = ControlPoint(caucasus.Kutaisi.position, ALL_RADIALS, SIZE_SMALL, IMPORTANCE_LOW)
|
||||
senaki = ControlPoint(caucasus.Senaki.position, ALL_RADIALS, SIZE_REGULAR, IMPORTANCE_LOW)
|
||||
kobuleti = ControlPoint(caucasus.Kobuleti.position, COAST_VERTICAL, SIZE_SMALL, IMPORTANCE_LOW)
|
||||
batumi = ControlPoint(caucasus.Batumi.position, COAST_VERTICAL, SIZE_REGULAR, IMPORTANCE_MEDIUM)
|
||||
batumi = ControlPoint(caucasus.Batumi.position, COAST_VERTICAL, SIZE_SMALL, IMPORTANCE_MEDIUM)
|
||||
sukhumi = ControlPoint(caucasus.Sukhumi.position, COAST_VERTICAL, SIZE_REGULAR, IMPORTANCE_MEDIUM)
|
||||
gudauta = ControlPoint(caucasus.Gudauta.position, COAST_VERTICAL, SIZE_REGULAR, IMPORTANCE_MEDIUM)
|
||||
sochi = ControlPoint(caucasus.Sochi.position, COAST_VERTICAL, SIZE_BIG, IMPORTANCE_HIGH)
|
||||
|
||||
@ -49,6 +49,7 @@ class ControlPoint:
|
||||
defender=defender,
|
||||
defense_heading=defense_radial,
|
||||
position=self.position,
|
||||
size=self.size)
|
||||
size=self.size,
|
||||
radials=self.radials)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user