You are viewing a potentially older version of this package. View all versions.
UncleBugDev-MassFixStructure-1.0.1 icon

MassFixStructure

Smart mass repair mod for Valheim created thanks to streamer DaymonMontage. Repairs entire connected buildings or structures in a radius with a single hammer strike, zero lag, sound throttling, and ward protection.

Date uploaded 14 hours ago
Version 1.0.1
Download link UncleBugDev-MassFixStructure-1.0.1.zip
Downloads 19
Dependency string UncleBugDev-MassFixStructure-1.0.1

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

MassFixStructure Logo

MassFixStructure 🔨⚡

Smart, Zero-Lag Mass Building Repair for Valheim & Dedicated Servers
Repair entire connected castles, longhouses, palisades, and naval docks with a single hammer strike — featuring 99.8% network RPC compression, full dedicated server optimization, ward protection, and zero client stutter.

GitHub Release Thunderstore License: MIT Platform Multiplayer


🌟 English Overview

Tired of clicking hundreds of times to repair rain-weathered foundations, vast roofs, or post-raid fortresses? MassFixStructure revolutionizes building maintenance in Valheim. Strike a single damaged piece with your hammer to instantly trigger an intelligent repair pulse across your entire contiguous structure or surrounding area.

Engineered from the ground up for high-load multiplayer dedicated servers, competitive performance, and client comfort:

  • 🌐 99.8% Network RPC Compression: On standard Valheim servers, repairing 500 pieces floods the network socket with 500 individual RPC_Repair and 500 RPC_HealthChanged packets, causing desync and disconnects. MassFixStructure packs all repaired pieces into ONE single UDP packet (MassFix_BatchRepair), executed atomically on the server!
  • 🖥️ 100% Dedicated Server (Headless) Native: Runs seamlessly on Linux and Windows dedicated servers (-batchmode -nographics). Zero crashes: GUI, audio, and camera calls are strictly excluded from server execution.
  • 🛡️ Server Anti-Spam & Rate Limiting: Built-in server cooldown (0.8s minimum interval) neutralizes macro and auto-clicker spam, protecting server tickrate.
  • 🔒 Double Ward & Territory Protection: Validates PrivateArea.CheckAccess both client-side and server-side. Unauthorized players cannot repair or manipulate structures inside protected territories.
  • ⚡ Server-Authoritative Config Sync: When connecting to a dedicated server, server configuration limits (MaxRepairsPerSwing, SearchRadius, RequireWorkbench) automatically synchronize and take authority over client settings.
  • 🔄 Seamless Vanilla Server Fallback: Playing on a server without the mod? MassFixStructure automatically detects vanilla servers and seamlessly falls back to local frame-budgeted coroutine repairs.
  • 👂 Audio & VFX Comfort: Replaces hundreds of deafening simultaneous sound cues with a single clean hammer strike and subtle repair particles.

🎮 How to Use

  1. Equip your standard Hammer (or any building tool with repair capability).
  2. Switch to Repair Mode (hammer icon).
  3. Aim at any damaged piece belonging to your building and press Left Mouse Button (or hold LeftShift if configured for modifier key activation).
  4. Watch the entire contiguous building restore to 100% health in a wave of golden sparks!

⚙️ Configuration Reference

The configuration file is located at BepInEx/config/com.unclebug.massfixstructure.cfg and supports live hot-reloading:

