ForestMaterials
Resolves every Beechwood Brook forest surface by name to a material asset, for the looks `real`, `painted`, `toon` and the seasons `spring`, `summer`, `autumn`, `winter`. Called by the forest prop generators and the forest builder.
ForestMaterials
Resolves every Beechwood Brook forest surface by name to a material asset, for the looks real, painted, toon and the seasons spring, summer, autumn, winter. Called by the forest prop generators and the forest builder.
local FM = require("~forestMaterials.ForestMaterials")
local mat = FM.get("leafOak", { season = "autumn" }) -- never nil
for _, s in FM.surfaces() do print(s, FM.source(s)) end
if FM.leafless("leafOak", "winter") then --[[ draw no canopy ]] end
It prefers this package's own materials/<surface>[_<season>][_<look>] and falls back to the installed collections.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
own(group: string, name: string, bare: { [string]: boolean }?) → Def
| arg | type | description |
|---|---|---|
| group | string | |
| name | string | |
| bare | { [string]: boolean }? |
coll(group: string, real: { string }, toon: { string }?, style: { string }?, painted: { string }?) → Def
| arg | type | description |
|---|---|---|
| group | string | |
| real | { string } | |
| toon | { string }? | |
| style | { string }? | |
| painted | { string }? |
normalise(opts: { season: string?, look: string? }?) → void
| arg | type | description |
|---|---|---|
| opts | { season: string?, look: string? }? |
guidOf(ref: any) → string
| arg | type | description |
|---|---|---|
| ref | any |
stylised(look: string, isCard: boolean, compliance: number) → void
the stylised look's settings, for a foliage card or a tile
| arg | type | description |
|---|---|---|
| look | string | |
| isCard | boolean | |
| compliance | number |
derived(name: string, season: string, look: string) → void
a season or look of a base material, built once per machine
| arg | type | description |
|---|---|---|
| name | string | |
| season | string | |
| look | string |
derivedStyle(surface: string, style: { string }, look: string) → void
a stylised look drawn from a collection surface's own textures
| arg | type | description |
|---|---|---|
| surface | string | |
| style | { string } | |
| look | string |
resolveFresh(surface: string, look: string, season: string) → void
| arg | type | description |
|---|---|---|
| surface | string | |
| look | string | |
| season | string |
get(surface: string, opts: { season: string?, look: string? }?) → any
Resolve a forest surface to a material for a look and season. Never nil: an unknown look falls back to "real", an unknown season to "summer", an unknown surface to a neutral bark. The summer real look of a package surface and every collection surface is a material asset; other seasons and looks are runtime materials built once per machine.
| arg | type | description |
|---|---|---|
| surface | string | A surface name from FM.surfaces(), e.g. "leafOak", "barkBirch", "groundMoss". |
| opts | { season: string?, look: string? }? | { season = "spring"|"summer"|"autumn"|"winter", look = "real"|"painted"|"toon" }; both optional. |
examples
local mat = FM.get("leafOak", { season = "autumn" })source(surface: string, opts: { season: string?, look: string? }?) → string
Where FM.get's answer came from: "own:<material>" (this package), "runtime:<key>" (a season or look built from it), "installed:<identity>" (a collection) or "fallback:<identity>".
| arg | type | description |
|---|---|---|
| surface | string | A surface name. |
| opts | { season: string?, look: string? }? | Same as FM.get. |
examples
print(FM.source("barkMaple", { look = "toon" }))surfaces( ) →
Every forest surface name this module resolves, in catalogue order.
examples
for _, s in FM.surfaces() do print(s) end
leafless(surface: string, season: string?) → boolean
True when the surface has no leaves (or flowers) that season: deciduous leaves and hazel in winter, flowers in autumn and winter. Props should then draw no part with that surface.
| arg | type | description |
|---|---|---|
| surface | string | A surface name. |
| season | string? | "spring" | "summer" | "autumn" | "winter". |
examples
if not FM.leafless("leafOak", season) then addCanopy() endgroup(surface: string) → string
The group a surface belongs to: "bark", "wood", "leaf", "undergrowth", "flower", "small", "stone", "ground" or "water". Foliage groups (leaf, undergrowth, flower) are alpha-cut two-sided cards that sway by vertex-colour alpha.
| arg | type | description |
|---|---|---|
| surface | string | A surface name. |
examples
if FM.group("fernMale") == "undergrowth" then ... endbaseOf(surface: string) → string
The base material of this package a surface draws with, or nil when the surface is a collection material.
| arg | type | description |
|---|---|---|
| surface | string | A surface name. |
refresh( ) → void
Drop the resolution cache (runtime materials already built stay registered under their keys).
examples
FM.refresh()
_catalogue( ) →
Everything ForestMaterialsBuild.writeTable() turns into literal resolves: the base materials, the collection materials, the textures the runtime looks draw from, and the shaders.
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.