YAInteraction/README.md
smthspec ac90535b5e Initial commit: YAInteraction DayZ mod
Searchable furniture (med cabinet, fridge, vending machine) with weighted,
config-driven loot tables, and a two-stage repairable sink (repair then gather
water). Data-driven registry, in-memory cooldowns/repair state with v2 CF hooks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 21:11:55 +03:00

51 lines
2 KiB
Markdown

# 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.
- **Data-driven** — every interactable is one line in
[`YAInteractionConfig`](scripts/4_World/YAInteraction/Config/YAInteractionConfig.c).
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 |
## Structure
```
config.cpp / mod.cpp mod + script-module registration, metadata
scripts/3_Game shared game-layer placeholder (v2 hooks)
scripts/4_World/YAInteraction
Config/YAInteractionConfig.c single source of truth (registry + loot tables)
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 mission-layer placeholder (v2 hooks)
```
## Notes
- 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
Add one line to `GetInteractables()` in `YAInteractionConfig.c`:
```c
m_Interactables.Insert(new YAInteractableEntry("Your_Classname", ACTION_SEARCH, TABLE_FOOD, 7200));
```