Settings Architecture
Settings are managed through a singletonSettings class that maintains two distinct states:
- Active settings: Currently applied settings used during runs
- Pending settings: Changes queued to apply on the next run
SettingsSnapshot Record
Settings use an immutable snapshot record for temporary editing and comparison:- Temporary editing in the GUI without affecting active settings
- Comparison to detect changes
- Atomic application of multiple setting changes
Configuration via GUI
Soul Link provides two settings GUIs accessed through commands:Chaos Settings (/chaos)
The Chaos GUI is a virtual double chest (54 slots) that allows players to configure:
- Difficulty: Easy, Normal, or Hard (cycles through options)
- Half Heart Mode: Players have only 1 health point
- Shared Potions: Potion effects shared between all players
- Shared Jumping: If one player jumps, all players jump
- Manhunt Mode: Runners share Soul Link, Hunters get tracking compasses
- Synced Inventory: All players share the same inventory
The Chaos GUI uses virtual slots that prevent item interactions. All clicks are handled server-side to toggle settings.
Info Settings (/settings)
The Info Settings GUI is a virtual single chest (27 slots) that provides:
- Combat Log: Toggle damage notifications in chat (applies immediately)
- Bug Report: Access to Discord for reporting issues
- Commands List: Display available commands
Unlike Chaos settings, the Combat Log toggle applies immediately without waiting for the next run.
Pending vs Active Settings
The settings system handles changes differently depending on whether a run is active:When No Run is Active
Changes apply immediately:When a Run is Active
Changes are deferred until the next run:When settings are confirmed during an active run, players see a yellow warning: ”⚠ Settings apply next run!”
Applying Pending Settings
Pending settings are automatically applied when a new run starts:Smart Change Detection
The GUI pre-fills with pending values if they exist, showing players what changes are already queued:- No-op confirmations: Re-confirming the same snapshot does nothing
- Revert to current: Setting values back to current active state clears pending changes
- Change tracking: Only broadcasts changes that actually differ from original values
GUI Implementation Details
Both GUIs use virtual inventories that:- Display items that cannot be taken, inserted, or moved
- Work in all game modes, including Spectator
- Use special synchronization for Spectator mode to avoid protocol errors
- Play sound effects for user feedback
The virtual GUI system uses custom
VirtualSlot classes that override canTakeItems() and canInsert() to return false, preventing all item interactions while still allowing visual feedback.