Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
KeepFoodOnDeath
Keep your eaten food and its effects after death, and revive at full health. Server-synced config. Requires the mod on server and clients.
By SnethsMods
| Last updated | 10 hours ago |
| Total downloads | 42 |
| Total rating | 0 |
| Categories | Mods Utility AI Generated Client-side |
| Dependency string | SnethsMods-KeepFoodOnDeath-1.2.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
denikson-BepInExPack_Valheim
BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.
Preferred version: 5.4.2202ValheimModding-Jotunn
Jötunn (/ˈjɔːtʊn/, 'giant'), the Valheim Library was created with the goal of making the lives of mod developers easier. It enables you to create mods for Valheim using an abstracted API so you can focus on the actual content creation.
Preferred version: 2.24.3README
KeepFoodOnDeath
Die without losing your meal. When you die, this mod keeps the food you had eaten and the effects that came with it, then brings you back at full health.
Status: this mod has not been compiled or tested in-game yet. Build it, test a death on a throwaway character first, and report any problems.
Features
- Keeps your eaten food after death, with its remaining time.
- Keeps status effects you had when you died (food effects, Rested, etc.), with their remaining time.
- Excludes potions and meads by default. They are lost on death as in vanilla.
- Full health on revival, calculated after the food bonus is applied.
- Optional time penalty so death still costs something.
- Server-controlled settings. All options are admin-only and synced from the server.
What is not changed
- Tombstone, dropped items and skill loss work as in vanilla.
- The soft-death debuff is not restored (it is in the default exclusion list).
- Effects with no duration, such as gear and set bonuses, are never restored. Your gear is on your tombstone, so they would be wrong.
- Harmful and environmental effects (Burning, Poison, Frost, Wet, Cold, etc.) are not restored by default.
Installation
Install on the server and on every player's game:
- BepInExPack Valheim
- Jotunn
KeepFoodOnDeath.dllintoBepInEx/plugins/
Players without the mod, or with a different version, are refused at login. This is intentional, so everyone follows the same rules.
Why the client needs it too
Valheim does not run a player's food and status effects on the server. They live in each player's own game, and death is handled there. The saving and restoring therefore has to run on each client. The server's job is to supply the config and enforce matching versions.
Configuration
Run the server once to generate BepInEx/config/com.example.keepfoodondeath.cfg. Edit it on the server and restart. Clients receive the server's values.
| Setting | Default | Description |
|---|---|---|
Enabled |
true |
Master switch. |
KeepFoodEffects |
true |
Restore the effect attached to each food you had eaten. |
KeepAllStatusEffects |
true |
Restore all timed status effects you had, except those excluded below. |
ExcludePotionsAndMeads |
true |
Never restore effects from potions and meads. Detected from the game's item database, so modded meads are covered. |
ExcludedEffects |
see file | Comma-separated effect names that are never restored. |
HealToFullHealth |
true |
Set health to full on revival, including the food bonus. |
RemainingTimePenaltyPercent |
0 |
Percent of remaining food and effect time lost on death. 50 loses half. |
ShowMessage |
true |
Show a message when you are restored. |
How it works
- On death, just before the game clears your food, the mod records your eaten food and your timed status effects with their remaining time. The time penalty is applied here.
- On respawn, once your new character exists, it puts the food back, re-applies the effects with the remaining time, recalculates max health, stamina and eitr, and sets health to full.
- The saved data is held in memory only. It is discarded if you switch characters or do not respawn within 15 minutes. Logging out or crashing while dead loses the food.
Building from source
Requires the .NET SDK, plus Valheim with BepInEx and Jotunn installed.
- Set the
VALHEIM_INSTALLenvironment variable to your Valheim folder. - If Jotunn is in a subfolder of
BepInEx/plugins, update its path inKeepFoodOnDeath.csproj. - Run
dotnet build -c Release. - Copy
bin/Release/net48/KeepFoodOnDeath.dllintoBepInEx/plugins/on the server and clients.
Known limitations
- Written against Valheim's internals from memory, so a game update may break it.
- The server cannot verify that a client really restored the food. It only controls the settings.
- Food effects are only restored when the game links them to a food item or they are timed effects. Foods with no extra effect simply come back as food.
Changelog
- 1.2.0 Potions and meads are excluded from restoration. New
ExcludePotionsAndMeadsoption. - 1.1.0 Restores all timed status effects. Full health on revival. New
KeepAllStatusEffects,ExcludedEffectsandHealToFullHealthoptions. - 1.0.0 Initial version: keeps eaten food and food effects after death.