FOOTHOLD MISSION-TIME RESET (v5.3.5)
===================================

Adds an authorized F10 action to reload the SAME mission at its original
starting time, keeping Foothold's supported campaign/player saves, enabled
CTLD, FARPs and applicable warehouse state. Everyone undergoes a normal
reload; transient activity and live aircraft positions are not preserved.
No .miz/Foothold edits or Discourse changes. Player export is separate.

INSTALL
1. First use a separate v5.3.5 test mission/profile. With the server stopped,
   back up campaign, rank, CTLD, FARP and warehouse saves. Foothold's normal
   persistence, directories and mission io/lfs access must already work.

2. Edit allowedRestartNames at the top of foothold-mission-reset.lua:

       local allowedRestartNames = { "ExamplePilot", "AnotherAdmin" }

   Names must exactly match DCS display names (case-sensitive). The default
   list is empty. Names are changeable/spoofable: use on a trusted server.

3. Copy ONLY the Lua file into:
   Saved Games\<server profile>\Scripts\Hooks\
   Create Hooks if needed; install one copy. Restart the server process
   after installation or name changes. Do not add it to the mission.

4. Merge these API permissions into that profile's Config\autoexec.cfg:

       net.allow_unsafe_api = { "userhooks" }
       net.allow_dostring_in = { "mission" }

   Preserve other tools' entries. Do not add "scripting" for this hook.
   It uses mission's a_do_script; it does not change mission sanitization.
   DCS reference: <DCS installation>\API\Sim_ControlAPI.md.

USE
After startup (at least 30 simulation seconds), occupy an aircraft slot:
F10 -> Server Admin -> Reset mission time - keep campaign
    -> Confirm reset (60 seconds)

The server announces the countdown. Cancel pending reset is under Server
Admin and works while waiting for saves too. Only one reset can be pending.
F10 menus are group-wide: ALL human occupants must be allowlisted, including
multicrew and other aircraft in the group. Name/slot/group changes cancel
the request. Unresolvable occupied slots temporarily disable these menus.

The hook waits for native saves and reads back new save files before
reloading. Missing APIs, failed saves, mission changes or a 180-second save
timeout abort the reload. Aborting leaves native save jobs alone. Failed
writes can still damage saves: keep backups. Never use Foothold's separate
"Restart and reset" action here: it clears campaign progress.

CHECK / REMOVE
Automated Lua tests pass; a live DCS test is STILL REQUIRED. On the backed-up
test copy, verify the starting clock returns while zones, credits/ranks,
CTLD assets, FARPs and warehouse quantities survive. Also test unauthorized
multicrew, cancellation and failed saves. Recheck after Foothold/MOOSE/DCS
updates. Diagnostics: Logs\dcs.log in the profile; find FootholdMissionReset.

To remove, stop the server, delete the hook and restart. No save cleanup.
Remove only API permissions added solely for this hook.

Automated checks from the repository root:
  lua5.1 extras/tests/foothold-mission-reset-test.lua
Optional FOOTHOLD_SOURCE_DIR: directory with v5.3.5 zoneCommanderv2.lua,
moose.lua and ctld.lua, for upstream-saver compatibility tests.

Reference: https://github.com/leka1986/Lekas-Foothold/releases/tag/v5.3.5
Group-menu limitation: https://github.com/Special-K-s-Flightsim-Bots/DCSServerBot/blob/master/plugins/mission/README.md#custom-user-menus
