DungeonEnvironmentGuard

v0.1.0·Updated 2026-09-21

Prevents pathological Crypt/SunkenCrypt forced-environment ping-pong without disabling dungeon or LocationReset functionality.

About this mod Author’s original text

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:

  • Crypt
  • SunkenCrypt

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
  • SunkenCrypt requests stop for the configured release delay, allowing a legitimate transition to Crypt.

Configuration

Created after first launch in the normal BepInEx config directory.

  • Enabled = true
  • ConflictWindowMs = 250
  • ReleaseDelayMs = 750
  • DiagnosticLogging = 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.

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file. In multiplayer, the host and every client need the same mods installed.

Dependencies

Install these first, or the mod will not work:

denikson-BepInExPack_Valheim

File & checksum

Filename
DungeonEnvironmentGuard-0.1.0.zip
File size
20.0 KiB