Commit graph

3 commits

Author SHA1 Message Date
smthspec
ff51bde976 Fix open action (register custom action), stop restart-stacking, numeric log level, config docs
Action (the real "no action" cause):
- DayZ does not auto-discover custom actions; ActionConstructor holds a
  hardcoded list and AddAction() silently drops anything missing from it.
  Added a modded ActionConstructor that registers YALB_ActionOpenLootbox, so
  the open action finally attaches to the box.
- Switched the action target condition CCTObject -> CCTCursor (the look-at
  pattern vanilla uses for world-object interactions).

Restart stacking:
- Spawn boxes with CreateObjectEx + ECE_NOPERSISTENCY_WORLD so they are never
  saved to the world DB and don't survive restarts.
- Added CleanupOrphanedBoxes(): on init, scan each spawn location and delete
  any leftover YALootBoxes_Base before spawning (clears boxes persisted before
  this change).

Logging:
- DebugLogLevel changed from a string to a numeric field (0=off 1=ERROR
  2=WARN 3=INFO 4=DEBUG 5=VERBOSE), clamped at load. Removed the string parser.
  NOTE: existing main_config.json has a string value and must be regenerated.

Config docs:
- Each generated JSON now includes a "_comment" array describing every field
  and its range (ignored by the loader). README + configfiles.readme updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 11:31:20 +03:00
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
smthspec
f64425a840 Phase 3: leveled logging + green cleanups
Logging:
- Replace EnableDebugLogging (bool) with DebugLogLevel (string) in
  YALB_MainConfig; default "INFO". Stored as a string for admin-friendliness,
  parsed once at load into YALB_ConfigLoader.LogLevel (int) for cheap compares.
- Add YALB_LogLevel enum NONE(0)<ERROR(1)<WARN(2)<INFO(3)<DEBUG(4)<VERBOSE(5),
  YALB_ParseLogLevel (case-insensitive, falls back to INFO), and leveled
  helpers Log_Error/Warn/Info/Debug/Verbose. ERROR also routes via ErrorEx().
- Reclassify every existing log call by content (missing critical config ->
  ERROR, recoverable -> WARN, milestones -> INFO, per-tick summary -> DEBUG,
  per-player/per-roll detail -> VERBOSE). Add a VERBOSE proximity-send log.
- Update main_config.json example and the default constructor to "INFO".
- Add README.md documenting levels, the config field, and the VERBOSE warning.

Green cleanups (from Phase 2):
- Remove dead OnActionInfoUpdate override (behaviour is inherited).
- Remove unused m_LocationInUse map (the live pool is m_FreeLocationNames).
- Null-guard player identity in the fail-effect log.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 21:57:31 +03:00