mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add culling exclusion zones display to the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2158
This commit is contained in:
@@ -8,7 +8,7 @@ from game.server.controlpoints.models import ControlPointJs
|
||||
from game.server.flights.models import FlightJs
|
||||
from game.server.frontlines.models import FrontLineJs
|
||||
from game.server.leaflet import LeafletPoint
|
||||
from game.server.mapzones.models import ThreatZoneContainerJs
|
||||
from game.server.mapzones.models import ThreatZoneContainerJs, UnculledZoneJs
|
||||
from game.server.navmesh.models import NavMeshesJs
|
||||
from game.server.supplyroutes.models import SupplyRouteJs
|
||||
from game.server.tgos.models import TgoJs
|
||||
@@ -28,6 +28,7 @@ class GameJs(BaseModel):
|
||||
threat_zones: ThreatZoneContainerJs
|
||||
navmeshes: NavMeshesJs
|
||||
map_center: LeafletPoint | None
|
||||
unculled_zones: list[UnculledZoneJs]
|
||||
|
||||
class Config:
|
||||
title = "Game"
|
||||
@@ -44,4 +45,5 @@ class GameJs(BaseModel):
|
||||
threat_zones=ThreatZoneContainerJs.for_game(game),
|
||||
navmeshes=NavMeshesJs.from_game(game),
|
||||
map_center=game.theater.terrain.map_view_default.position.latlng(),
|
||||
unculled_zones=UnculledZoneJs.from_game(game),
|
||||
)
|
||||
|
||||
@@ -28,6 +28,16 @@ class UnculledZoneJs(BaseModel):
|
||||
class Config:
|
||||
title = "UnculledZone"
|
||||
|
||||
@staticmethod
|
||||
def from_game(game: Game) -> list[UnculledZoneJs]:
|
||||
return [
|
||||
UnculledZoneJs(
|
||||
position=zone.latlng(),
|
||||
radius=game.settings.perf_culling_distance * 1000,
|
||||
)
|
||||
for zone in game.get_culling_zones()
|
||||
]
|
||||
|
||||
|
||||
class ThreatZonesJs(BaseModel):
|
||||
full: list[LeafletPoly]
|
||||
|
||||
@@ -27,12 +27,7 @@ def get_terrain(game: Game = Depends(GameContext.require)) -> MapZonesJs:
|
||||
def get_unculled_zones(
|
||||
game: Game = Depends(GameContext.require),
|
||||
) -> list[UnculledZoneJs]:
|
||||
return [
|
||||
UnculledZoneJs(
|
||||
position=zone.latlng(), radius=game.settings.perf_culling_distance * 1000
|
||||
)
|
||||
for zone in game.get_culling_zones()
|
||||
]
|
||||
return UnculledZoneJs.from_game(game)
|
||||
|
||||
|
||||
@router.get(
|
||||
|
||||
Reference in New Issue
Block a user