-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate AA & armor to defend airbase. Destruction status correctly t…
…racked.
- Loading branch information
Showing
55 changed files
with
289 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,8 @@ | |
CVN_74_John_C__Stennis, | ||
LHA_1_Tarawa, | ||
Armed_speedboat, | ||
], | ||
"shorad":[ | ||
AirDefence.SAM_Avenger_M1097 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,7 @@ | |
CVN_74_John_C__Stennis, | ||
LHA_1_Tarawa, | ||
Armed_speedboat, | ||
] | ||
], "shorad":[ | ||
AirDefence.SAM_Avenger_M1097, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,5 +29,8 @@ | |
CVN_74_John_C__Stennis, | ||
LHA_1_Tarawa, | ||
Armed_speedboat, | ||
], | ||
"shorad":[ | ||
AirDefence.SAM_Avenger_M1097 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,7 @@ | |
CVN_74_John_C__Stennis, | ||
LHA_1_Tarawa, | ||
Armed_speedboat, | ||
], "shorad":[ | ||
AirDefence.SAM_Avenger_M1097, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,8 @@ | |
CVN_74_John_C__Stennis, | ||
LHA_1_Tarawa, | ||
Armed_speedboat, | ||
], | ||
"shorad":[ | ||
AirDefence.AAA_Vulcan_M163 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,5 +38,7 @@ | |
CVN_74_John_C__Stennis, | ||
LHA_1_Tarawa, | ||
Armed_speedboat, | ||
], "shorad":[ | ||
AirDefence.SAM_Avenger_M1097, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import random | ||
|
||
from dcs.vehicles import Armor | ||
|
||
from game import db | ||
from gen.defenses.armored_group_generator import ArmoredGroupGenerator | ||
|
||
|
||
def generate_armor_group(faction:str, game, ground_object): | ||
""" | ||
This generate a SAM group | ||
:param parentCp: The parent control point | ||
:param ground_object: The ground object which will own the sam group | ||
:param country: Owner country | ||
:return: Nothing, but put the group reference inside the ground object | ||
""" | ||
|
||
possible_unit = [u for u in db.FACTIONS[faction]["units"] if u in Armor.__dict__.values()] | ||
if len(possible_unit) > 0: | ||
unit_type = random.choice(possible_unit) | ||
generator = ArmoredGroupGenerator(game, ground_object, unit_type) | ||
generator.generate() | ||
return generator.get_generated_group() | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import random | ||
|
||
from gen.sam.group_generator import GroupGenerator | ||
|
||
|
||
class ArmoredGroupGenerator(GroupGenerator): | ||
|
||
def __init__(self, game, ground_object, unit_type): | ||
super(ArmoredGroupGenerator, self).__init__(game, ground_object) | ||
self.unit_type = unit_type | ||
|
||
def generate(self): | ||
|
||
grid_x = random.randint(2, 3) | ||
grid_y = random.randint(1, 2) | ||
|
||
spacing = random.randint(30, 80) | ||
|
||
index = 0 | ||
for i in range(grid_x): | ||
for j in range(grid_y): | ||
index = index + 1 | ||
self.add_unit(self.unit_type, "Armor#" + str(index), | ||
self.position.x + spacing * i, | ||
self.position.y + spacing * j, self.heading) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.