Longhouse

Svimma

Swimming stops putting your weapon away. Swords, pickaxes and fishing rods stay in hand in deep water, at a higher stamina price per swing.

  1. Why
  2. What it does
  3. Installing
  4. Settings
  5. Multiplayer
  6. What has not been checked
  7. Bugs and ideas
  8. Licence

Swimming stops putting your weapon away. A sword, a pickaxe or a fishing rod stays in your hand in deep water, you can take one out there, and a swing costs a bit more because the water does not give your stamina back.

Svimma is Old Norse for to swim.

Why

This is deliberately narrower than "use anything anywhere", and that is the design, not a first draft of it.

Vanilla treats the water as a place where you cannot hold anything. Every frame you are swimming with no ground under you, the game puts your hand items away, and it refuses to equip one while you are in that state. Nothing else stops you swinging: the attack code never asks whether you are swimming, which is why you can already punch in the water. So the whole block is two checks, plus a third on the hide key that stops you drawing again. Svimma lifts those three for the hand items you have allowed, and changes nothing else.

The obvious alternative was to make swimming transparent to combat: every tool, every weapon, no cost. It was rejected for three reasons, each of which is a setting.

  • Ranged weapons and magic stay put away. A bow or a staff from the water lets you fight anything on the shore with no cost for being out of reach, which is a far bigger change than swinging a sword at something that has come to the water. Bows, crossbows and staffs are three separate switches, all off.
  • Building tools stay put away. The hammer, the hoe and the cultivator place pieces and reshape ground from where you could not have stood to do it. One switch, off.
  • A swing costs 1.5 times as much stamina. Stamina does not come back while you swim, so a swing in the water is paid for out of a bar that stays spent until you leave. Wading is not swimming: standing on the bottom, even up to the neck, costs the ordinary price. The multiplier is a setting, from 1 (free) to 5.

Blocking is off in deep water as well, because you cannot plant your feet in it. A shield in your other hand is carried and does not block until you switch that on.

What it does

  • Melee weapons, pickaxes and fishing rods stay in hand while you swim, and equip while you swim. Swords, knives, clubs, spears, polearms and axes count as melee. Each of melee, pickaxes and fishing is its own switch, on by default.
  • Torches are still put away. A flame in the water is not something this changes, and there is no switch for it.
  • Armour, food and everything that is not a hand item are still refused in the water. Only hand items are in scope.
  • The hide key works again in deep water, so a weapon you put away can be drawn without swimming back to shore.
  • A deep swing costs more. The raised price is also the price you must be able to pay: a swing you cannot afford is refused, as on land, and an empty bar while swimming is drowning.
  • Nothing is registered, spawned, saved or written to a world.

Installing

Needs BepInEx. Nothing else. Through a mod manager it is one install. By hand, put Svimma.dll in BepInEx/plugins/Svimma/.

Then start the game once and quit. That first run writes the config file. It does not exist before the mod has loaded, which is the usual reason people think it is broken.

Settings

The file is BepInEx/config/ezomic.valheim.svimma.cfg. Open it in any text editor. Every setting has a comment above it, so the file explains itself. They are the host's rules on a server (see below) except Verbose, which is yours.

Note that changing a default in a new version does nothing on a machine that has already run the mod. BepInEx writes every entry on first run and the saved value wins.

Multiplayer

The host needs it. Clients without it are let in and are unaffected. They simply cannot swing in deep water, and what a player with it does is seen through the equipment and animation every client already shows.

The reason it is not "everyone": Svimma registers no prefab, changes no item data and writes nothing of its own, so a client without it cannot fail to resolve anything. The host's settings apply to everyone connected to it, in memory only, and your own config file is never written to and comes back the moment you disconnect. Without Core the mod still runs; what is lost is the host being able to impose its rules.

What has not been checked

Built, not yet run in game, and never on a server with other players. Two things only the running game can answer: whether the swing animation plays sensibly while you are swimming, and whether a blow reaches something in or under the surface. The attack code puts no condition on either, but the animator has its own swim state and its transitions are not in the code. A Devkit scenario covers the equip, the hand items staying out and the price (scenarios/svimma-deep-water-keeps-the-weapon.txt), and lists the checks that need a person.

