materialdef
materialdef
The materialdef class represents physical and visual materials in Stranded III (e.g. wood, stone, flesh, metal, foliage), used for impact sounds, particle FX, and crafting recipes.
Overview
Properties (3)
| Property | Type | Summary |
|---|---|---|
id
|
string
|
Material identifier string. |
index
|
number
|
Internal material index. |
isValid
|
boolean
|
Checks if material definition is valid. |
Methods (4)
| Method Signature | Returns | Summary |
|---|---|---|
materialdef.exists(id)
|
boolean
|
Checks if a material definition exists. |
materialdef.get(val)
|
materialdef
|
Looks up a material definition. |
materialdef.getFromTexture(textureName)
|
materialdef
|
Looks up a material definition associated with a texture file name. |
materialdef.getList()
|
table
|
Returns all registered material definitions. |
Detailed Reference
materialdef.idstringMaterial string identifier.
Unique identifier such as "wood", "stone", "flesh", "metal".
materialdef.indexnumberInternal integer index.
Fast integer lookup index.
materialdef.isValidbooleanTrue if valid material definition.
Returns true if the material definition exists.
materialdef.exists(id)| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | Material ID. |
booleanTrue if material exists.
Returns true if id is registered.
materialdef.get(val)| Parameter | Type | Default | Description |
|---|---|---|---|
val | string|number|materialdef | Material ID, index, or instance. |
materialdefMaterial descriptor.
Returns the material definition matching the specified ID string or integer index.
materialdef.getFromTexture(textureName)| Parameter | Type | Default | Description |
|---|---|---|---|
textureName | string | Texture file name. |
materialdefMaterial definition mapped to the texture.
Resolves the material definition associated with a texture name.
materialdef.getList()table1-based array of all materialdef instances.
Returns a table containing all registered physical materials.