YALootBoxes/scripts/5_Mission/YALootBoxes_MissionServer.c
smthspec d28cebd5d6 Restructure: self-starting bootstrap + auto-provision all config files
Structure / module placement:
- Add scripts/5_Mission/YALootBoxes_MissionServer.c: a modded MissionServer
  that self-starts the manager in OnInit(). No init.c edit required anymore.
- config.cpp: bind 5_Mission to missionScriptModule (4_World stays on
  worldScriptModule). Core logic correctly stays in 4_World; only the
  mission-lifecycle bootstrap lives in 5_Mission.

Config create/read/write:
- LoadAll now writes populated defaults for ALL four JSON files when missing
  (previously only main_config.json was generated; box_types/loot_lists/
  spawn_locations were left empty, so a fresh install spawned nothing).
- Add default-data factories (YALB_MkReq/MkFail/MkLoot/MkLoc/MkBoxType) and
  DefaultBoxTypes/DefaultLootLists/DefaultSpawnLocations builders mirroring
  configfiles.readme. The mod is now self-provisioning on first run.

Docs:
- Prefix.cpp: refreshed folder-layout summary; dropped stale init.c /
  simulationModule notes.
- Manager.c: bootstrap comment now points to the 5_Mission self-start.
- README.md: add Install & first-run section.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 23:44:43 +03:00

23 lines
763 B
C

// ============================================================
// YALootBoxes_MissionServer.c
// Self-starts the lootbox manager on the server - no init.c edit
// required. Lives in: scripts/5_Mission/
//
// MissionServer exists/instantiates on the dedicated server only,
// so this whole bootstrap is inherently server-side. It augments
// whatever mission the map ships (via 'modded') instead of
// replacing it, so it coexists with other mission mods.
// ============================================================
modded class MissionServer
{
ref YALootBoxesManager m_YALootBoxes_Manager;
override void OnInit()
{
super.OnInit();
m_YALootBoxes_Manager = new YALootBoxesManager();
m_YALootBoxes_Manager.Init();
}
}