Skip to content

Snapshots

Save and restore inventory and equipment state using a JSON-based API.


Purpose

Provide a simple persistence mechanism for capturing and restoring runtime inventory state.


What Lives Here

  • InventorySnapshots → capture, save, load, and apply inventory state

Important Notes

  • Snapshots operate on runtime containers, not authoring data
  • They do not enforce authority or networking behaviour
  • On apply, the inventory container is grown to fit the saved layout (it is never shrunk)

Usage Guidance

Capture

Captures current inventory (and optionally equipment) state as JSON.


Save / Load

Provides helpers to persist JSON to disk and retrieve it later.


Apply

Applies snapshot data to live containers.

  • inventory is cleared and repopulated
  • equipment is cleared and repopulated when provided
  • requires an item database for GUID resolution

Behaviour notes

  • the inventory container grows if the snapshot has more slots, so saved items are not dropped
  • a container already larger than the snapshot keeps its size; trailing slots stay empty
  • equipment slots contain a single item
  • container events may be coalesced during apply

Missing items

Handling is controlled via snapshot options.

  • unknown items may be skipped
  • or replaced with a placeholder when configured

Container size

On apply, the inventory container grows to fit the saved layout so no items beyond the current capacity are dropped. It is never shrunk, so a deliberately larger container keeps its size. Equipment is restored by slot id and its layout is not resized.


Not for Production Use

A local save mechanism, not a replication system

This folder does not:

  • Provide authoritative state synchronization
  • Handle multiplayer replication
  • Perform validation logic
  • Guarantee compatibility across snapshot versions