
Dive In
Diving underwater with configurable controls, Fast Swim, surface/midwater stamina regen, and depth drain. Configured creatures can chase and navigate underwater. Includes water combat/equipment, localized key hints, and improved underwater visuals.DiveIn
DiveIn adds configurable diving and swimming for players and configured creatures in Valheim.
Normally, creatures cannot follow a diving player far below the surface. DiveIn lets configured creatures chase, patrol, and attack underwater while adding player depth controls, resource tuning, water combat, key hints, and underwater visuals.


Player diving
- Ascend and descend with configurable keyboard shortcuts or the corresponding gamepad controls.
- Surface and midwater stamina regeneration are configured separately.
- Idle underwater stamina drain and moving swim drain can scale with liquid depth.
- Fast Swim supports press or toggle input, with separate speed and stamina multipliers.
- A client-side swimming HUD below the stamina bar uses the stamina number's font and size.
Swim HUD ModeselectsFull(ascent/descent bindings, then Fast Swim On/Off below),FastSwimOnly(status only), orOff(regular key hints, when enabled in the game). On describes the selected mode, not movement at that instant; empty stamina changes the status color without adding text. The HUD stays visible when the full stamina bar fades and works independently of vanilla Key Hints. Only the key-hint rows currently covered by the HUD are suppressed. Full keeps ascent/descent controls even when Fast Swim is unavailable. - Swim skill and encumbrance have independent speed multipliers.
- Surface swimming retains the vanilla swim depth; DiveIn changes depth only while diving.
- Attacking, secondary attacking, and guarding temporarily take priority over swim movement.
- Player-owned underwater projectiles can use synchronized lifetime, speed, and damage multipliers on the initial launch. Child projectiles spawned by
Projectile.SpawnOnHitkeep the parent spawn logic's values without another DiveIn multiplier, so inherited damage and speed are not repeatedly reduced down the chain. - Equipment is usable while swimming by default. The active equipment list determines which items get an exception to the swimming restriction. Restricted armor and accessories do not hide unrelated hand equipment, but vanilla may stow both hands when one hand item is restricted.
- With supported modern Path of Valheiman installed, its live
Combat in the Depths(WaterMelee) node unlocks DiveIn's water equipment/combat. After unlocking, DiveIn's selected list controls permitted items, including tools, lone shields and ranged equipment; PoV's melee-only water restrictions no longer apply. Refunding the node removes the exception without restarting. Other game/mod requirements still apply. Diving, Fast Swim, the HUD, resource tuning and projectile penalties do not require this node. - Swimming key hints use the active keyboard or gamepad bindings and supported Valheim languages.
- Vanilla water color interpolation is initialized correctly across zone borders, above and below the surface. This client-side fix targets the vanilla water shader only; it does not retint the coast or change water depth, waves, buoyancy or swimming physics.
PoV integration supports the modern chained swimming gates and the complete modern water-combat patch set, verified with PoV 6.0.11. Legacy overloads and the old melee-partner restoration fallback are no longer supported. Compatibility uses signatures, activation guards, patch ownership/registration and effective IL, not a version/MVID allowlist. While active, DiveIn substitutes its two equipment gates and suppresses only PoV's three water-combat effects for the local swimming player. PoV's node predicate and all unrelated patches remain intact. Unknown/partial contracts disable the takeover with a warning; PoV's own behavior remains available and DiveIn cleans up its override hooks. After a failure, restart to retry; live DLL replacement is unsupported.
Manual, block-triggered and attack-triggered hidden-hand restoration require the node and an allowed complete hidden pair. A lone permitted shield or tool needs no melee partner. Permission checks do not remove, clone or clear inventory items. Contract metadata is rechecked at action boundaries and periodically; IL is checked only at initialization or after a changed Harmony patch set/order. Without PoV, normal DiveIn behavior is unchanged.
Creature diving
- Configured creature prefabs stop avoiding water and can navigate underwater.
- Passive creatures patrol within per-group minimum, center, and maximum depths.
- Alerted creatures follow targets within their active depth limits.
- Optional spawn-depth preservation prevents underwater spawns from first floating to the surface.
- Optional shallow-water flee behavior makes a creature retreat until it clears the configured depth buffer.
- Per-group avoidance steering can be disabled for prefabs that jitter with angled obstacle sampling.
- Serpent movement retains the vanilla stopping distance and swoop movement while using DiveIn depth navigation.
DiveIn.yaml
The server/source-of-truth instance creates BepInEx/config/DiveIn.yaml when it is missing. Clients use the synchronized server value while connected.
# Unknown or duplicate keys are errors and keep the previous applied settings.
surface_patrol:
passive_min_depth: 0
passive_center_depth: 10
passive_max_depth: 20
active_min_depth: 0.25
active_depth_adjust_speed: 2
shallow_water_flee_depth: 0
preserve_spawn_depth: false
avoidance_steering: true
prefabs:
- Leech
- Abomination
- Serpent
- BonemawSerpent
# Disable angled avoidance only for prefabs that need it.
mods_surface_nosteering:
passive_min_depth: 0
passive_center_depth: 10
passive_max_depth: 20
active_min_depth: 0.25
active_depth_adjust_speed: 2
shallow_water_flee_depth: 0
preserve_spawn_depth: false
avoidance_steering: false
prefabs:
- SA_WhiteShark
Rules:
- A prefab may be assigned only once; the first assignment wins.
- Missing optional fields use DiveIn defaults.
- Negative and out-of-range depths are normalized and logged.
NaN, infinity, malformed YAML, unknown keys, and duplicate keys are rejected without replacing the last valid configuration.- A local YAML change is ignored while remote synchronized values are active.
BepInEx configuration
DiveIn creates BepInEx/config/sighsorry.DiveIn.cfg. That generated file is the source of truth for the complete setting list, descriptions, defaults, ranges, and synchronization markers. The README intentionally does not duplicate the generated configuration block, so code and documentation cannot drift independently.
Under 2 - Player Diving, Water Equipment Mode selects one of two server-synced lists:
Blacklist(default): items inWater Equipment Blacklistkeep their swimming restriction. An empty list excludes nothing. Existing blacklist settings continue to work unchanged.Whitelist: only items inWater Equipment Whitelistqualify for an exception. EnterHammer, Hoeto permit just those tools, or leave the list empty to grant no exceptions.
The mode and both lists are synchronized with the server. Each list accepts comma-separated item prefab names and defaults to empty. Changing modes keeps the inactive list's contents for later; only the selected list affects equipment.
The configuration is grouped into:
- General server locking
- Player controls and water equipment
- Surface and midwater stamina/eitr regeneration
- Idle, depth, base, and Fast Swim stamina drain
- Swim skill, Fast Swim, and encumbered swim speed
- Underwater projectile lifetime, speed, and damage
- Underwater darkness and murkiness
The ascend key, descend key, Fast Swim input mode, and Swim HUD Mode (default Full) are client-side. HUD mode changes take effect immediately and do not change swimming behavior. At startup, the retired Show Fast Swim HUD setting is migrated from On to Full or Off to Off only if the new key is absent; an existing Swim HUD Mode takes precedence. Settings marked [Synced with Server] are controlled by the server when configuration locking is enabled.
Credits
The player diving implementation includes code derived and modified from UnderTheSea.
Original DiveIn repository: sighsorry1029/DiveIn