Bugs and ideas

Both go to the site. longhouse.thijssensoftware.nl/bugs is for anything broken, and longhouse.thijssensoftware.nl/ideas is for what a mod should do next. You can vote on other people's ideas there as well.

Signing in takes a Steam or Discord account. I work from that list, so the votes decide what I pick up next.

Licence

MIT. See LICENSE.

Changelog

1.0.0 in Longhouse

First release, a member of Longhouse 2.4.0. Swimming with no ground under you no longer puts your hand items away, and you can equip them there. Melee weapons, pickaxes and fishing rods are allowed, bows, crossbows, staffs and building tools are not, and each of those is a switch in the config.

Vanilla blocked this in three places, all of them one call to IsSwimming inside a longer condition: Humanoid.UpdateEquipment hid your hands every frame, Humanoid.EquipItem refused to equip anything, and the hide key in Player.Update would not draw your items again while you swam. Nothing else stops an attack in the water, so those three are the whole change. Torches are still put away, and so is everything that is not a hand item.

A swing in deep water costs 1.5 times the stamina, set by DeepSwingStaminaMultiplier, because stamina does not regenerate while you swim. Blocking is off in deep water unless AllowBlocking is on. Wading, standing on the bottom with the water at your chest, is not deep water and is untouched.

Built and compiled, not yet run in game, alone or on a server. Whether the swing animation looks right while swimming and whether a blow reaches something in or under the water are only answerable there. A Devkit scenario (scenarios/svimma-deep-water-keeps-the-weapon.txt) checks the equip, the hand items staying out and the price, and lists the manual checks.

Every setting · 11

All of it lives in one file, written on first run with each description beside its default. The file is the source of truth; edit it there.

BepInEx/config/ezomic.valheim.svimma.cfg

server On a server, the host's value applies to everyone while they are connected; your own file is left alone and counts again when you leave. yours Keys and personal settings stay as you set them, on any server.

Cost 1
SettingWhat it doesDefaultWhose
DeepSwingStaminaMultiplier - 1.5 server
Svimma 2
SettingWhat it doesDefaultWhose
Enabled Off leaves the plugin loaded and changing nothing: swimming puts your hands away exactly as vanilla does. true server
Verbose Write each decision to BepInEx/LogOutput.log: what was allowed to stay in hand in deep water and what a swing cost. Off unless something looks wrong. false yours
What may be used 8
SettingWhat it doesDefaultWhose
AllowMelee Swords, knives, clubs, spears, polearms, axes and anything else swung or thrust that is not claimed by one of the switches below. Shields stay in hand with whatever else is allowed. Torches never do: a flame is put out the way vanilla puts it away, and there is no switch for that. true server
AllowPickaxes Pickaxes, for deposits you can reach from the water but not stand beside. true server
AllowFishing The fishing rod. Fishing from the water is the case the ticket was written around: the rod is a tool, not a weapon, and there is nothing in it that wants a dry foot. true server
AllowBows Bows. Off by default: a bow in deep water lets you fight anything on shore with no cost for being out of reach, which is a bigger change than swinging a sword. false server
AllowCrossbows Crossbows. Off for the same reason as bows, and separately because a crossbow's reload is a second action in a state that is already draining stamina. false server
AllowStaffs Staffs (elemental and blood magic). Off by default: they spend eitr, not stamina, so the swim cost below does not touch them, and that would make them free to use in a place everything else is made to pay. false server
AllowBuildingTools The hammer, the hoe and the cultivator. Off by default: building on water you are swimming in puts pieces and terrain changes where you could not have stood to make them. Turn it on only if that is what you want. false server
AllowBlocking Off: blocking is switched off while you swim in deep water, so a shield in hand is carried and does not block. On: blocking works as on land. Off by default because you cannot plant your feet in the water, and a block that cannot cost you footing is a block that costs nothing. false server

Discussion

Nothing said yet.

Sign in or make an account to join in.