Section Setting Default Description
1 - General ModEnabled true Master toggle for the mod.
1 - General RepairMode Connected Modes: Connected (contiguous pieces only), ConnectedSameCategory (same category only), or Radius (sphere search).
1 - General ActivationMode AlwaysOnRepair AlwaysOnRepair (every hammer hit) or HoldModifierKey (only when holding modifier key).
1 - General ModifierKey LeftShift Key to hold when ActivationMode is set to HoldModifierKey.
2 - Search & Limits MaxRepairsPerSwing 200 Maximum number of damaged pieces to fix per repair pulse (range: 1 - 1000).
2 - Search & Limits SearchRadius 30.0 Maximum distance (in meters) from target piece (range: 5m - 100m).
2 - Search & Limits MaxSearchVisitedNodes 1000 Safety limit on structural piece graph nodes visited during BFS traversal.
2 - Search & Limits RequireWorkbench true Respects crafting station / workbench coverage required by pieces.
3 - Performance & Network StaggerBatchesOverFrames true Spreads local/vanilla repair RPCs across consecutive frames to prevent FPS drops.
3 - Performance & Network BatchSizePerFrame 20 Pieces repaired per frame when local batching is active.
4 - Costs & Protection CostMode VanillaPerSwing VanillaPerSwing (1 swing cost for whole cluster), PerPieceScaled (scales slightly per piece), or Free.
4 - Costs & Protection PerPieceStaminaRatio 0.05 Extra stamina ratio per piece when CostMode is PerPieceScaled.
4 - Costs & Protection PerPieceDurabilityRatio 0.05 Extra durability drain ratio per piece when CostMode is PerPieceScaled.
4 - Costs & Protection PreventToolBreak true Halts repair pulse if tool durability drops <= 1.0 to prevent breaking.
5 - Feedback & UI SoundMode SingleAtOrigin SingleAtOrigin (1 clean sound), Muted (silent).
5 - Feedback & UI ShowHudNotification true Displays consolidated HUD message (e.g. MassFix: Repaired 85 pieces).

🇷🇺 Описание на русском

MassFixStructure — первоклассный мод для Valheim, созданный специально для выделенных серверов (Dedicated Servers) и одиночной игры. Позволяет одним ударом молотка мгновенно и без лагов починить целые замки, частоколы, крыши и базы любого масштаба!

🚀 Главные преимущества для серверов и игроков:

  • 🌐 Сжатие сетевого трафика на 99.8% (Atomic Batched RPC): В ванильной игре починка 500 деталей посылает 500 отдельных RPC-пакетов починки и 500 пакетов синхронизации здоровья, перегружая сокеты сервера и вызывая дисконнекты. MassFixStructure упаковывает всю починку в ОДИН компактный UDP-пакет, обрабатываемый сервером атомарно!
  • 🖥️ 100% совместимость с Headless серверами: Идеально работает на Linux и Windows выделенных серверах (-batchmode -nographics). Никаких крашей графики, звука или UI.
  • 🛡️ Защита от спама и макросов (Anti-Spam Rate Limit): Серверный кулдаун (0.8 сек) полностью блокирует спам автокликерами и макросами, сохраняя стабильный тикрейт сервера.
  • 🔒 Двойная защита оберегов (Ward Security): Проверка прав оберега (PrivateArea.CheckAccess) выполняется как на клиенте, так и на сервере. Чужие базы защищены от несанкционированного взаимодействия.
  • ⚡ Авторитетная синхронизация конфига с сервера: При подключении к серверу клиентские лимиты автоматически подстраиваются под настройки сервера (MaxRepairsPerSwing, SearchRadius, RequireWorkbench).
  • 🔄 Автоматический фоллбек для ванильных серверов: Если на сервере мод не установлен, клиент автоматически переключается на пофреймовую локальную корутину, исключая рассинхрон.
  • 👂 Звуковой комфорт: Вместо 300 оглушительных ударов воспроизводится один чистый звук починки.

🛠️ Установка

Для игроков (Клиент):

  1. Установите BepInExPack Valheim.
  2. Скопируйте MassFixStructure.dll в папку Valheim/BepInEx/plugins/ (или установите через Thunderstore Mod Manager в один клик).

Для выделенных серверов (Dedicated Server):

  1. Установите BepInEx на сервер.
  2. Скопируйте MassFixStructure.dll в папку BepInEx/plugins/ на сервере.
  3. Готово! Сервер готов принимать атомарные батчи и защищать тикрейт.

🔒 Zero-Risk & Compatibility Guarantee

  • Safe for Game Worlds: Never modifies save files, ZDO structures, or persistent formats.
  • Safe to Add/Remove: Completely clean uninstall at any moment with zero impact on world saves.

CHANGELOG

Changelog

All notable changes to MassFixStructure will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.0.1] - 2026-11-30

