Allow player to continue playing after the end of a turn. (#3526)

This PR:

Keeps track of time spent in mission 

Introduces a new "turnless mode" setting, which activates the following:
- At the end of a mission, fast forwards through the time spent in the
mission, skipping any combat (which has already been tracked through
state.json)
- Removes killed flights from the ATO
- Does not start a new turn, instead allows the player to continue the
current turn.
This commit is contained in:
zhexu14
2025-10-16 23:51:27 +11:00
committed by GitHub
parent 5676c40788
commit d09a15a7f3
10 changed files with 136 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ local WRITESTATE_SCHEDULE_IN_SECONDS = 60
logger = mist.Logger:new("DCSLiberation", "info")
logger:info("Check that json.lua is loaded : json = "..tostring(json))
simulation_time_seconds = 0
crash_events = {} -- killed aircraft will be added via S_EVENT_CRASH event
dead_events = {} -- killed units will be added via S_EVENT_DEAD event
unit_lost_events = {} -- killed units will be added via S_EVENT_UNIT_LOST
@@ -43,6 +44,7 @@ function write_state()
["destroyed_objects_positions"] = destroyed_objects_positions,
["killed_ground_units"] = killed_ground_units,
["unit_hit_point_updates"] = unit_hit_point_updates,
["simulation_time_seconds"] = simulation_time_seconds
}
if not json then
local message = string.format("Unable to save DCS Liberation state to %s, JSON library is not loaded !", _debriefing_file_location)
@@ -160,6 +162,9 @@ end
activeWeapons = {}
local function onEvent(event)
simulation_time_seconds = event.time
if event.id == world.event.S_EVENT_CRASH and event.initiator then
crash_events[#crash_events + 1] = event.initiator.getName(event.initiator)
write_state()