mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add package info to aircraft names
Makes it easier to identify aircraft for client flights
This commit is contained in:
parent
aa7825d4aa
commit
9fd5c6f230
@ -1039,14 +1039,14 @@ class AircraftConflictGenerator:
|
|||||||
try:
|
try:
|
||||||
if flight.start_type == "In Flight":
|
if flight.start_type == "In Flight":
|
||||||
group = self._generate_inflight(
|
group = self._generate_inflight(
|
||||||
name=namegen.next_unit_name(country, cp.id, flight.unit_type),
|
name=namegen.next_aircraft_name(country, cp.id, flight),
|
||||||
side=country,
|
side=country,
|
||||||
flight=flight,
|
flight=flight,
|
||||||
origin=cp)
|
origin=cp)
|
||||||
elif isinstance(cp, NavalControlPoint):
|
elif isinstance(cp, NavalControlPoint):
|
||||||
group_name = cp.get_carrier_group_name()
|
group_name = cp.get_carrier_group_name()
|
||||||
group = self._generate_at_group(
|
group = self._generate_at_group(
|
||||||
name=namegen.next_unit_name(country, cp.id, flight.unit_type),
|
name=namegen.next_aircraft_name(country, cp.id, flight),
|
||||||
side=country,
|
side=country,
|
||||||
unit_type=flight.unit_type,
|
unit_type=flight.unit_type,
|
||||||
count=flight.count,
|
count=flight.count,
|
||||||
@ -1057,8 +1057,8 @@ class AircraftConflictGenerator:
|
|||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"Attempted to spawn at airfield for non-airfield {cp}")
|
f"Attempted to spawn at airfield for non-airfield {cp}")
|
||||||
group = self._generate_at_airport(
|
group = self._generate_at_airport(
|
||||||
name=namegen.next_unit_name(country, cp.id,
|
name=namegen.next_aircraft_name(country, cp.id,
|
||||||
flight.unit_type),
|
flight),
|
||||||
side=country,
|
side=country,
|
||||||
unit_type=flight.unit_type,
|
unit_type=flight.unit_type,
|
||||||
count=flight.count,
|
count=flight.count,
|
||||||
@ -1070,7 +1070,7 @@ class AircraftConflictGenerator:
|
|||||||
logging.warning("No room on runway or parking slots. Starting from the air.")
|
logging.warning("No room on runway or parking slots. Starting from the air.")
|
||||||
flight.start_type = "In Flight"
|
flight.start_type = "In Flight"
|
||||||
group = self._generate_inflight(
|
group = self._generate_inflight(
|
||||||
name=namegen.next_unit_name(country, cp.id, flight.unit_type),
|
name=namegen.next_aircraft_name(country, cp.id, flight),
|
||||||
side=country,
|
side=country,
|
||||||
flight=flight,
|
flight=flight,
|
||||||
origin=cp)
|
origin=cp)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
from game import db
|
from game import db
|
||||||
|
from gen.flights.flight import Flight
|
||||||
import random
|
import random
|
||||||
|
|
||||||
ALPHA_MILITARY = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot",
|
ALPHA_MILITARY = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot",
|
||||||
@ -51,6 +52,11 @@ class NameGenerator:
|
|||||||
self.number = 0
|
self.number = 0
|
||||||
self.infantry_number = 0
|
self.infantry_number = 0
|
||||||
|
|
||||||
|
def next_aircraft_name(self, country: int, parent_base_id: int, flight: Flight):
|
||||||
|
self.number += 1
|
||||||
|
name_str = "{} {}".format(flight.package.target.name, flight.flight_type)
|
||||||
|
return "{}|{}|{}|{}|{}|".format(name_str, country.id, self.number, parent_base_id, db.unit_type_name(flight.unit_type))
|
||||||
|
|
||||||
def next_unit_name(self, country, parent_base_id, unit_type):
|
def next_unit_name(self, country, parent_base_id, unit_type):
|
||||||
self.number += 1
|
self.number += 1
|
||||||
return "unit|{}|{}|{}|{}|".format(country.id, self.number, parent_base_id, db.unit_type_name(unit_type))
|
return "unit|{}|{}|{}|{}|".format(country.id, self.number, parent_base_id, db.unit_type_name(unit_type))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user