From 4b0215c16f9048e671b32f894d6b75d19e63a544 Mon Sep 17 00:00:00 2001 From: RndName Date: Wed, 23 Nov 2022 10:32:41 +0100 Subject: [PATCH] Remove dcs capture event from state json With the latest change we added capture zones and corresponding trigger rules for all Airfields as well so we do not need to rely on the dcs capture event S_EVENT_BASE_CAPTURED anymore. --- game/debriefing.py | 11 ++--------- resources/plugins/base/dcs_liberation.lua | 5 ----- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/game/debriefing.py b/game/debriefing.py index 57637faa..fb7b366f 100644 --- a/game/debriefing.py +++ b/game/debriefing.py @@ -338,9 +338,7 @@ class Debriefing: seen = set() captures = [] for capture in reversed(self.state_data.base_capture_events): - # The ID string in the JSON file will be an airport ID for airport captures - # but will be a UUID for all other types, since DCS doesn't know the UUIDs - # for the captured FOBs. + # The ID string in the JSON file will be the UUID generated from liberation cp_id, new_owner_id_str, _name = capture.split("||") # Only the most recent capture event matters. @@ -349,13 +347,8 @@ class Debriefing: seen.add(cp_id) try: - control_point = self.game.theater.find_control_point_by_airport_id( - int(cp_id) - ) - except ValueError: - # The CP ID could not be converted to an int, so it's a UUID. control_point = self.game.theater.find_control_point_by_id(UUID(cp_id)) - except KeyError: + except (KeyError, ValueError): # Captured base is not a part of the campaign. This happens when neutral # bases are near the conflict. Nothing to do. continue diff --git a/resources/plugins/base/dcs_liberation.lua b/resources/plugins/base/dcs_liberation.lua index 321a6cf1..c99903db 100644 --- a/resources/plugins/base/dcs_liberation.lua +++ b/resources/plugins/base/dcs_liberation.lua @@ -160,11 +160,6 @@ local function onEvent(event) write_state() end - if event.id == world.event.S_EVENT_BASE_CAPTURED and event.place then - base_capture_events[#base_capture_events + 1] = event.place.getID(event.place) .. "||" .. event.place.getCoalition(event.place) .. "||" .. event.place.getName(event.place) - write_state() - end - if event.id == world.event.S_EVENT_MISSION_END then mission_ended = true write_state()