mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Show the real front line bounds on the map.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1067.
This commit is contained in:
parent
c4358daccc
commit
5f4a75601b
@ -16,6 +16,7 @@ Saves from 8.x are not compatible with 9.0.0.
|
||||
* **[UI]** An error will be displayed when invalid fast-forward options are selected rather than beginning a never ending simulation.
|
||||
* **[UI]** Added cheats for instantly repairing and destroying runways.
|
||||
* **[UI]** Improved usability of the flight properties UI. It now shows human-readable names and uses more appropriate UI elements.
|
||||
* **[UI]** The map now shows the real front line bounds.
|
||||
|
||||
## Fixes
|
||||
|
||||
|
||||
@ -11,10 +11,9 @@ from game.server.flights.models import FlightJs
|
||||
from game.server.frontlines.models import FrontLineJs
|
||||
from game.server.iadsnetwork.models import IadsConnectionJs
|
||||
from game.server.leaflet import LeafletPoint
|
||||
from game.server.mapzones.models import ThreatZonesJs
|
||||
from game.server.mapzones.models import ThreatZonesJs, UnculledZoneJs
|
||||
from game.server.navmesh.models import NavMeshJs
|
||||
from game.server.tgos.models import TgoJs
|
||||
from game.server.mapzones.models import UnculledZoneJs
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
@ -57,6 +56,7 @@ class GameUpdateEventsJs(BaseModel):
|
||||
updated_threat_zones = {}
|
||||
updated_unculled_zones = []
|
||||
updated_iads = []
|
||||
updated_front_lines = []
|
||||
if game is not None:
|
||||
new_combats = [
|
||||
FrozenCombatJs.for_combat(c, game.theater) for c in events.new_combats
|
||||
@ -76,6 +76,10 @@ class GameUpdateEventsJs(BaseModel):
|
||||
updated_unculled_zones = UnculledZoneJs.from_game(game)
|
||||
for node in events.updated_iads:
|
||||
updated_iads.extend(IadsConnectionJs.connections_for_node(node))
|
||||
updated_front_lines = [
|
||||
FrontLineJs.for_front_line(game.theater, f)
|
||||
for f in events.updated_front_lines
|
||||
]
|
||||
|
||||
return GameUpdateEventsJs(
|
||||
updated_flight_positions={
|
||||
@ -97,9 +101,7 @@ class GameUpdateEventsJs(BaseModel):
|
||||
deleted_flights=events.deleted_flights,
|
||||
selected_flight=events.selected_flight,
|
||||
deselected_flight=events.deselected_flight,
|
||||
updated_front_lines=[
|
||||
FrontLineJs.for_front_line(f) for f in events.updated_front_lines
|
||||
],
|
||||
updated_front_lines=updated_front_lines,
|
||||
deleted_front_lines=events.deleted_front_lines,
|
||||
updated_tgos=[TgoJs.for_tgo(tgo) for tgo in events.updated_tgos],
|
||||
updated_control_points=[
|
||||
|
||||
@ -5,12 +5,14 @@ from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from game.missiongenerator.frontlineconflictdescription import (
|
||||
FrontLineConflictDescription,
|
||||
)
|
||||
from game.server.leaflet import LeafletPoint
|
||||
from game.utils import nautical_miles
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
from game.theater import FrontLine
|
||||
from game.theater import FrontLine, ConflictTheater
|
||||
|
||||
|
||||
class FrontLineJs(BaseModel):
|
||||
@ -21,17 +23,16 @@ class FrontLineJs(BaseModel):
|
||||
title = "FrontLine"
|
||||
|
||||
@staticmethod
|
||||
def for_front_line(front_line: FrontLine) -> FrontLineJs:
|
||||
a = front_line.position.point_from_heading(
|
||||
front_line.blue_forward_heading.right.degrees,
|
||||
nautical_miles(2).meters,
|
||||
def for_front_line(theater: ConflictTheater, front_line: FrontLine) -> FrontLineJs:
|
||||
bounds = FrontLineConflictDescription.frontline_bounds(front_line, theater)
|
||||
return FrontLineJs(
|
||||
id=front_line.id,
|
||||
extents=[bounds.left_position.latlng(), bounds.right_position.latlng()],
|
||||
)
|
||||
b = front_line.position.point_from_heading(
|
||||
front_line.blue_forward_heading.left.degrees,
|
||||
nautical_miles(2).meters,
|
||||
)
|
||||
return FrontLineJs(id=front_line.id, extents=[a.latlng(), b.latlng()])
|
||||
|
||||
@staticmethod
|
||||
def all_in_game(game: Game) -> list[FrontLineJs]:
|
||||
return [FrontLineJs.for_front_line(f) for f in game.theater.conflicts()]
|
||||
return [
|
||||
FrontLineJs.for_front_line(game.theater, f)
|
||||
for f in game.theater.conflicts()
|
||||
]
|
||||
|
||||
@ -20,4 +20,6 @@ def list_front_lines(game: Game = Depends(GameContext.require)) -> list[FrontLin
|
||||
def get_front_line(
|
||||
front_line_id: UUID, game: Game = Depends(GameContext.require)
|
||||
) -> FrontLineJs:
|
||||
return FrontLineJs.for_front_line(game.db.front_lines.get(front_line_id))
|
||||
return FrontLineJs.for_front_line(
|
||||
game.theater, game.db.front_lines.get(front_line_id)
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user