mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add threat zone support to the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from game.server.leaflet import LeafletPoint, LeafletPoly, ShapelyUtil
|
||||
from game.theater import ConflictTheater
|
||||
from game.threatzones import ThreatZones
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
|
||||
|
||||
class MapZonesJs(BaseModel):
|
||||
inclusion: list[LeafletPoly]
|
||||
@@ -49,3 +54,14 @@ class ThreatZoneContainerJs(BaseModel):
|
||||
|
||||
class Config:
|
||||
title = "ThreatZoneContainer"
|
||||
|
||||
@staticmethod
|
||||
def for_game(game: Game) -> ThreatZoneContainerJs:
|
||||
return ThreatZoneContainerJs(
|
||||
blue=ThreatZonesJs.from_zones(
|
||||
game.threat_zone_for(player=True), game.theater
|
||||
),
|
||||
red=ThreatZonesJs.from_zones(
|
||||
game.threat_zone_for(player=False), game.theater
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user