working briefinggen refactor

This commit is contained in:
walterroach 2020-10-29 23:57:56 -05:00 committed by Dan Albert
parent 6878b57fba
commit f81a3d03c0
2 changed files with 19 additions and 14 deletions

View File

@ -300,12 +300,12 @@ class Operation:
airsupportgen.air_support) airsupportgen.air_support)
kneeboard_generator = KneeboardGenerator(self.current_mission) kneeboard_generator = KneeboardGenerator(self.current_mission)
for dynamic_runway in groundobjectgen.runways.values(): # for dynamic_runway in groundobjectgen.runways.values():
self.briefinggen.add_dynamic_runway(dynamic_runway) # self.briefinggen.add_dynamic_runway(dynamic_runway)
for tanker in airsupportgen.air_support.tankers: for tanker in airsupportgen.air_support.tankers:
self.briefinggen.add_tanker(tanker) # self.briefinggen.add_tanker(tanker)
kneeboard_generator.add_tanker(tanker) # kneeboard_generator.add_tanker(tanker)
luaData["Tankers"][tanker.callsign] = { luaData["Tankers"][tanker.callsign] = {
"dcsGroupName": tanker.dcsGroupName, "dcsGroupName": tanker.dcsGroupName,
"callsign": tanker.callsign, "callsign": tanker.callsign,
@ -316,8 +316,8 @@ class Operation:
if self.is_awacs_enabled: if self.is_awacs_enabled:
for awacs in airsupportgen.air_support.awacs: for awacs in airsupportgen.air_support.awacs:
self.briefinggen.add_awacs(awacs) # self.briefinggen.add_awacs(awacs)
kneeboard_generator.add_awacs(awacs) # kneeboard_generator.add_awacs(awacs)
luaData["AWACs"][awacs.callsign] = { luaData["AWACs"][awacs.callsign] = {
"dcsGroupName": awacs.dcsGroupName, "dcsGroupName": awacs.dcsGroupName,
"callsign": awacs.callsign, "callsign": awacs.callsign,
@ -325,8 +325,8 @@ class Operation:
} }
for jtac in jtacs: for jtac in jtacs:
self.briefinggen.add_jtac(jtac) # self.briefinggen.add_jtac(jtac)
kneeboard_generator.add_jtac(jtac) # kneeboard_generator.add_jtac(jtac)
luaData["JTACs"][jtac.callsign] = { luaData["JTACs"][jtac.callsign] = {
"dcsGroupName": jtac.dcsGroupName, "dcsGroupName": jtac.dcsGroupName,
"callsign": jtac.callsign, "callsign": jtac.callsign,
@ -336,8 +336,8 @@ class Operation:
} }
for flight in airgen.flights: for flight in airgen.flights:
self.briefinggen.add_flight(flight) # self.briefinggen.add_flight(flight)
kneeboard_generator.add_flight(flight) # kneeboard_generator.add_flight(flight)
if flight.friendly and flight.flight_type in [FlightType.ANTISHIP, FlightType.DEAD, FlightType.SEAD, FlightType.STRIKE]: if flight.friendly and flight.flight_type in [FlightType.ANTISHIP, FlightType.DEAD, FlightType.SEAD, FlightType.STRIKE]:
flightType = flight.flight_type.name flightType = flight.flight_type.name
flightTarget = flight.package.target flightTarget = flight.package.target

View File

@ -1,3 +1,6 @@
'''
Briefing generation logic
'''
import os import os
import random import random
import logging import logging
@ -58,7 +61,7 @@ class FrontLineInfo:
"critical, and we will lose ground inevitably.") "critical, and we will lose ground inevitably.")
elif self.enemy_zero: elif self.enemy_zero:
return ("The enemy forces have been crushed, we will be able to make significant progress" return ("The enemy forces have been crushed, we will be able to make significant progress"
f" toward {enemy_base.name}.") f" toward {self.enemy_base.name}.")
return None return None
@property @property
@ -73,14 +76,14 @@ class FrontLineInfo:
elif self.stance == CombatStance.ELIMINATION: elif self.stance == CombatStance.ELIMINATION:
return ( return (
"On this location, our ground forces will focus on the destruction of enemy" "On this location, our ground forces will focus on the destruction of enemy"
f"assets, before attempting to make progress toward {enemy_base.name}. " f"assets, before attempting to make progress toward {self.enemy_base.name}. "
"The enemy is already outnumbered, and this maneuver might draw a final " "The enemy is already outnumbered, and this maneuver might draw a final "
"blow to their forces." "blow to their forces."
) )
elif self.stance == CombatStance.BREAKTHROUGH: elif self.stance == CombatStance.BREAKTHROUGH:
return ( return (
"On this location, our ground forces will focus on progression toward " "On this location, our ground forces will focus on progression toward "
f"{enemy_base.name}." f"{self.enemy_base.name}."
) )
elif self.stance in [CombatStance.DEFENSIVE, CombatStance.AMBUSH]: elif self.stance in [CombatStance.DEFENSIVE, CombatStance.AMBUSH]:
return ( return (
@ -109,7 +112,7 @@ class FrontLineInfo:
elif self.stance == CombatStance.BREAKTHROUGH: elif self.stance == CombatStance.BREAKTHROUGH:
return ( return (
"On this location, our ground forces have been ordered to rush toward " "On this location, our ground forces have been ordered to rush toward "
f"{enemy_base.name}. Wish them luck... We are also expecting a counter attack." f"{self.enemy_base.name}. Wish them luck... We are also expecting a counter attack."
) )
elif self.stance in [CombatStance.DEFENSIVE, CombatStance.AMBUSH]: elif self.stance in [CombatStance.DEFENSIVE, CombatStance.AMBUSH]:
return ( return (
@ -131,6 +134,8 @@ class FrontLineInfo:
situation += self._advantage_description situation += self._advantage_description
else: else:
situation += self._disadvantage_description situation += self._disadvantage_description
return situation
class MissionInfoGenerator: class MissionInfoGenerator:
"""Base type for generators of mission information for the player. """Base type for generators of mission information for the player.