api
The one public API of Hearthvale. `Town.place({ style, layout, seed, at, yaw, parent, collide, lights, townsfolk })` builds a whole walkable town; `Town.building(kind, { at, yaw, style, seed, ... })` places one building; `Town.prop(kind, { at, yaw, style })` one prop; `Town.ancho…
api
The one public API of Hearthvale. Town.place({ style, layout, seed, at, yaw, parent, collide, lights, townsfolk }) builds a whole walkable town; Town.building(kind, { at, yaw, style, seed, ... }) places one building; Town.prop(kind, { at, yaw, style }) one prop; Town.anchor(name) answers { name, position, yaw, forward } for gameplay points (guildDesk, questBoard, innBar, shopCounter, castleGate, alley1, dungeonRoadSouth, playerSpawn, ...); Town.anchors(prefix), Town.spots() (townsfolkKit activity spots), Town.registerTownsfolkSpots(require("townsfolkKit.api")), Town.clear(), Town.stats(), Town.material(style, slot). Everything is local, temporary and deterministic, so every peer builds the same town. Require it as require("townKit.api").
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
vec(v: any) → void
| arg | type | description |
|---|---|---|
| v | any |
yawQuat(yaw: number) → void
| arg | type | description |
|---|---|---|
| yaw | number |
yawPitchQuat(yaw: number, pitch: number) → void
yaw about Y, then pitch about the turned X axis
| arg | type | description |
|---|---|---|
| yaw | number | |
| pitch | number |
register(name: string, x: number, y: number, z: number, yaw: number, alias: string?) → void
| arg | type | description |
|---|---|---|
| name | string | |
| x | number | |
| y | number | |
| z | number | |
| yaw | number | |
| alias | string? |
framed(frame: any, x: number, y: number, z: number, yaw: number) → void
town-local -> world, for a town placed with `at` / `yaw`
| arg | type | description |
|---|---|---|
| frame | any | |
| x | number | |
| y | number | |
| z | number | |
| yaw | number |
_anchor(name: string, x: number, y: number, z: number, yaw: number, frame: any?) → void
| arg | type | description |
|---|---|---|
| name | string | |
| x | number | |
| y | number | |
| z | number | |
| yaw | number | |
| frame | any? |
_spot(kind: string, x: number, y: number, z: number, yaw: number, tag: string?, frame: any?) → void
| arg | type | description |
|---|---|---|
| kind | string | |
| x | number | |
| y | number | |
| z | number | |
| yaw | number | |
| tag | string? | |
| frame | any? |
ink(rootEnt: any, style: string) → void
| arg | type | description |
|---|---|---|
| rootEnt | any | |
| style | string |
meshesFor(key: string, build: () → void
the meshes of a builder, made once per cache key and shared after
| arg | type | description |
|---|---|---|
| key | string | |
| build | ( |
instantiate(name: string, meshes: { [string]: any }, b: any, x: number, y: number, z: number, yaw: number, o: any) → any
Spawn a built thing: a root at (x, y, z, yaw) with one Model child per material slot, its colliders and its lights; its anchors and spots registered in world space.
| arg | type | description |
|---|---|---|
| name | string | |
| meshes | { [string]: any } | |
| b | any | |
| x | number | |
| y | number | |
| z | number | |
| yaw | number | |
| o | any |
W(px: number, py: number, pz: number) → void
| arg | type | description |
|---|---|---|
| px | number | |
| py | number | |
| pz | number |
building(kind: string, opts: any?) → any
Place one building. kind: one of Town.BUILDINGS. opts: at (vector or {x,y,z}), yaw (radians; the front faces -Z at yaw 0), style, seed (picks the variant), parent, collide (default true), lights (default true), id (anchor alias), and the kind's own options (shop = "smith"|"potion"|..., roof = "roofTile"|"roofTeal"|"roofSlate"|"thatch", length = wall length). Returns { root, kind, footprint }.
| arg | type | description |
|---|---|---|
| kind | string | |
| opts | any? |
prop(kind: string, opts: any?) → any
Place one prop. kind: one of Town.PROPS. opts: at, yaw, style, parent, collide, scale.
| arg | type | description |
|---|---|---|
| kind | string | |
| opts | any? |
place(opts: any?) → any
Place a whole town. opts: style (default "anime"), layout (default "castleTown"), seed (default 1), at, yaw, parent, collide, lights, townsfolk (townsfolkKit's api module: registers the activity spots with it), name. Returns the town: { root, style, layout, seed, anchors = names, spots, bounds, stats }.
| arg | type | description |
|---|---|---|
| opts | any? |
anchor(name: string) → any
A named point the game needs: { name, position (vector), yaw, forward (vector) }, or nil. Names: playerSpawn, guildDesk, guildDeskFront, questBoard, guildEntrance, guildInterior, guildTable1..4, guildFireplace, innBar, innBarFront, innEntrance, innInterior, innTable1..3, innFireplace, shopCounter (shopCounter2...) and shopCounter:<shop>, shopKeeper..., castleGate, castleGateInside, townGate, plaza, fountain, market, well, alley1.., dungeonRoadNorth/East/South/West (the roads out), chapelDoor, bridge, riverbank.
| arg | type | description |
|---|---|---|
| name | string |
anchors(prefix: string?) → void
Every anchor (optionally only those whose name starts with `prefix`).
| arg | type | description |
|---|---|---|
| prefix | string? |
spots( ) → void
Every activity spot the placed buildings and layouts declare, in townsfolkKit's shape: { kind, position, yaw, tag }. Kinds are townsfolkKit spot kinds.
registerTownsfolkSpots(TF: any) → void
Register every spot with townsfolkKit. Pass its api module (townKit does not depend on it): `Town.registerTownsfolkSpots(require("townsfolkKit.api"))`. Returns how many were added.
| arg | type | description |
|---|---|---|
| TF | any |
clear( ) → void
Remove every town and building this module placed, and forget their anchors.
forget( ) → void
Forget only the anchors and spots (keep entities): for a rebuild by a component.
stats( ) → any
Counts of what was built and how long it took.
material(style: string, slot: string) → any
The material a slot wears in a style (for dressing your own geometry to match).
| arg | type | description |
|---|---|---|
| style | string | |
| slot | string |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
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.