RhAssets
Every material and sound clip **Railhead: Dust Sea** touches, resolved through a static identity literal.
RhAssets
Every material and sound clip Railhead: Dust Sea touches, resolved through a static identity literal.
local Assets = require("RhAssets")
Assets.material("rh_barrel") -- an AssetRef<material>
Assets.clip("fire") -- an AssetRef<soundClip>
Why this exists
A computed reference — asset.ref(someVariable) — cannot be pinned at publish
time. The reference is invisible to the world's dependency graph, and there is
no guarantee it resolves once the world is installed somewhere else, so the
publish gate refuses it.
That is a real constraint, not a formality: RhFx.setModel and RhProps.part
both take a material name as an argument, and RhAudio.play takes a cue name.
Those are exactly the call shapes that produce a computed ref.
So the whole set is spelled out here once, each as a literal, and everything
else looks up by short key. The registry is the single place that knows an
asset's full identity; the rest of the game says "rh_barrel" and "fire".
Lazy on purpose
Both tables fill on first use rather than at module load. Requiring this module
early — from a component's awake, before the asset index has finished
registering the world's own content — would otherwise fail to resolve. An
unknown key warns and returns nil instead of raising, so a typo in an effect
shows up as one missing material rather than a dead frame.
Adding an asset
Add the literal to the matching builder (buildMaterials or buildClips). For
a sound cue, add it to RhAudio.CUES and give it a generator there too — the
bake walks that table and nothing else.
Scoped to this part · feeds back into the world's score.