InfiniteDeadHead Fixed
Keeps spectate-head energy full using the current REPO energy logic.Infinite Dead Head (Fixed)
A separate rebuild of InfiniteDeadHead for REPO. It does not overwrite or modify the original AXIAN mod or any installed profile.
Reverse-engineering findings
The original assembly contains a Harmony postfix on PlayerDeathHead.Update():
SpectateCamera.instance.headEnergy = 1f;
The current game stores spectate-head energy in SpectateCamera.headEnergy. Energy is drained by the private SpectateCamera.HeadEnergyLogic() method, which also calculates headEnergyEnough.
The original patch dereferences the global SpectateCamera.instance from another component's Update without a null check. When that singleton is unavailable, the postfix can throw a NullReferenceException from the patched PlayerDeathHead.Update. The stack trace alone does not prove every occurrence came from this mod, but the unsafe dereference is a concrete defect in its code.
Fix
This build applies a postfix directly to SpectateCamera.HeadEnergyLogic(). After vanilla logic executes, it restores headEnergy = 1f and headEnergyEnough = true. This prevents normal energy drain from exhausting the spectate head and keeps the interaction available.
Private game fields are accessed through cached reflection metadata, so the plugin compiles without relying on internal game members being public. It does not modify PlayerDeathHead.Update, ItemBattery, or the game's networked item-battery system.
Build
The project targets .NET Standard 2.1 to match the current REPO Assembly-CSharp dependency and references local REPO / BepInEx assemblies.
dotnet build .\src\InfiniteDeadHead.Fixed.csproj -c Release -o .\build
The resulting plugin is build\InfiniteDeadHead.Fixed.dll.