Fixed

  • Dedicated Server Ward Check (CheckServerWardAccess): Replaced PrivateArea.CheckAccess on the server (which relied on Player.m_localPlayer and returned false on headless servers, blocking all repairs inside wards) with a dedicated server-safe permission check using playerId.
  • ZDO Ownership & Sync Fix: Clients now authoritatively update ZDOVars.s_health for ZDOs they own both before sending and inside RPC_HandleSyncRepairs, preventing repairs from reverting on the next network sync tick.
  • Hammer Health Bar & Visual Sync: Updated WearNTear.m_healthPercentage, ClearCachedSupport(), and normalized SetHealthVisual percentage (health / m_health) so the hammer crosshair HP bar immediately updates to 100% green.
  • Robust Server RPC Routing: Switched batch RPCs to ZRoutedRpc's native server routing with automatic fallback to MassRepairRunner / vanilla if routing is unavailable.
  • Handshake Timing Fix: Reset ServerHasMod in ZRoutedRpc constructor instead of Game.Start to prevent race conditions on fast servers.
  • Graph Search & Workbench Fixes: Used absolute lossyScale for mirrored BoxCollider bounds, expanded piece layer mask (Default, static_solid, Default_small), fixed RequireWorkbench = false, and silenced false "missing station" HUD spam for distant building parts.
  • Coroutine Safety: Wrapped MassRepairRunner.RunBatched in try ... finally so IsRunning can never stay stuck true.

[1.0.0] - 2026-11-16

Initial Release

🌐 Dedicated Server & Multiplayer Architecture

  • Headless Server Compatibility:
    • 100% clean execution on headless Linux/Windows dedicated servers (-batchmode -nographics).
    • Zero crashes: UI, audio, camera, and HUD logic are strictly guarded against server execution.
  • Atomic Batched RPC Protocol (MassFix_BatchRepair & MassFix_SyncRepairs):
    • Reduces 500–1000 individual vanilla repair and health RPCs down to 1 single compact UDP packet (over 99.8% network traffic reduction).
    • Client packs all target ZDOIDs into a single ZPackage; server updates ZDOMan memory atomically and broadcasts 1 consolidated sync packet.
  • Server Anti-Spam & Rate Limiting:
    • Enforces a per-player cooldown (0.8s minimum interval) on the server to neutralize macro or auto-clicker spam.
  • Server-Side Ward & Territory Security:
    • Server strictly re-validates PrivateArea.CheckAccess before applying health updates to any ZDO.
  • Server-Authoritative Configuration Sync:
    • Server broadcasts authoritative ceilings (MaxRepairsPerSwing, SearchRadius, RequireWorkbench) upon player connection (MassFix_ServerHello). Client limits automatically conform to server policy.
  • Graceful Vanilla Server Fallback:
    • If connected to a server without MassFixStructure installed, the client automatically falls back to local staggered coroutine repairs without desync.

🔨 Core Repair Features & Modes

  • Smart Connected Structure Repair (Default Mode):
    • Targets the struck piece and traverses all contiguous, touching, and overlapping pieces belonging to the same building via non-allocating Breadth-First Search (BFS).
    • Repairs entire castles, roofs, palisades, and complex architectural assemblies in one strike.
  • Radius-Based Repair Mode:
    • Configurable spherical radius search to quickly restore all damaged structures within range.
  • Connected Same Category Mode:
    • BFS traversal restricted to the same piece category (e.g. only Building or only Furniture).
  • Zero-Lag Coroutine Batching (Client / Vanilla Fallback):
    • Frame-budgeted asynchronous repair runner (StaggerBatchesOverFrames).
    • Spreads repair operations across successive frames when repairing mega-structures, eliminating framerate hitches.
  • Intelligent Audio & Visual Throttling:
    • Replaces hundreds of simultaneous deafening repair sounds with a single throttled audio trigger at the origin piece.
    • Suppresses screen-blinding particle spam while providing clean visual feedback.
  • Ward & Private Area Grief Protection:
    • Strictly validates player ward permission (PrivateArea.CheckAccess) on every piece prior to repairing.
  • Configurable Economy & Tool Balance:
    • DurabilityDrainRatio: Multiplier for hammer durability consumption (from 0% free to custom multipliers).
    • StaminaDrainRatio: Configurable stamina cost per repaired item.
    • PreventToolBreak: Automatically halts repair pulse if tool durability drops <= 1.0, protecting valuable equipment.
    • MaxRepairsPerSwing: Hard safety cap per repair pulse (default: 200 pieces).
  • Comprehensive Hot-Reloadable Config:
    • All settings fully managed via BepInEx config file and synchronized in real-time.