Valheim
Install with App

Details

Latest version
1.0.0
Last Updated
First Uploaded
Downloads
122
Likes
1
Size
151KB
Dependants
ADDatHost Valheim hosting
30% off

AutoCloseDoors

Doors you open close themselves a few seconds later. Every kind of door: wooden doors, gates, drawbridges, dvergr doors, the hexagonal and flametal gates, doors from other mods. Each kind can be switched off or given a delay of its own, in the config file or in game through the ModSettings mod.

How it works

Open a door and walk through. Three seconds later (the default) it closes behind you. Close it yourself before that and nothing more happens: the mod never opens a door, it only closes one that is still open when its time is up. Closing a door that was already open does not start a timer either.

Doors the game itself never closes again are left alone: the sunken crypt gate and any other door that takes a key, and the one-way dungeon doors. The game refuses to close those, so the mod does not try.

Which doors. The mod works on the game's Door component, which every door, gate, hatch and drawbridge in the game is built on, so it does not need a list of doors. When a world loads, every door prefab the game knows gets a section of its own in the config, named after the prefab (wood_door, piece_drawbridge, ...). A door from another mod that was missed gets its section the first time you open it.

Settings in game. With the ModSettings mod installed (a separate mod by the same author), the gear button beside Skills in the inventory screen lists this mod. Open it for a General section and one section per door, named by the prefab, with the door's name in each entry's description. Click On/Off to switch a door's auto-close, use the minus and plus buttons or type a number for a delay. Every change is written to the config file at once and applies to the next door you open.

Installation

With a mod manager (Thunderstore Mod Manager, r2modman, Gale): install it from the mod list, or click Install with App on this page. BepInExPack is installed alongside it. Install ModSettings too if you want to change the settings in game; it is optional.

By hand: install BepInExPack_Valheim first. Then unzip this package and put AutoCloseDoors.dll in Valheim\BepInEx\plugins\AutoCloseDoors\.

Configuration

BepInEx\config\rhenn.autoclosedoors.cfg, created on the first start. The door sections appear after the first world is loaded.

Key Default Meaning
General.Enabled true Master switch. false and no door closes itself.
General.CloseDelay 3 Seconds after you open a door before it closes itself (0.5 to 60).
<prefab>.Enabled true Close this kind of door automatically.
<prefab>.CloseDelay 0 Seconds before this kind of door closes (0 to 60). 0 means use General.CloseDelay.

The buildable vanilla doors and their sections:

Section Door
wood_door Wood door
wood_gate Wood gate
wood_fence_gate Wood fence gate
darkwood_gate Darkwood gate
iron_grate Iron gate
stave_gate Stave gate
piece_dvergr_wood_door Dvergr wood door
piece_drawbridge Drawbridge
piece_drawbridge_log Log drawbridge
piece_hexagonal_door Hexagonal gate
flametal_gate Flametal gate
ashwood_door Ashwood door
piece_cloth_hanging_door, _blue, _blue2 Cloth hanging doors

Doors found in the world (dungeon doors, dvergr town doors) get sections named by their prefab too.

[General]
Enabled = true
CloseDelay = 3

[wood_door]
Enabled = true
CloseDelay = 0

[wood_gate]
Enabled = true
CloseDelay = 8

Multiplayer

Client-side only. Only the player who wants doors to close behind them needs the mod. The server needs nothing, and other players need nothing: the close is the same "use door" message the game sends when you press the Use key, handled by whoever runs that door (normally you, as the nearest player), and everyone sees the door close as usual. Doors other players open are not touched, and neither are doors that were already open when you arrived.

When another player stands closer to the door than you and so runs it, the close takes one network round trip, during which that player closing the same door by hand could in theory leave it open again. In practice this does not happen with a delay of a few seconds.

Compatibility

No known conflicts. The mod sends the game's own door message and changes nothing about how doors work. Doors from other mods are handled like the game's, each with its own config section. Another mod that also closes doors on a timer would race this one; run one or the other.

Known limits:

  • Key doors and one-way dungeon doors are not closed: the game does not allow it.
  • A door closing on you pushes you out of the way, as a door closed by another player does.
  • A door that unloads before its time is up (you ran far away, or logged out) stays open.
  • In single player the timer stands still while the game is paused, like everything else in the world.

Something not working?

  • No door closes. The mod did not load, or General.Enabled is off. Open BepInEx\LogOutput.log in the same profile and search for AutoCloseDoors. If the name is not there, the mod is not installed in that profile.
  • One kind of door never closes. Its section's Enabled is off, or it is a key door or a one-way dungeon door, which the game never closes again. Check the section named after the door's prefab.
  • A door closed later or sooner than expected. That kind of door has its own CloseDelay; 0 means the General delay.
  • You want to see what the mod decided. Add Debug to LogLevels in BepInEx\config\BepInEx.cfg: the log then has one line per door opened, such as wood_door at (x, y, z): armed, closes in 3 s and closed (owner: True), or why it was skipped.

Bugs and feedback

Found a bug? Email a screenshot and the steps to reproduce it to [email protected], with the mod version and your BepInEx\LogOutput.log attached. I check that inbox once a week.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.