structures
A module script.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2Blast Radius — destructible structure engine. Builds a contract site (lot, building segment grid, protected objects), runs the structural support graph, applies charge blasts (damage + impulse with falloff), converts unsupported segments to dynamic rigid bodies, tracks crush damage from falling debris, and tallies the grade inputs (demolition %, containment, protected hp).
vlen(x: ?, y: ?, z: ?) → void
| arg | type | description |
|---|---|---|
| x | ? | |
| y | ? | |
| z | ? |
spawnBox(name: ?, x: ?, y: ?, z: ?, sx: ?, sy: ?, sz: ?, color: ?, opts: ?) → void
| arg | type | description |
|---|---|---|
| name | ? | |
| x | ? | |
| y | ? | |
| z | ? | |
| sx | ? | |
| sy | ? | |
| sz | ? | |
| color | ? | |
| opts | ? |
segAabb(seg: ?) → void
Site construction
| arg | type | description |
|---|---|---|
| seg | ? |
aabbTouch(a: ?, b: ?, pad: ?) → void
| arg | type | description |
|---|---|---|
| a | ? | |
| b | ? | |
| pad | ? |
buildSupportGraph(site: ?) → void
| arg | type | description |
|---|---|---|
| site | ? |
spawnFence(site: ?, obj: ?) → void
Fence ring around the lot rect (posts + two rails per side), one hp pool.
| arg | type | description |
|---|---|---|
| site | ? | |
| obj | ? |
post(x: ?, z: ?) → void
| arg | type | description |
|---|---|---|
| x | ? | |
| z | ? |
rail(x: ?, z: ?, sx: ?, sz: ?) → void
| arg | type | description |
|---|---|---|
| x | ? | |
| z | ? | |
| sx | ? | |
| sz | ? |
spawnProtected(site: ?) → void
| arg | type | description |
|---|---|---|
| site | ? |
spawnDressing(site: ?) → void
| arg | type | description |
|---|---|---|
| site | ? |
build(contract: ?) → void
Build the full site for a contract definition. Returns the site table.
| arg | type | description |
|---|---|---|
| contract | ? |
teardown(site: ?) → void
Despawn everything the site spawned.
| arg | type | description |
|---|---|---|
| site | ? |
detachSegment(site: ?, seg: ?, impulse: ?) → void
Structural support Flip a segment's EXISTING body to dynamic. The impulse is queued, not applied: an impulse in the same deferred batch as the setBodyType flip is silently dropped (it lands on the still-static body). Callers flush the queue with S.flushImpulses one frame later.
| arg | type | description |
|---|---|---|
| site | ? | |
| seg | ? | |
| impulse | ? |
flushImpulses(site: ?) → void
Apply queued detach impulses. Call at least one frame after the detaches that queued them.
| arg | type | description |
|---|---|---|
| site | ? |
recomputeSupport(site: ?) → void
BFS from grounded segments; every alive segment not connected to the ground through alive static segments detaches and becomes dynamic debris.
| arg | type | description |
|---|---|---|
| site | ? |
destroySegment(site: ?, seg: ?) → void
Damage
| arg | type | description |
|---|---|---|
| site | ? | |
| seg | ? |
damageSegment(site: ?, seg: ?, dmg: ?, impulseVec: ?) → void
Damage a segment. Destruction despawns immediately; knock-loose (detach) is only MARKED here — the caller detaches in a later frame, because creating rigid bodies the same frame others despawn launches debris at absurd velocity.
| arg | type | description |
|---|---|---|
| site | ? | |
| seg | ? | |
| dmg | ? | |
| impulseVec | ? |
protectedDistance(site: ?, obj: ?, x: ?, y: ?, z: ?) → void
distance from a point to a protected object (ring fences use the lot rect ring)
| arg | type | description |
|---|---|---|
| site | ? | |
| obj | ? | |
| x | ? | |
| y | ? | |
| z | ? |
damageProtected(site: ?, obj: ?, dmg: ?) → void
| arg | type | description |
|---|---|---|
| site | ? | |
| obj | ? | |
| dmg | ? |
applyBlast(site: ?, origin: ?, charge: ?, dir: ?) → void
Detonate a charge. origin = {x,y,z}; charge = Defs charge table; dir = normalized {x,y,z} aim direction (cutter only). Returns summary { destroyed, damaged }.
| arg | type | description |
|---|---|---|
| site | ? | |
| origin | ? | |
| charge | ? | |
| dir | ? |
clampDebris(site: ?) → void
Hard-clamp runaway debris. Slender pieces pinched between settling bodies get solver-ejected at hundreds of m/s; nothing legitimate in this game moves faster than a thrown panel.
| arg | type | description |
|---|---|---|
| site | ? |
crushTick(site: ?, now: ?) → void
Per-frame debris tick: fast-moving detached segments damage protected objects (and target segments) they land on. Budgeted round-robin. Returns the max debris speed seen this call (for settle detection).
| arg | type | description |
|---|---|---|
| site | ? | |
| now | ? |
isSettled(site: ?) → void
True when every detached segment is asleep or crawling.
| arg | type | description |
|---|---|---|
| site | ? |
tally(site: ?) → void
Compute demolition %, containment %, protected hp %, chimney-line hit.
| arg | type | description |
|---|---|---|
| site | ? |
standingPct(site: ?) → void
% of target still standing (undemolished).
| arg | type | description |
|---|---|---|
| site | ? |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.