mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +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:
|
||||
if flight.start_type == "In Flight":
|
||||
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,
|
||||
flight=flight,
|
||||
origin=cp)
|
||||
elif isinstance(cp, NavalControlPoint):
|
||||
group_name = cp.get_carrier_group_name()
|
||||
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,
|
||||
unit_type=flight.unit_type,
|
||||
count=flight.count,
|
||||
@ -1057,8 +1057,8 @@ class AircraftConflictGenerator:
|
||||
raise RuntimeError(
|
||||
f"Attempted to spawn at airfield for non-airfield {cp}")
|
||||
group = self._generate_at_airport(
|
||||
name=namegen.next_unit_name(country, cp.id,
|
||||
flight.unit_type),
|
||||
name=namegen.next_aircraft_name(country, cp.id,
|
||||
flight),
|
||||
side=country,
|
||||
unit_type=flight.unit_type,
|
||||
count=flight.count,
|
||||
@ -1070,7 +1070,7 @@ class AircraftConflictGenerator:
|
||||
logging.warning("No room on runway or parking slots. Starting from the air.")
|
||||
flight.start_type = "In Flight"
|
||||
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,
|
||||
flight=flight,
|
||||
origin=cp)
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
from game import db
|
||||
from gen.flights.flight import Flight
|
||||
import random
|
||||
|
||||
ALPHA_MILITARY = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot",
|
||||
@ -51,6 +52,11 @@ class NameGenerator:
|
||||
self.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):
|
||||
self.number += 1
|
||||
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