mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add map markers for each building in the group.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1126
This commit is contained in:
parent
a0833e8943
commit
136e776b03
@ -190,6 +190,10 @@ class TheaterGroundObject(MissionTarget):
|
||||
def strike_targets(self) -> List[Union[MissionTarget, Unit]]:
|
||||
return self.units
|
||||
|
||||
@property
|
||||
def mark_locations(self) -> Iterator[Point]:
|
||||
yield self.position
|
||||
|
||||
def clear(self) -> None:
|
||||
self.groups = []
|
||||
|
||||
@ -258,6 +262,11 @@ class BuildingGroundObject(TheaterGroundObject):
|
||||
def strike_targets(self) -> List[Union[MissionTarget, Unit]]:
|
||||
return list(self.iter_building_group())
|
||||
|
||||
@property
|
||||
def mark_locations(self) -> Iterator[Point]:
|
||||
for building in self.iter_building_group():
|
||||
yield building.position
|
||||
|
||||
@property
|
||||
def is_control_point(self) -> bool:
|
||||
return self.is_fob_structure
|
||||
|
||||
@ -10,14 +10,12 @@ from dcs.condition import (
|
||||
FlagIsFalse,
|
||||
FlagIsTrue,
|
||||
)
|
||||
from dcs.unitgroup import FlyingGroup
|
||||
from dcs.mission import Mission
|
||||
from dcs.task import Option
|
||||
from dcs.translation import String
|
||||
from dcs.triggers import (
|
||||
Event,
|
||||
TriggerOnce,
|
||||
TriggerZone,
|
||||
TriggerCondition,
|
||||
)
|
||||
from dcs.unit import Skill
|
||||
@ -25,7 +23,6 @@ from dcs.unit import Skill
|
||||
from game.theater import Airfield
|
||||
from game.theater.controlpoint import Fob
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game.game import Game
|
||||
|
||||
@ -115,19 +112,22 @@ class TriggersGenerator:
|
||||
mark_trigger.add_condition(TimeAfter(1))
|
||||
v = 10
|
||||
for cp in self.game.theater.controlpoints:
|
||||
added = []
|
||||
seen = set()
|
||||
for ground_object in cp.ground_objects:
|
||||
if ground_object.obj_name not in added:
|
||||
if ground_object.obj_name in seen:
|
||||
continue
|
||||
|
||||
seen.add(ground_object.obj_name)
|
||||
for location in ground_object.mark_locations:
|
||||
zone = self.mission.triggers.add_triggerzone(
|
||||
ground_object.position, radius=10, hidden=True, name="MARK"
|
||||
location, radius=10, hidden=True, name="MARK"
|
||||
)
|
||||
if cp.captured:
|
||||
name = ground_object.obj_name + " [ALLY]"
|
||||
else:
|
||||
name = ground_object.obj_name + " [ENEMY]"
|
||||
mark_trigger.add_action(MarkToAll(v, zone.id, String(name)))
|
||||
v = v + 1
|
||||
added.append(ground_object.obj_name)
|
||||
v += 1
|
||||
self.mission.triggerrules.triggers.append(mark_trigger)
|
||||
|
||||
def _generate_capture_triggers(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user