No description
Find a file
smthspec c1cd01f224 Replace EnScript config with JSON-based system
Move the registry, loot tables and scalar tunables out of hardcoded EnScript
into JSON loaded via DayZ's JsonFileLoader. Defaults are written to
<ProfileFolder>/YAInteraction/{settings.json,interactables.json} on first start
and read back (overriding code defaults) on subsequent starts.

- Add YAInteractionSettings (settings.json) and YAInteractionData
  (interactables.json) serializable classes with inline defaults
- Add YAInteractionConfigLoader singleton: MakeDirectory + FileExist driven
  load-or-save, plus client-safe in-code default fallback (EnsureDefaults)
- Load server-side via modded MissionServer.OnInit before players connect
- Gut YAInteractionConfig down to compile-time constants
- Rebuild manager lookups from loaded Data; update field names and float weights
- Remove redundant 5_Mission placeholder; update README

CF persistence and config hot-reload remain marked with // TODO (v2).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 21:45:56 +03:00
scripts Replace EnScript config with JSON-based system 2026-06-18 21:45:56 +03:00
config.cpp Initial commit: YAInteraction DayZ mod 2026-06-18 21:11:55 +03:00
mod.cpp Initial commit: YAInteraction DayZ mod 2026-06-18 21:11:55 +03:00
README.md Replace EnScript config with JSON-based system 2026-06-18 21:45:56 +03:00

YAInteraction

A DayZ server mod that adds interactable furniture (search for loot) and a two-stage repairable sink (repair, then gather water).

Features

  • Searchable furniture — medical cabinet, fridge, and vending machine yield random items from weighted, config-defined loot tables. Per-object cooldown.
  • Repairable sink — repair with a Wrench/PipeWrench, then gather water into a held/inventory container. Per-player cooldown, configurable amount.
  • JSON-configured — interactables, loot tables and scalar tunables live in JSON under <ProfileFolder>/YAInteraction/. Defaults are written on first start and read (overriding defaults) on every start after. No target/loot classnames exist anywhere else in the codebase.

Target objects (v1)

Classname Action Loot table
StaticObj_Furniture_case_sink_a Repair → Gather Water —
StaticObj_Furniture_lekarnicka Search MedTable
StaticObj_Furniture_fridge Search FoodTable
StaticObj_Furniture_vending_machine Search VendingTable

Configuration files

Generated on first start under <ProfileFolder>/YAInteraction/:

  • settings.json — scalar tunables: WaterAmountMin, WaterAmountMax, SinkPlayerCooldownSec, ObjectCooldownSec.
  • interactables.json — the Interactables registry and all LootTables.

Delete a file and restart to regenerate it from code defaults.

Structure

config.cpp / mod.cpp          mod + script-module registration, metadata
scripts/3_Game                shared game-layer placeholder (v2 hooks)
scripts/4_World/YAInteraction
  Config/YAInteractionSettings.c     serializable scalar settings (settings.json)
  Config/YAInteractionData.c         serializable registry + loot tables (interactables.json)
  Config/YAInteractionConfigLoader.c JSON load/save + code defaults (singleton)
  Config/YAInteractionConfig.c       compile-time constants only
  YALootTableManager.c               weighted pick + item spawning
  Entities/YAInteractionManager.c    registry lookup + repair state
  Actions/                           Search / RepairSink / GatherWater actions
  YAInteractionInit.c                modded BuildingBase action injection
scripts/5_Mission/YAInteraction
  YAInteractionMissionInit.c         modded MissionServer.OnInit -> load config

Notes

  • Config is loaded server-side at MissionServer.OnInit (before any player connects). Clients fall back to in-code defaults for action injection.
  • Cooldowns and sink repair state are tracked in memory and reset on server restart. CF persistence hooks are marked with // TODO (v2).
  • All item and tool classnames are verified against the base game data.

Adding a new interactable

Edit interactables.json (add to Interactables, and a LootTables entry if it searches), then restart. To change the built-in defaults, add one line to BuildDefaultData() in YAInteractionConfigLoader.c:

d.Interactables.Insert(MakeEntry("Your_Classname", YAInteractionConfig.ACTION_SEARCH, YAInteractionConfig.TABLE_FOOD, Settings.ObjectCooldownSec));