You are viewing a potentially older version of this package. View all versions.
Dumba-NoAFKRaids-2.0.0 icon

NoAFKRaids

Prevents raids from starting near players that are AFK.

By Dumba
Date uploaded 4 days ago
Version 2.0.0
Download link Dumba-NoAFKRaids-2.0.0.zip
Downloads 337
Dependency string Dumba-NoAFKRaids-2.0.0

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2333 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.2333

README

No AFK Raids

Version 2.0.0 - Complete rewrite! Now extremely lightweight. If upgrading from 1.x, you may want to delete your server's old config file.

Prevents raids from occurring within 200 meters (configurable) of an AFK player.

  • Players are considered AFK after three minutes of inactivity (configurable)
  • Crossplay compatible
  • ServerSync: Config syncs from server to clients automatically
  • Uses Valheim's native event system for optimal reliability

Installation

Place NoAFKRaids.dll in BepInEx/plugins/

Scenario Where to Install
Singleplayer Your game only
Self-hosted multiplayer Host + all clients
Dedicated server Server + all clients

Note: Players without the mod installed won't have their AFK status tracked and won't be protected from raids.


ServerSync

This mod uses ServerSync to synchronize configuration from the server to clients. When ServerConfigLocked = true (default), the server's settings override client settings for gameplay options. Logging preferences remain client-side.


Configuration Options

Config file: BepInEx/config/dumba.noafkraids.cfg

AFK Detection

Setting Default Description
ServerConfigLocked true Server settings override client settings
AFKMinutes 3 Minutes without movement before considered AFK
MovementThreshold 0.1 Minimum movement distance to be considered active
UpdateInterval 10 Seconds between AFK status updates

Protection

Setting Default Description
AFKProtectionRadius 200 Distance (meters) around AFK players where raids are blocked
UseEventRangeAsProtection false Use the game's native event range (96m) instead of custom radius
AllowForcedEvents true Allow boss fights and forced events to proceed (don't block these)

Logging (Client-Side Only)

Setting Default Description
LogRaidDecisions true Log when raids are blocked or allowed
LogAFKStateChanges false Log when players go AFK or become active
DebugMode false Enable verbose debugging output

How It Works

The mod integrates directly with the event system at the optimal point where raid positions are determined. When a raid attempts to start:

  1. The game selects a raid type and target position
  2. NoAFKRaids checks if any AFK players are within the protection radius
  3. If an AFK player is nearby, the raid is prevented before it begins
  4. Active players can still experience raids normally

Why Client-Side AFK Detection?

For better performance on large servers. Server simply maintains a dictionary of AFK states and checks distances when raids occur (rare event).

Task Who Does It
Position monitoring & AFK timers Each client (distributed load)
State change notification Client → Server via RPC (infrequent)
Raid blocking decision Server (only when raids trigger)

Contact

Discord - Dumba (dumba7435)

CHANGELOG

Changelog

[2.0.0] - Major Rewrite

Major rewrite - Rewritten from ~2500 lines to ~700 lines of clean, maintainable code.

Why so much smaller?

  • Better hook point: Patches where the raid position is already calculated, made a lot of code obsolete

Added

  • UseEventRangeAsProtection: New option to use Valheim's native event range (96m) as protection radius
  • AllowForcedEvents: New option to let boss fights and forced events proceed without interference
  • Direct integration with Valheim's event positioning system for enhanced reliability

Changed

  • Streamlined configuration - removed advanced timing options in favor of automatic handling
  • Now uses Valheim's public API methods for better forward compatibility
  • Simplified logging options: LogRaidPositions and ShowProtectionRadius merged into DebugMode

Removed

  • PositionCheckDelay, MaxPositionRetries, UseDelayedEvaluation, FallbackPolicy, ProtectGlobalRaids, GlobalRaidAFKRadius - all obsolete, no longer needed in version 2.0.0.

Notes

  • Config Migration: If upgrading from 1.x, you may want to delete your old config file to get clean defaults. Core settings like AFKMinutes and AFKProtectionRadius remain the same.

[1.0.1]

Added

  • ServerSync Integration: Config settings are now synchronized from server to clients
    • Server administrators can enforce consistent raid protection settings across all players
    • Added ServerConfigLocked option (default: true) to control whether server enforces settings
    • Logging and debug settings remain client-side preferences

Fixed

  • Minor performance improvements during raid evaluation

[1.0.0] - Initial Release

Added

  • AFK detection based on player movement (configurable)
  • Proximity-based raid protection (configurable)
  • Support for all raid types
  • Configurable AFK timeout (default: 3 minutes)
  • Client-server communication for AFK state
  • Position tracking
  • Debug logging
  • Support for both Steam and crossplay connections

Configuration Options

  • AFKMinutes: Minutes without movement before considered AFK (default: 3)
  • MovementThreshold: Minimum movement distance to be considered active (default: 0.1)
  • UpdateInterval: Seconds between AFK status updates (default: 10)
  • AFKProtectionRadius: Protection radius around AFK players (default: 200m)
  • ProtectGlobalRaids: Whether to block global raids if any player is AFK (default: false)
  • GlobalRaidAFKRadius: Protection radius for global raids (default: 200m)
  • FallbackPolicy: Policy if position detection fails (default: Conservative)