Heal All Damaged Things¶
Iterate every Thing currently alive in the scene and call DamageState.HealAll() on each damaged, repairable instance. Reach for this recipe when a mod needs a bulk repair pass, a time-skip cover operation, or a "service technician" event that resets wear / decay / burn / brute damage across the world.
When to use¶
- A mod wants to clear accumulated minor damage across every structure and item in a single pass.
- A time-skip cover effect wants to make the world look "cleaned up" after the skip resolves.
- A console command or admin tool wants a one-shot repair-the-world action.
Prerequisites¶
- Server-side code path.
HealAll()internally callsDamage()which checksGameManager.RunSimulation. - A stable moment in the main loop (iterate on the main thread; reflection-based iteration of world state off the main thread is unsafe).
Steps¶
using PooledSpan<Thing> span = OcclusionManager.AllThings.AsPooledSpan();
foreach (Thing thing in span.Collection)
{
if (thing == null) continue;
if (thing.DamageState.Indestructable) continue;
if (thing.IsBroken) continue; // skip destroyed
if (thing.DamageState.Total <= 0f) continue; // skip undamaged
thing.DamageState.HealAll();
}
PooledSpan rents from ArrayPool, so the collection may contain trailing nulls. Always null-check.
Verification¶
- Snapshot a representative cross-section of Things before and after: pick a few damaged
Structureinstances, a few damagedIteminstances, and any known-broken entries. - Confirm
DamageState.Totalis zero on each previously damaged Thing after the pass. - Confirm
IndestructableThings andIsBrokenThings retained their prior values (the loop skips them).
Caveats¶
- Server-side only.
HealAll()internally callsDamage()which checksGameManager.RunSimulation. - Destroyed items (
IsBroken): Total >= MaxDamage. Healing resets the numbers but doesn't rebuild structures in broken mesh state. Skip them. - Decay extra flag:
Item.IsDecayedis a separate bool.HealAll()zeros decay damage but does NOT resetIsDecayed. Set((Item)thing).IsDecayed = falseseparately to un-decay items. - Structures with broken meshes:
CurrentBuildStateIndex < 0. Need rebuilding, not healing.Structure.IsBrokencatches these.
Verification history¶
- 2026-04-20: page created from the Research migration; verbatim content lifted from F0086 and F0095l (
Plans/LLM/RESEARCH.md:394-411).
Open questions¶
None at creation.