mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
feat: Add initial API implementation and databases
Introduces a new Python API module with supporting scripts for data extraction, data types, unit management, and utility functions. Adds JSON databases for aircraft, helicopters, ground units, navy units, and mods, as well as configuration and VSCode launch settings. This provides the foundation for interacting with and managing units, spawning, and logging within the application.
This commit is contained in:
30
scripts/python/API/unit_spawn_table.py
Normal file
30
scripts/python/API/unit_spawn_table.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
from data_types import LatLng
|
||||
|
||||
@dataclass
|
||||
class UnitSpawnTable:
|
||||
"""Unit spawn table data structure for spawning units."""
|
||||
unit_type: str
|
||||
location: LatLng
|
||||
skill: str
|
||||
livery_id: str
|
||||
altitude: Optional[int] = None
|
||||
loadout: Optional[str] = None
|
||||
heading: Optional[int] = None
|
||||
|
||||
def toJSON(self):
|
||||
"""Convert the unit spawn table to a JSON serializable dictionary."""
|
||||
return {
|
||||
"unitType": self.unit_type,
|
||||
"location": {
|
||||
"lat": self.location.lat,
|
||||
"lng": self.location.lng,
|
||||
"alt": self.location.alt
|
||||
},
|
||||
"skill": self.skill,
|
||||
"liveryID": self.livery_id,
|
||||
"altitude": self.altitude,
|
||||
"loadout": self.loadout,
|
||||
"heading": self.heading
|
||||
}
|
||||
Reference in New Issue
Block a user