DungeonEnvironmentGuard
Prevents pathological Crypt/SunkenCrypt forced-environment ping-pong without disabling dungeon or LocationReset functionality.Dungeon Environment Guard
Small Valheim/BepInEx compatibility guard for a pathological dungeon environment loop observed with regenerated sky dungeons.
What it fixes
In the affected world, Valheim can repeatedly alternate between:
CryptSunkenCrypt
many times per second. This creates huge log spam and can contribute to gameplay hitches.
The guard watches EnvMan.SetForceEnvironment(string) and does nothing during normal gameplay. It activates only after detecting the rapid alternating pattern A -> B -> A inside the configured conflict window.
When active it prefers SunkenCrypt and suppresses redundant/conflicting requests until either:
- Valheim clears the forced environment,
- another environment is requested, or
SunkenCryptrequests stop for the configured release delay, allowing a legitimate transition toCrypt.
Configuration
Created after first launch in the normal BepInEx config directory.
Enabled = trueConflictWindowMs = 250ReleaseDelayMs = 750DiagnosticLogging = true
Scope
This mod does not modify LocationReset, dungeon generation, ZDOs, networking, or save data. It only guards the forced-environment setter.
Built for the Valheim 1.0.15 / BepInEx 5.4.2350 environment used by the target modpack. The patch resolves the target method by name and exact string parameter at runtime and fails open if its own logic errors.
