mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge branch 'main' into 747-improve-configurator-for-automatic-saved-games-folder-detection
This commit is contained in:
5
.github/workflows/documentation.yml
vendored
5
.github/workflows/documentation.yml
vendored
@@ -1,7 +1,10 @@
|
|||||||
# ci.yml file for GitHub Actions
|
# ci.yml file for GitHub Actions
|
||||||
name: Documentation
|
name: Documentation
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ var app = express();
|
|||||||
|
|
||||||
app.use(logger('dev'));
|
app.use(logger('dev'));
|
||||||
|
|
||||||
const aircraftDatabase = require('./public/databases/units/aircraftDatabase.json');
|
const aircraftDatabase = require('./public/databases/units/aircraftdatabase.json');
|
||||||
const helicopterDatabase = require('./public/databases/units/helicopterDatabase.json');
|
const helicopterDatabase = require('./public/databases/units/helicopterdatabase.json');
|
||||||
const groundUnitDatabase = require('./public/databases/units/groundUnitDatabase.json');
|
const groundUnitDatabase = require('./public/databases/units/groundunitdatabase.json');
|
||||||
const navyUnitDatabase = require('./public/databases/units/navyUnitDatabase.json');
|
const navyUnitDatabase = require('./public/databases/units/navyunitdatabase.json');
|
||||||
|
|
||||||
const DEMO_UNIT_DATA = {}
|
const DEMO_UNIT_DATA = {}
|
||||||
|
|
||||||
|
|||||||
@@ -13076,6 +13076,50 @@
|
|||||||
"CAP"
|
"CAP"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "AIM-9X Sidewinder IR AAM",
|
||||||
|
"quantity": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AIM-120C-5 AMRAAM Active Rdr AAM",
|
||||||
|
"quantity": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "FPU-8A Fuel Tank 330 gallons",
|
||||||
|
"quantity": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"enabled": true,
|
||||||
|
"code": "AIM-9X*2, AIM-120C-5*6, FUEL*2",
|
||||||
|
"name": "AIM-9X*2, AIM-120C-5*6, FUEL*2",
|
||||||
|
"roles": [
|
||||||
|
"CAP"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "AIM-9X Sidewinder IR AAM",
|
||||||
|
"quantity": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AIM-120C-5 AMRAAM Active Rdr AAM",
|
||||||
|
"quantity": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "FPU-8A Fuel Tank 330 gallons",
|
||||||
|
"quantity": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"enabled": true,
|
||||||
|
"code": "AIM-9X*2, AIM-120C-5*2, FUEL*1",
|
||||||
|
"name": "AIM-9X*2, AIM-120C-5*2, FUEL*1",
|
||||||
|
"roles": [
|
||||||
|
"CAP"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -985,7 +985,7 @@ nav.ol-panel> :last-child {
|
|||||||
|
|
||||||
#login-status[data-status="failed"]::before {
|
#login-status[data-status="failed"]::before {
|
||||||
color: var(--primary-red);
|
color: var(--primary-red);
|
||||||
content: "Incorrect username/password!";
|
content: "Incorrect password!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes blinker {
|
@keyframes blinker {
|
||||||
|
|||||||
@@ -104,6 +104,14 @@ export function reciprocalHeading(heading: number): number {
|
|||||||
return heading > 180? heading - 180: heading + 180;
|
return heading > 180? heading - 180: heading + 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepend numbers to the start of a string
|
||||||
|
*
|
||||||
|
* @param num <number> subject number
|
||||||
|
* @param places <number> places to pad
|
||||||
|
* @param decimal <boolean> whether this is a decimal number or not
|
||||||
|
*
|
||||||
|
* */
|
||||||
export const zeroAppend = function (num: number, places: number, decimal: boolean = false) {
|
export const zeroAppend = function (num: number, places: number, decimal: boolean = false) {
|
||||||
var string = decimal? num.toFixed(2): String(num);
|
var string = decimal? num.toFixed(2): String(num);
|
||||||
while (string.length < places) {
|
while (string.length < places) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Marker, LatLng, Polyline, Icon, DivIcon, CircleMarker, Map, Point } from 'leaflet';
|
import { Marker, LatLng, Polyline, Icon, DivIcon, CircleMarker, Map, Point } from 'leaflet';
|
||||||
import { getApp } from '..';
|
import { getApp } from '..';
|
||||||
import { enumToCoalition, enumToEmissioNCountermeasure, enumToROE, enumToReactionToThreat, enumToState, getUnitDatabaseByCategory, mToFt, msToKnots, rad2deg, bearing, deg2rad, ftToM, getGroundElevation, coalitionToEnum, nmToFt, nmToM } from '../other/utils';
|
import { enumToCoalition, enumToEmissioNCountermeasure, enumToROE, enumToReactionToThreat, enumToState, getUnitDatabaseByCategory, mToFt, msToKnots, rad2deg, bearing, deg2rad, ftToM, getGroundElevation, coalitionToEnum, nmToFt, nmToM, zeroAppend } from '../other/utils';
|
||||||
import { CustomMarker } from '../map/markers/custommarker';
|
import { CustomMarker } from '../map/markers/custommarker';
|
||||||
import { SVGInjector } from '@tanem/svg-injector';
|
import { SVGInjector } from '@tanem/svg-injector';
|
||||||
import { UnitDatabase } from './databases/unitdatabase';
|
import { UnitDatabase } from './databases/unitdatabase';
|
||||||
@@ -1184,7 +1184,7 @@ export abstract class Unit extends CustomMarker {
|
|||||||
|
|
||||||
/* Set altitude and speed */
|
/* Set altitude and speed */
|
||||||
if (element.querySelector(".unit-altitude"))
|
if (element.querySelector(".unit-altitude"))
|
||||||
(<HTMLElement>element.querySelector(".unit-altitude")).innerText = "FL" + String(Math.floor(mToFt(this.#position.alt as number) / 100));
|
(<HTMLElement>element.querySelector(".unit-altitude")).innerText = "FL" + zeroAppend(Math.floor(mToFt(this.#position.alt as number) / 100), 3);
|
||||||
if (element.querySelector(".unit-speed"))
|
if (element.querySelector(".unit-speed"))
|
||||||
(<HTMLElement>element.querySelector(".unit-speed")).innerText = String(Math.floor(msToKnots(this.#speed))) + "GS";
|
(<HTMLElement>element.querySelector(".unit-speed")).innerText = String(Math.floor(msToKnots(this.#speed))) + "GS";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { LatLng, DivIcon, Map } from 'leaflet';
|
import { LatLng, DivIcon, Map } from 'leaflet';
|
||||||
import { getApp } from '..';
|
import { getApp } from '..';
|
||||||
import { enumToCoalition, mToFt, msToKnots, rad2deg } from '../other/utils';
|
import { enumToCoalition, mToFt, msToKnots, rad2deg, zeroAppend } from '../other/utils';
|
||||||
import { CustomMarker } from '../map/markers/custommarker';
|
import { CustomMarker } from '../map/markers/custommarker';
|
||||||
import { SVGInjector } from '@tanem/svg-injector';
|
import { SVGInjector } from '@tanem/svg-injector';
|
||||||
import { DLINK, DataIndexes, GAME_MASTER, IRST, OPTIC, RADAR, VISUAL } from '../constants/constants';
|
import { DLINK, DataIndexes, GAME_MASTER, IRST, OPTIC, RADAR, VISUAL } from '../constants/constants';
|
||||||
@@ -230,7 +230,7 @@ export class Weapon extends CustomMarker {
|
|||||||
|
|
||||||
/* Set altitude and speed */
|
/* Set altitude and speed */
|
||||||
if (element.querySelector(".unit-altitude"))
|
if (element.querySelector(".unit-altitude"))
|
||||||
(<HTMLElement>element.querySelector(".unit-altitude")).innerText = "FL" + String(Math.floor(mToFt(this.#position.alt as number) / 100));
|
(<HTMLElement>element.querySelector(".unit-altitude")).innerText = "FL" + zeroAppend(Math.floor(mToFt(this.#position.alt as number) / 100), 3);
|
||||||
if (element.querySelector(".unit-speed"))
|
if (element.querySelector(".unit-speed"))
|
||||||
(<HTMLElement>element.querySelector(".unit-speed")).innerText = String(Math.floor(msToKnots(this.#speed))) + "GS";
|
(<HTMLElement>element.querySelector(".unit-speed")).innerText = String(Math.floor(msToKnots(this.#speed))) + "GS";
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="authentication-form">
|
<form id="authentication-form">
|
||||||
<div><h5>Name</h5> <input type="text" id="username" name="username" required autocomplete="username" placeholder="Enter name..."></div>
|
<div><h5>Display Name</h5> <input type="text" id="username" name="username" required autocomplete="username" placeholder="Enter display name..."></div>
|
||||||
<div><h5>Server password</h5> <input type="password" id="password" name="password" required autocomplete="current-password" placeholder="Enter server password..."></div>
|
<div><h5>Password</h5> <input type="password" id="password" name="password" required autocomplete="current-password" placeholder="Enter game master/commander password..."></div>
|
||||||
<button type="submit" id="connection-button" class="ol-button-apply">Connect</button>
|
<button type="submit" id="connection-button" class="ol-button-apply">Connect</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
69
scripts/python/mod_ac_loadout_puller.py
Normal file
69
scripts/python/mod_ac_loadout_puller.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
# save DCS.openbeta\\mods\\aircraft path as variable
|
||||||
|
path = f"{os.environ['UserProfile']}\\Saved Games\\DCS.openbeta\\Mods\\aircraft"
|
||||||
|
|
||||||
|
# write everything to a working file - to be deleted after getting rid of unnecessary trailing commas
|
||||||
|
with open('working_file.lua', mode='w') as payload_file:
|
||||||
|
|
||||||
|
payload_file.write('Olympus.unitPayloads = {\n')
|
||||||
|
|
||||||
|
# iterate through everything in mod aircraft path
|
||||||
|
for f in os.listdir(path):
|
||||||
|
|
||||||
|
# modders are inconsistent with the lua filename, so grab that first file in the correct directory
|
||||||
|
try:
|
||||||
|
unitpayload_lua_dir = f"{path}\\{f}\\UnitPayloads"
|
||||||
|
try:
|
||||||
|
lua_filename = os.listdir(unitpayload_lua_dir)[0]
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
unitpayload_lua_path = f"{unitpayload_lua_dir}\\{lua_filename}"
|
||||||
|
|
||||||
|
# read the aircraft's payloads and write the relevant material into the working file
|
||||||
|
with open(unitpayload_lua_path) as payload_lua_file:
|
||||||
|
lines = payload_lua_file.readlines()
|
||||||
|
for line in lines:
|
||||||
|
if line.startswith(' ["name"]'):
|
||||||
|
ac_type = line.replace(' ["name"] = "', '').replace('",', '').rstrip()
|
||||||
|
ac_type = f'["{ac_type}"] =' + r' {'
|
||||||
|
payload_file.write(ac_type + '\n')
|
||||||
|
elif line.startswith(' ["name"]'):
|
||||||
|
loadout_name = line.replace(' ["name"] = "', '').replace('",', '').rstrip()
|
||||||
|
loadout_name = f'["{loadout_name}"] =' + r' {'
|
||||||
|
payload_file.write(loadout_name + '\n')
|
||||||
|
elif line.startswith(' ["CLSID"]'):
|
||||||
|
clsid = line.replace(' ', '').replace(',', '').rstrip()
|
||||||
|
clsid = r'{' + f'{clsid}' + r'}' + ','
|
||||||
|
elif line.startswith(' ["num"]'):
|
||||||
|
pylon = line.replace(' ["num"] = ', '').replace(',', '').rstrip()
|
||||||
|
pylon = f'[{pylon}] = '
|
||||||
|
payload_file.write(pylon + clsid + '\n')
|
||||||
|
elif line.startswith(' },'):
|
||||||
|
payload_file.write('},\n')
|
||||||
|
elif line.startswith('}'):
|
||||||
|
payload_file.write('},\n')
|
||||||
|
|
||||||
|
# skip directory if no directory or no file in directory
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
payload_file.write('}')
|
||||||
|
|
||||||
|
# parse the working file, get rid of trailing commas when next line starts with a '}'.
|
||||||
|
with open("working_file.lua") as working_file:
|
||||||
|
lines = working_file.readlines()
|
||||||
|
prev_line = ''
|
||||||
|
with open("payloads.lua", mode="w") as payload_file:
|
||||||
|
for ind, line in enumerate(lines):
|
||||||
|
try:
|
||||||
|
if lines[ind + 1].startswith('}') and line.endswith('},\n'):
|
||||||
|
new_line = line.replace(',', '')
|
||||||
|
payload_file.write(f'{new_line}')
|
||||||
|
else:
|
||||||
|
payload_file.write(line)
|
||||||
|
except IndexError:
|
||||||
|
payload_file.write(line)
|
||||||
|
|
||||||
|
# delete the working file
|
||||||
|
os.remove("working_file.lua")
|
||||||
29913
scripts/unitPayloads.lua
29913
scripts/unitPayloads.lua
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user