Builtin Library
README.md
scene.clean
Clear the active scene down to a protected keep-set.
Every argument is optional, and with none only the player setup is kept:
keep— a selection to protect besides the player setup, for example every entity carrying aLightto keep the lighting.keepPlayer—falseremoves the player setup too, a full empty.dryRun—truereports what would go and changes nothing.
By default only the player setup survives (every PlayerPrototype subtree and
every PlayerSpawn), so a clean never orphans the player. keep protects a
CATEGORY of entities — a scene.find query on component / attribute /
tag / under — not a single named entity.
A clean is a LIVE mutation only: it does not write the saved scene.json, so
scene.revert undoes it and scene.save commits it. If the scene has unsaved
edits, clean refuses (to avoid folding its removals into work no revert could
restore) — save or revert those edits first. There is no confirm/force flag.
The guard does not apply while play mode runs unpaused.
Returns { removed, kept, intent }, plus a warning when the clean left the
scene with no lights.