Valheim
Install with App

Details

Latest version
1.0.0
Last Updated
First Uploaded
Downloads
18
Likes
0
Size
18KB
Dependants
ADDatHost Valheim hosting
30% off

Deathsquito Surfing Fix

Fixes a Valheim 1.0 bug that makes the game treat creatures as ice. Standing on a moving creature, such as a deathsquito, flings you off at high speed. With this fix, deathsquito surfing works again.

Despite the name, the fix isn't specific to deathsquitos: it applies to standing on any creature.

The bug

Valheim 1.0 added ice slipping. The game decides whether the ground is slippery like this, in Character.UpdateWalking and Character.ApplySlippery:

// what the game does
slipping = friction <= 0 && (s_slipperyStuffMask & layer) != 0;
// what it should do
slipping = friction <= 0 && (s_slipperyStuffMask & (1 << layer)) != 0;

It uses the layer number as if it were a bitmask. The Default layer is bit 0 of the mask, so every frictionless collider on an odd-numbered layer counts as ice. Creatures are on the character layer and use a frictionless physics material, so they count as ice.

While you're on ice, the game keeps your velocity from the previous frame for momentum, then adds the velocity of whatever you're standing on. On normal ground your velocity is rebuilt every frame, so that addition is harmless. On ice it stacks: every physics frame adds the creature's speed again. Slipping also skips the usual 20 m/s speed cap. In testing, a ride on a deathsquito went from matching its speed to 74 m/s in about 0.3 seconds.

What this mod does

It patches both checks to use 1 << layer, nothing else. Ice still works on the layers the game intends (static_solid and Default).

One side effect: the bug also stopped frictionless surfaces on the Default layer from being slippery, even though the game's mask includes that layer. With the fix, they slip as intended.

Installation

Install with r2modman or the Thunderstore Mod Manager, or copy DeathsquitoSurfingFix.dll into BepInEx/plugins.

The mod is client-side. Only players who want the fix need it, and the server doesn't. You can add or remove it at any time.

On startup, BepInEx/LogOutput.log should show:

Fixed slippery layer check in Character.UpdateWalking.
Fixed slippery layer check in Character.ApplySlippery.

If Iron Gate fixes the bug or changes this code, the mod logs a warning and does nothing.

Configuration

BepInEx/config/alari.valheim.deathsquitosurfingfix.cfg:

  • General.Enabled (default true): turns the fix on or off. Changes need a game restart.

Compatibility

Tested on Valheim 1.0.20 with BepInExPack_Valheim 5.4.2351. It only changes the two layer checks above, so it should work alongside other mods unless they replace Character.UpdateWalking or Character.ApplySlippery.

Source

git.peliarch.ca/alaric/deathsquito-surfing-fix

Changelog

  • 1.0.0: First release.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.