mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
commit
aca415db23
@ -190,9 +190,9 @@ class Game:
|
|||||||
|
|
||||||
def is_player_attack(self, event):
|
def is_player_attack(self, event):
|
||||||
if isinstance(event, Event):
|
if isinstance(event, Event):
|
||||||
return event.attacker_name == self.player_name
|
return event and event.attacker_name and event.attacker_name == self.player_name
|
||||||
else:
|
else:
|
||||||
return event.name == self.player_name
|
return event and event.name and event.name == self.player_name
|
||||||
|
|
||||||
def pass_turn(self, no_action=False, ignored_cps: typing.Collection[ControlPoint] = None):
|
def pass_turn(self, no_action=False, ignored_cps: typing.Collection[ControlPoint] = None):
|
||||||
|
|
||||||
|
|||||||
@ -236,9 +236,9 @@ class Operation:
|
|||||||
|
|
||||||
# Inject Plugins Lua Scripts
|
# Inject Plugins Lua Scripts
|
||||||
listOfPluginsScripts = []
|
listOfPluginsScripts = []
|
||||||
try:
|
plugin_file_path = Path("./resources/scripts/plugins/__plugins.lst")
|
||||||
with open("./resources/scripts/plugins/__plugins.lst", "r") as a_file:
|
if plugin_file_path.exists():
|
||||||
for line in a_file:
|
for line in plugin_file_path.read_text().splitlines():
|
||||||
name = line.strip()
|
name = line.strip()
|
||||||
if not name.startswith( '#' ):
|
if not name.startswith( '#' ):
|
||||||
trigger = TriggerStart(comment="Load " + name)
|
trigger = TriggerStart(comment="Load " + name)
|
||||||
@ -246,8 +246,9 @@ class Operation:
|
|||||||
fileref = self.current_mission.map_resource.add_resource_file("./resources/scripts/plugins/" + name)
|
fileref = self.current_mission.map_resource.add_resource_file("./resources/scripts/plugins/" + name)
|
||||||
trigger.add_action(DoScriptFile(fileref))
|
trigger.add_action(DoScriptFile(fileref))
|
||||||
self.current_mission.triggerrules.triggers.append(trigger)
|
self.current_mission.triggerrules.triggers.append(trigger)
|
||||||
except Exception as e:
|
else:
|
||||||
print(e)
|
logging.info(
|
||||||
|
f"Not loading plugins, {plugin_file_path} does not exist")
|
||||||
|
|
||||||
# Inject Mist Script if not done already in the plugins
|
# Inject Mist Script if not done already in the plugins
|
||||||
if not "mist.lua" in listOfPluginsScripts and not "mist_4_3_74.lua" in listOfPluginsScripts: # don't load the script twice
|
if not "mist.lua" in listOfPluginsScripts and not "mist_4_3_74.lua" in listOfPluginsScripts: # don't load the script twice
|
||||||
|
|||||||
@ -83,7 +83,7 @@ class NewGameWizard(QtWidgets.QWizard):
|
|||||||
print("Enemy name : " + enemy_name)
|
print("Enemy name : " + enemy_name)
|
||||||
print("Player name : " + player_name)
|
print("Player name : " + player_name)
|
||||||
print("Midgame : " + str(midgame))
|
print("Midgame : " + str(midgame))
|
||||||
start_generator.generate_inital_units(conflictTheater, enemy_name, True, multiplier)
|
start_generator.generate_initial_units(conflictTheater, enemy_name, True, multiplier)
|
||||||
|
|
||||||
print("-- Initial units generated")
|
print("-- Initial units generated")
|
||||||
game = Game(player_name=player_name,
|
game = Game(player_name=player_name,
|
||||||
|
|||||||
@ -27,7 +27,7 @@ COUNT_BY_TASK = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def generate_inital_units(theater: ConflictTheater, enemy_country: str, sams: bool, multiplier: float):
|
def generate_initial_units(theater: ConflictTheater, enemy_country: str, sams: bool, multiplier: float):
|
||||||
for cp in theater.enemy_points():
|
for cp in theater.enemy_points():
|
||||||
if cp.captured:
|
if cp.captured:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user