You are viewing a potentially older version of this package. View all versions.
DragonMotion-AutoCloseDoors-0.1.9 icon

AutoCloseDoors

Owner-safe automatic closing for Valheim doors and gates, with network deadlines, configurable radius/delay, dungeon behavior, and player-door sensor blocking.

Date uploaded 4 days ago
Version 0.1.9
Download link DragonMotion-AutoCloseDoors-0.1.9.zip
Downloads 316
Dependency string DragonMotion-AutoCloseDoors-0.1.9

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2333 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2333

README

AutoCloseDoors

Lightweight Valheim/BepInEx mod that closes opened doors and gates after a configurable delay, but only when no player is near the door. Autoclosing can be disabled for doors located inside dungeons/interiors and is disabled there by default.

Behavior

  • Stores each open door's close deadline in its networked ZDO and tracks only doors that are currently open.
  • Uses one central coroutine that sleeps until the next tracked door is due; there is no per-frame Update/tick patch.
  • Checks all players with Valheim's own Player.IsPlayerInRange.
  • Lets only the current ZDO owner evaluate and close a due door. The close-only RPC is idempotent and writes only the closed state, so a delayed request cannot toggle a newly reopened door.
  • Re-checks the replicated deadline, player radius, dungeon location, door state, and vanilla interaction state immediately before closing.
  • Respects Valheim's inverted door-state flag used by one-way showcases, secret bookcases, and other custom doors where network state 0 means visually open.
  • Keeps the original ZDO owner instead of claiming ownership, and uses the door's normal state refresh for animation and close effects.
  • Treats every door leaf independently, so nearby unrelated doors cannot inherit another door's deadline or player-radius result. Double doors naturally work as two networked leaves.
  • Skips doors located in dungeons/interiors by default, with a config toggle to enable them.
  • Skips keyed doors and doors that vanilla marks as unable to close.
  • Can block compatible monster-door sensor mods from opening player-built doors for monsters while leaving world-generated doors unchanged.

Config

Generated by BepInEx at:

BepInEx/config/obelisk.valheim.autoclosedoors.cfg

Options:

  • Enabled: enable/disable the mod.
  • Enable in dungeons: enable/disable automatic closing for doors located inside dungeons/interiors. Disabled by default.
  • Player radius: radius around each door leaf that keeps it open.
  • Close delay seconds: delay before closing, clamped by config range from 2 to 10.
  • Block monster door sensors: prevents compatible door sensor mods from opening player-built doors for monsters. Enabled by default.

Multiplayer

The close deadline and door state are stored in the door's ZDO. Every modded peer observes the replicated deadline, while only the current ZDO owner may reschedule or close the door. This keeps ownership changes safe and prevents multiple clients from toggling the same door. Install the same mod version and use the same scheduling config on the server and every client: the current ZDO owner evaluates the delay, radius, and door-state rules.

CHANGELOG

Changelog

0.1.9

  • Fixed inverted custom doors being reopened after they were manually closed.
  • Respected Door.m_invertedOpenClosedText when detecting open doors and choosing the idempotent owner-written closed state.
  • Added generic compatibility for Hunter Legacy showcases, Magic Supremacy secret bookcases, and other prefabs using Valheim's inverted door-state convention without hard mod dependencies.
  • Read player-built identity from the authoritative ZDO creator before the local Piece cache when protecting doors from compatible monster sensors.

0.1.8

  • Replaced ownership claiming and toggle-based autoclosing with an owner-only, idempotent close RPC that can only write the closed state.
  • Stored the close deadline in each door's ZDO so stale requests, ownership changes, reconnects, and already-open loaded doors are handled safely.
  • Replaced per-event coroutine restarts with one deduplicated central scheduler that sleeps until the next door is due.
  • Removed geometric linked-door grouping; each door leaf now owns its deadline and proximity check, so nearby unrelated doors cannot affect one another.
  • Evaluated dungeon/interior exclusion from each door's world position instead of the local player's location.
  • Added door registration and destruction cleanup for RPC handlers, schedules, buffers, and other static state.
  • Limited the monster-door-sensor compatibility block to player-built doors; world-generated doors keep the sensor's original behavior.
  • Preserved vanilla restrictions for keyed, non-closable, and mid-animation doors.
  • Added fail-closed handling for unavailable vanilla closability checks and normalized non-finite player-radius config values.

0.1.7

  • Re-track doors that are already open when they load back in after teleporting, so they can still auto-close after returning through a portal.

0.1.6

  • Fixed null-reference errors after teleport/world unload by dropping destroyed door references before checking or closing them.

0.1.5

  • Close doors through Valheim's normal UseDoor RPC so ownership, ZDO revision, animation, and close effects stay in sync after teleports or ownership changes.

0.1.4

  • Added a lightweight compatibility guard that blocks monster door sensors from opening player doors for monsters.

0.1.3

  • Updated Thunderstore package description and changelog for the dungeon/interior config.

0.1.2

  • Added Enable in dungeons config. Autoclosing is disabled inside dungeons/interiors by default.

0.1.1

  • Fixed Thunderstore/Gale package layout so files install directly into the package folder.

0.1.0

  • Initial release.
  • Added lightweight automatic closing for doors, double doors, and gates.
  • Added configurable player radius and close delay.