LessCx-LessSleep icon

LessSleep

Sleep voting for dedicated servers: skip the night before everyone is in bed, if a configurable percentage of players agree. Works with vanilla clients.

Last updated a week ago
Total downloads 163
Total rating 0 
Categories Tweaks Server-side Client-side
Dependency string LessCx-LessSleep-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2350 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2350

README

LessSleep

Sleep voting for Valheim dedicated servers: skip the night before every single player is in bed, if enough people agree.

  • Server-driven: the server decides when to ask and when the night skips.
  • No client is required: on a server where nobody runs the mod, it silently behaves like auto-skip (see How it works).
  • Clients get a prompt: awake LessSleep clients see a message and can vote with Y / N or by typing yes / no in chat.

How it works

  1. When at least PercentInBedToStartVote (default 50%) of online players are in bed (and at least MinimumPlayersInBed), the server opens a vote.
  2. Sleeping players are treated as a yes (they are the ones asking - it's their night too).
  3. Awake players running LessSleep are asked to accept or decline. If no awake player runs LessSleep, the vote passes immediately (auto-skip).
  4. The vote passes when at least VotePercentOfAwakeToPass of awake modded players accepted, and fails on timeout or when everyone voted no.
  5. On a pass the server skips to morning exactly like vanilla sleeping does.

Installation

Server

Install BepInExPack_Valheim and drop LessSleep.dll into BepInEx/plugins on the server.

Clients (optional, but recommended)

Same thing: install BepInExPack_Valheim, drop LessSleep.dll into BepInEx/plugins. Clients without the mod still see the vote messages and the night still skips for them, they just cannot cast a vote.

Configuration

Server config (BepInEx/config/LessCx.LessSleep.cfg):

Setting Default Description
PercentInBedToStartVote 50 Percentage of online players that must be in bed to start a vote.
MinimumPlayersInBed 1 Minimum number of players in bed before a vote can start.
VotePercentOfAwakeToPass 50 Percentage of awake LessSleep clients that must accept.
VoteTimeoutSeconds 30 How long a vote stays open.
VoteCooldownSeconds 60 Wait after a failed vote before a new one can start.

Client config:

Setting Default Description
EnableVotePrompt true Allow voting with the Y and N keys.
AllowChatYesNo true While a vote is open, typing yes or no in chat casts your vote.

Notes

  • The server never needs to know which clients run the mod to skip; the modded-client list is only used to decide who gets asked.
  • Voting is intentionally simple: one vote per player, last vote wins, votes are only accepted from connected players that announced themselves.

Building

dotnet build src/LessSleep.csproj -c Release
./scripts/pack.sh          # produces dist/LessCx-LessSleep-<version>.zip for Thunderstore

Reference paths default to the macOS Steam install and can be overridden:

dotnet build src/LessSleep.csproj -c Release \
  -p:ValheimManagedDir=".../Steam/steamapps/common/Valheim/valheim.app/Contents/Resources/Data/Managed" \
  -p:BepInExCoreDir=".../Steam/steamapps/common/Valheim/BepInEx/core"

CI / releasing

Workflow Trigger What it does
build push to main, pull requests compiles and uploads the package as a build artifact
publish tag vX.Y.Z or manual dispatch stamps the version, builds, publishes to Thunderstore with tcli, creates a GitHub release

CI has no game install, so .github/actions/prepare-refs downloads the Valheim dedicated server with SteamCMD (anonymous) and the BepInEx core from Thunderstore into a cached .refs/ directory. Game DLLs are never committed to this repository. When Valheim updates, bump the cache key in .github/actions/prepare-refs/action.yml so CI picks up fresh reference assemblies.

One-time setup: create a Thunderstore service account for the LessCx team (Settings > Teams > LessCx > Service Accounts) and store its token as a repository secret:

gh secret set TCLI_AUTH_TOKEN --repo LovelessCodes/LessSleep

Release: bump version_number in manifest.json (and CHANGELOG.md), commit, then:

git tag v1.0.1 && git push origin v1.0.1

The publish workflow stamps that version everywhere, so the tag is the source of truth.

License

MIT