Added unit country selection

This commit is contained in:
Pax1601
2023-08-27 15:59:50 +02:00
parent eb80c39b98
commit 9d7e61556d
20 changed files with 858 additions and 28826 deletions

View File

@@ -1,6 +1,6 @@
local version = "v0.4.2-alpha"
local debug = false
local debug = true
Olympus.OlympusDLL = nil
Olympus.DLLsloaded = false
@@ -404,7 +404,13 @@ function Olympus.spawnUnits(spawnTable)
Olympus.debug(Olympus.serializeTable(unitTable), 5)
local countryID = Olympus.getCountryIDByCoalition(spawnTable.coalition)
local countryID = 0
if spawnTable.country == nil or spawnTable.country == "" then
countryID = Olympus.getCountryIDByCoalition(spawnTable.coalition)
else
countryID = country.id[spawnTable.country]
end
local vars =
{
units = unitTable,

View File

@@ -16,9 +16,6 @@ from dcs.liveries.liveryscanner import LiveryScanner
livery_scanner = LiveryScanner()
livery_scanner.scan_dcs_installation(SEARCH_FOLDER)
#print("Liveries found for units:")
#[print(key) for key in livery_scanner.map.keys()]
# Known id mismatches (because reasons, ask ED)
mismatched_ids = {
"A-10CII": "A-10C_2"
@@ -72,7 +69,7 @@ if len(sys.argv) > 1:
database[unit_name]["liveries"] = {}
for livery in liveries:
database[unit_name]["liveries"][livery.id] = livery.name
database[unit_name]["liveries"][livery.id] = livery.name
# Create the loadouts table and add the empty loadout for the default task
database[unit_name]["loadouts"] = []

File diff suppressed because it is too large Load Diff

15
scripts/python/temp.py Normal file
View File

@@ -0,0 +1,15 @@
import json
import difflib
countries = ['USA', 'GRG', 'GER', 'DZA', 'FRA', 'CAN', 'AUS', 'UKR', 'ITA', 'GRC', 'SPN', 'RUS', 'NETH', 'DEN', 'TUR', 'UK', 'BEL', 'ISR', 'NOR', 'JPN', 'ARE', 'QAT', 'IND', 'SAU', 'EGY', 'KOR', 'HND', 'CHL', 'BLUE', 'AUSAF', 'RED', 'VNM', 'SVK', 'SDN', 'GDR', 'JOR', 'PER', 'CHN', 'IDN', 'PHL', 'BOL', 'MAR', 'YEM', 'KWT', 'SUI', 'GHA', 'CYP', 'BHR', 'YUG', 'CZE', 'KAZ', 'AUT', 'HUN', 'MYS', 'ROU', 'THA', 'LBN', 'FIN', 'PRT', 'OMN', 'MEX', 'IRQ', 'BRA', 'SWE', 'NZG', 'CUB', 'INS', 'RSO', 'RSA', 'HRV', 'ABH', 'ARG', 'LBY', 'PRK', 'VEN', 'TUN', 'IRN', 'ETH', 'BLR', 'SUN', 'BGR', 'PAK', 'NGA', 'POL', 'SVN', 'SYR', 'SRB', 'UN', 'RSI', 'SPA', 'ECU', '', 'USAF', 'hide', 'EGP', 'LIB']
with open('C:\\Users\\dpass\\Documents\\DCSOlympus\\client\\public\\images\\nations\\codes.json', "r") as f:
codes = json.load(f)
for country in countries:
keys = difflib.get_close_matches(country, codes.keys(), cutoff=.35)
if len(keys) > 0:
codes[keys[0]]["liveryCodes"].append(country)
with open('C:\\Users\\dpass\\Documents\\DCSOlympus\\client\\public\\images\\nations\\codes.json', "w") as f:
json.dump(codes, f)