PlanBuildDupeFix
Server-side fix for PlanBuild on dedicated servers: a portal or sign plan built by the server no longer stays behind to be built again, so the plan totem cannot stamp out endless portals. Stacked copies are removed on world load.PlanBuildDupeFix
A server-side fix for PlanBuild on dedicated servers. Portal and sign plans built by the server are built once and disappear, as they should, instead of being built over and over.
The bug
To build a plan, PlanBuild places the real piece, writes its text (a portal's tag, a sign's text) and only then removes the plan. The materials live in the plan and go away with it.
The game signs that text with the local platform user, and a dedicated server has none, so writing the text fails. The real piece is already standing, but the plan is never removed and still holds its materials. A plan totem builds it again 3 seconds later, and again, and again: an endless stack of portals in one spot. Every copy torn down with a hammer gives back a third of the cost.
It happens whenever the server owns the plan — for example with server-side simulation mods, which hand objects to the server once their owner walks away. On our server one portal plan turned into 107 portals in six and a half minutes. Signs in blueprints have the same problem.
What this mod does
- Text without a platform user. When there is no platform user (a dedicated server), portal tags and sign texts are written without an author instead of failing. PlanBuild then finishes the build and removes the plan. Where a platform user exists (every client), the game's own code runs unchanged.
- Safety net. If building a plan still fails for any other reason, the plan is removed, so the build cannot be repeated. The materials of such a plan are lost, which is better than endless copies.
- Cleanup. When the world loads, portals that have no creator and stand two or more at one spot are removed. These are the copies left by the bug: portals placed by players always have a creator. The plan they came from stays and now builds once. Can be turned off in the config.
- XPortal list. XPortal recognises portals by the piece name, so it lists a portal plan as a portal too, and after the plan is built the unnamed entry stays in everyone's target list until someone joins. Within 2 seconds the server removes such entries: plans, and entries whose object was removed. Can be turned off in the config.
Installation
Server only. Players do not need it, and it does not check versions, so clients without it connect as usual.
- Mod manager: install it on the server.
- Manual: put
PlanBuildDupeFix.dllintoBepInEx/pluginson the server.
Config
BepInEx/config/qua8ion.valheim.planbuilddupefix.cfg
[Cleanup] RemoveStackedPortalCopies(defaulttrue) — remove stacked portal copies when the world loads.[Cleanup] CleanXPortalList(defaulttrue) — keep PlanBuild plans and removed objects out of the XPortal list.
Log
- On start:
Portal and sign text is set without a platform user; a plan whose build fails is removed; stacked portal copies are removed on world load; plans are kept out of the XPortal list. - When a plan is built by the server:
Set portal text without a platform user (N so far)(the first 20, then every hundredth). - Cleanup:
Removed N portal copies without a creator stacked at (x, y, z). - XPortal list:
Removed <id> from the XPortal list: it is a plan (portal_wood_planned)or…: its object was removed.


