Merge remote-tracking branch 'remotes/dcs-retribution/dcs-retribution/dev' into pretense-generator

This commit is contained in:
MetalStormGhost
2024-05-19 19:04:37 +03:00
52 changed files with 893 additions and 298 deletions

View File

@@ -9,7 +9,11 @@ from game.server.flights.models import FlightJs
from game.server.frontlines.models import FrontLineJs
from game.server.iadsnetwork.models import IadsNetworkJs
from game.server.leaflet import LeafletPoint
from game.server.mapzones.models import ThreatZoneContainerJs, UnculledZoneJs
from game.server.mapzones.models import (
ThreatZoneContainerJs,
UnculledZoneJs,
MapZonesJs,
)
from game.server.navmesh.models import NavMeshesJs
from game.server.supplyroutes.models import SupplyRouteJs
from game.server.tgos.models import TgoJs
@@ -29,6 +33,7 @@ class GameJs(BaseModel):
navmeshes: NavMeshesJs
map_center: LeafletPoint | None
unculled_zones: list[UnculledZoneJs]
map_zones: MapZonesJs
class Config:
title = "Game"
@@ -46,4 +51,5 @@ class GameJs(BaseModel):
navmeshes=NavMeshesJs.from_game(game),
map_center=game.theater.terrain.map_view_default.position.latlng(),
unculled_zones=UnculledZoneJs.from_game(game),
map_zones=MapZonesJs.from_game(game),
)

View File

@@ -24,6 +24,18 @@ class MapZonesJs(BaseModel):
def empty(cls) -> MapZonesJs:
return MapZonesJs(inclusion=[], exclusion=[], sea=[])
@classmethod
def from_game(cls, game: Game) -> MapZonesJs:
zones = game.theater.landmap
if zones is None:
return cls.empty()
return MapZonesJs(
inclusion=ShapelyUtil.polys_to_leaflet(zones.inclusion_zones, game.theater),
exclusion=ShapelyUtil.polys_to_leaflet(zones.exclusion_zones, game.theater),
sea=ShapelyUtil.polys_to_leaflet(zones.sea_zones, game.theater),
)
class UnculledZoneJs(BaseModel):
position: LeafletPoint

View File

@@ -1198,7 +1198,6 @@ class Settings:
# Cheating. Not using auto settings because the same page also has buttons which do
# not alter settings.
show_red_ato: bool = False
enable_frontline_cheats: bool = False
enable_base_capture_cheat: bool = False
enable_transfer_cheat: bool = False

View File

@@ -17,6 +17,7 @@ from dcs.terrain import (
Syria,
TheChannel,
Sinai,
Kola,
)
from .conflicttheater import ConflictTheater
@@ -34,6 +35,7 @@ ALL_TERRAINS = [
TheChannel(),
Syria(),
Sinai(),
Kola(),
]
TERRAINS_BY_NAME = {t.name: t for t in ALL_TERRAINS}