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>
38 lines
No EOL
1.8 KiB
C++
38 lines
No EOL
1.8 KiB
C++
|
|
// ============================================================
|
|
// FILE: Prefix.cpp
|
|
// Place at mod root: YALootBoxes/Prefix.cpp
|
|
// (Tells the engine the include-prefix for this mod's paths)
|
|
// ============================================================
|
|
// Prefix.cpp content:
|
|
//
|
|
// YALootBoxes
|
|
|
|
|
|
// ============================================================
|
|
// FOLDER LAYOUT SUMMARY
|
|
// ============================================================
|
|
// YALootBoxes/
|
|
// ├── config.cpp (CfgPatches/CfgMods module bindings + CfgVehicles)
|
|
// ├── Prefix.cpp
|
|
// ├── configfiles.readme (reference copies of the four default JSONs)
|
|
// ├── README.md
|
|
// ├── tools/ (Collect-YALootBoxesLogs.ps1 debug helper)
|
|
// └── scripts/
|
|
// ├── 4_World/ (-> worldScriptModule)
|
|
// │ ├── YALootBoxes_Config.c (data classes, loader, logging, defaults)
|
|
// │ ├── YALootBoxes_Lootbox.c (YALootBoxes_Base entity)
|
|
// │ ├── YALootBoxes_ActionOpen.c(hold-to-open action + fail effects)
|
|
// │ └── YALootBoxes_Manager.c (spawn/despawn lifecycle + proximity msgs)
|
|
// └── 5_Mission/ (-> missionScriptModule)
|
|
// └── YALootBoxes_MissionServer.c (modded MissionServer; self-starts manager)
|
|
//
|
|
// The manager self-starts via the 5_Mission modded MissionServer -
|
|
// NO init.c edit is required.
|
|
//
|
|
// CLASS BINDING: the CfgVehicles crate classes inherit from a shared
|
|
// "YALootBoxes_Base" config class whose name matches the YALootBoxes_Base
|
|
// script class; the engine resolves the script type by walking that config
|
|
// inheritance chain. (The old simulationModule approach did not bind script
|
|
// classes and has been removed.)
|
|
// ============================================================
|