Mining 4a: blasts wear the rocks their disc covers, through Detonate

Detonate's chunk pass shares the disc by area over rocks (lens over pi r^2), publishes one
AbsorbEvent per worn rock on Zone.ChunkCapabilities, then Zone.Wear. Publish takes a
CapabilityEvents so entities and rocks share it. One largest-rock bound (Zone.LargestChunkRadius)
serves the index and the blast query.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Nibu 2026-11-12 21:28:43 +00:00
commit cbe33a0f1d
4 changed files with 324 additions and 15 deletions

View file

@ -62,6 +62,9 @@ public class Zone
// the entities, and one provider per belt. The reticle, cycling and any range query over rocks go through it;
// nothing else scans a belt.
public readonly TargetingIndex Targets = new TargetingIndex();
// Mining cut 4a: the receiver of every rock impact FireControl.Detonate publishes. Notification only: a presenter
// subscribes once per zone, and nothing in ServerShared reads it.
public readonly CapabilityEvents ChunkCapabilities = new CapabilityEvents();
private readonly List<Sun> _suns = new List<Sun>();
private HashSet<CultRecordKey> _updatedOrbits = new HashSet<CultRecordKey>();
@ -674,6 +677,14 @@ public class Zone
return belt.DamagedSize(chunk.Index, wear.Damage, Settings);
}
// No rock of any belt, whole or worn, is wider than this (AsteroidSize's bound over every argument, so over the
// Asteroid.Size range the generator writes). The index's visibility bound and a blast's query reach both use it.
public static float LargestChunkRadius(PlanetSettings settings)
{
var size = settings.AsteroidSize;
return size.Exponent > 0 ? max(abs(size.Minimum), abs(size.Maximum)) : float.PositiveInfinity;
}
// Cut 2: the only writer of chunk wear. Returns whether this hit broke the chunk. The break threshold is
// strictly greater-than, matching the deleted per-tick miner's own comparison against accumulated damage:
// damage exactly equal to hitpoints does not yet break the chunk, only damage that exceeds them does.