mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Merge 1b848cc551
into aba2b6638e
This commit is contained in:
commit
cf52593dc0
3 changed files with 221 additions and 51 deletions
132
doc/lua_api.md
132
doc/lua_api.md
|
@ -1589,7 +1589,6 @@ There are a bunch of different looking node types.
|
||||||
* Uses models for nodes.
|
* Uses models for nodes.
|
||||||
* Tiles should hold model materials textures.
|
* Tiles should hold model materials textures.
|
||||||
* Only static meshes are implemented.
|
* Only static meshes are implemented.
|
||||||
* For supported model formats see Irrlicht engine documentation.
|
|
||||||
* `plantlike_rooted`
|
* `plantlike_rooted`
|
||||||
* Enables underwater `plantlike` without air bubbles around the nodes.
|
* Enables underwater `plantlike` without air bubbles around the nodes.
|
||||||
* Consists of a base cube at the coordinates of the node plus a
|
* Consists of a base cube at the coordinates of the node plus a
|
||||||
|
@ -9703,29 +9702,113 @@ Currently the only workaround is to use `run_at_every_load = true`.
|
||||||
Tile definition
|
Tile definition
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
* `"image.png"`
|
Short form:
|
||||||
* `{name="image.png", animation={Tile Animation definition}}`
|
|
||||||
* `{name="image.png", backface_culling=bool, align_style="node"/"world"/"user", scale=int}`
|
```lua
|
||||||
* backface culling enabled by default for most nodes
|
"mymod_image.png"
|
||||||
* align style determines whether the texture will be rotated with the node
|
-- Equivalent to `{name = "mymod_image.png"}`.
|
||||||
or kept aligned with its surroundings. "user" means that client
|
```
|
||||||
setting will be used, similar to `glasslike_framed_optional`.
|
|
||||||
Note: supported by solid nodes and nodeboxes only.
|
Long form:
|
||||||
* scale is used to make texture span several (exactly `scale`) nodes,
|
|
||||||
instead of just one, in each direction. Works for world-aligned
|
```lua
|
||||||
textures only.
|
{
|
||||||
Note that as the effect is applied on per-mapblock basis, `16` should
|
name = "mymod_image.png",
|
||||||
be equally divisible by `scale` or you may get wrong results.
|
-- Texture for the tile, see [Textures].
|
||||||
* `{name="image.png", color=ColorSpec}`
|
|
||||||
* the texture's color will be multiplied with this color.
|
image = "mymod_image.png",
|
||||||
* the tile's color overrides the owning node's color in all cases.
|
-- Deprecated. Alternative to `name`.
|
||||||
* deprecated, yet still supported field names:
|
|
||||||
* `image` (name)
|
backface_culling = bool,
|
||||||
|
-- If `true`, faces will only be drawn from one side.
|
||||||
|
--
|
||||||
|
-- Default:
|
||||||
|
-- * `false` for drawtypes `plantlike`, `firelike`, `mesh`, and `liquid`. TODO: flowingliquid?
|
||||||
|
-- * `false` for `special_tiles` of drawtype `plantlike_rooted`.
|
||||||
|
-- * `true` otherwise.
|
||||||
|
|
||||||
|
tileable_horizontal = bool,
|
||||||
|
tileable_vertical = bool,
|
||||||
|
-- Decides how textures are sampled out-of-bounds.
|
||||||
|
--
|
||||||
|
-- If `true`, pixels are repeated, if `false`, values are clamped to edge.
|
||||||
|
--
|
||||||
|
-- `tileable_horizontal` and `tileable_vertical` apply to texture coordinates
|
||||||
|
-- horizontal and vertical respecitively in uv space, not world space.
|
||||||
|
--
|
||||||
|
-- Default (for both):
|
||||||
|
-- * `false` for drawtypes `plantlike`, and `firelike`.
|
||||||
|
-- * `false` for `special_tiles` of drawtype `plantlike_rooted`.
|
||||||
|
-- * `true` otherwise.
|
||||||
|
|
||||||
|
align_style = "node",
|
||||||
|
-- Determines whether the texture will be rotated with the node or kept
|
||||||
|
-- aligned with its surroundings.
|
||||||
|
--
|
||||||
|
-- The tile for a face of a node is still chosen by the node's rotation. This
|
||||||
|
-- option only applies to the rotation within the face's plane.
|
||||||
|
--
|
||||||
|
-- One of:
|
||||||
|
-- * "node" (default): Rotated with node.
|
||||||
|
-- * "world": Always default rotation.
|
||||||
|
-- * "user": Client setting `world_aligned_mode` will be used, similar to
|
||||||
|
-- `glasslike_framed_optional`.
|
||||||
|
--
|
||||||
|
-- Only supported by the following drawtypes:
|
||||||
|
--
|
||||||
|
-- * `normal`
|
||||||
|
-- * `liquid` (but not `flowingliquid`)
|
||||||
|
-- * `flowingliquid`: no, TODO
|
||||||
|
-- * `glasslike`: no, TODO
|
||||||
|
-- * `glasslike_framed`: Only frame (tile 1). With `paramtype2`
|
||||||
|
-- `glasslikeliquidlevel`, `special_tiles` also don't support this.
|
||||||
|
-- * `glasslike_framed_optional`: Same limitations as for `glasslike_framed`.
|
||||||
|
-- And if the `connected_glass` setting is disabled, it may be drawn like
|
||||||
|
-- only the `1/scale` base tile is drawn. TODO: just support glasslike
|
||||||
|
-- * `allfaces`
|
||||||
|
-- * `allfaces_optional`: no, because of leaves_style simple
|
||||||
|
-- * `nodebox`
|
||||||
|
-- * `plantlike_rooted` (only the cube part)
|
||||||
|
--
|
||||||
|
-- If a drawtype (or part of it) is not supported, don't use this feature,
|
||||||
|
-- as support may be added in the future.
|
||||||
|
--
|
||||||
|
-- Setting a different value in the corresponding `overlay_tiles` tile is not
|
||||||
|
-- supported.
|
||||||
|
|
||||||
|
scale = int,
|
||||||
|
-- Make the tile span several (exactly `scale`) nodes, instead of just one,
|
||||||
|
-- in each direction. Works for world-aligned tiles only.
|
||||||
|
--
|
||||||
|
-- `0` (default) to disable.
|
||||||
|
--
|
||||||
|
-- Note that as the effect is applied on a per-meshgen-chunk basis,
|
||||||
|
-- `16` should be equally divisible by `scale` or you may get wrong results.
|
||||||
|
--
|
||||||
|
-- Setting a different value in the corresponding `overlay_tiles` tile is not
|
||||||
|
-- supported.
|
||||||
|
|
||||||
|
color = ColorSpec,
|
||||||
|
-- The texture's color will be multiplied with this color.
|
||||||
|
--
|
||||||
|
-- Overrides the owning node's color in all cases (`color` nodedef field and
|
||||||
|
-- node palette color).
|
||||||
|
|
||||||
|
animation = Tile animation definition,
|
||||||
|
-- If given, tile will be animated over time.
|
||||||
|
--
|
||||||
|
-- See [Tile animation definition].
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Tile animation definition
|
Tile animation definition
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
{
|
||||||
|
type = "none",
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
|
|
||||||
|
@ -9736,7 +9819,7 @@ Tile animation definition
|
||||||
-- Height of a frame in pixels
|
-- Height of a frame in pixels
|
||||||
|
|
||||||
length = 3.0,
|
length = 3.0,
|
||||||
-- Full loop length
|
-- Full loop length in seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -9749,7 +9832,7 @@ Tile animation definition
|
||||||
-- Height in number of frames
|
-- Height in number of frames
|
||||||
|
|
||||||
frame_length = 0.5,
|
frame_length = 0.5,
|
||||||
-- Length of a single frame
|
-- Length of a single frame in seconds
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10014,8 +10097,12 @@ Used by `core.register_node`.
|
||||||
-- on the node.
|
-- on the node.
|
||||||
|
|
||||||
tiles = {tile definition 1, def2, def3, def4, def5, def6},
|
tiles = {tile definition 1, def2, def3, def4, def5, def6},
|
||||||
-- Textures of node; +Y, -Y, +X, -X, +Z, -Z
|
-- Textures of node.
|
||||||
|
-- UV mapping depends on drawtype, see [Node drawtypes].
|
||||||
|
-- For `normal` nodes: +Y, -Y, +X, -X, +Z, -Z
|
||||||
-- List can be shortened to needed length.
|
-- List can be shortened to needed length.
|
||||||
|
-- 6 is maximum.
|
||||||
|
-- See [Tile definition].
|
||||||
|
|
||||||
overlay_tiles = {tile definition 1, def2, def3, def4, def5, def6},
|
overlay_tiles = {tile definition 1, def2, def3, def4, def5, def6},
|
||||||
-- Same as `tiles`, but these textures are drawn on top of the base
|
-- Same as `tiles`, but these textures are drawn on top of the base
|
||||||
|
@ -10030,6 +10117,7 @@ Used by `core.register_node`.
|
||||||
|
|
||||||
color = ColorSpec,
|
color = ColorSpec,
|
||||||
-- The node's original color will be multiplied with this color.
|
-- The node's original color will be multiplied with this color.
|
||||||
|
-- Acts as a default for the `color` field of this node's TileDefs.
|
||||||
-- If the node has a palette, then this setting only has an effect in
|
-- If the node has a palette, then this setting only has an effect in
|
||||||
-- the inventory and on the wield item.
|
-- the inventory and on the wield item.
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,21 @@
|
||||||
local align_help = "Texture spans over a space of 8×8 nodes"
|
local align_help = "Texture spans over a space of 8×8 nodes"
|
||||||
local align_help_n = "Tiles looks the same for every node"
|
local align_help_n = "Tiles looks the same for every node"
|
||||||
|
|
||||||
core.register_node("tiled:tiled", {
|
local scaled_tile = {
|
||||||
description = "Tiled Node (world-aligned)".."\n"..align_help,
|
name = "tiled_tiled.png",
|
||||||
tiles = {{
|
align_style = "world",
|
||||||
name = "tiled_tiled.png",
|
scale = 8,
|
||||||
align_style = "world",
|
}
|
||||||
scale = 8,
|
|
||||||
}},
|
|
||||||
groups = {cracky=3},
|
|
||||||
})
|
|
||||||
|
|
||||||
core.register_node("tiled:tiled_rooted", {
|
core.register_node("tiled:tiled", {
|
||||||
description =
|
description = "Tiled 'normal' Node (world-aligned)".."\n"..align_help,
|
||||||
"Tiled 'plantlike_rooted' Node (world-aligned)".."\n"..
|
tiles = {scaled_tile},
|
||||||
"Base node texture spans over a space of 8×8 nodes".."\n"..
|
|
||||||
"A plantlike thing grows on top",
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "plantlike_rooted",
|
|
||||||
tiles = {{
|
|
||||||
name = "tiled_tiled.png",
|
|
||||||
align_style = "world",
|
|
||||||
scale = 8,
|
|
||||||
}},
|
|
||||||
special_tiles = {"tiled_tiled_node.png"},
|
|
||||||
groups = {cracky=3},
|
groups = {cracky=3},
|
||||||
})
|
})
|
||||||
|
|
||||||
core.register_node("tiled:tiled_n", {
|
core.register_node("tiled:tiled_n", {
|
||||||
description = "Tiled Node (node-aligned)".."\n"..align_help_n,
|
description = "Tiled 'normal' Node (node-aligned)".."\n"..align_help_n,
|
||||||
tiles = {{
|
tiles = {{name="tiled_tiled_node.png", align_style="node"}},
|
||||||
name = "tiled_tiled_node.png",
|
|
||||||
align_style = "node",
|
|
||||||
}},
|
|
||||||
groups = {cracky=3},
|
groups = {cracky=3},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -44,8 +27,107 @@ stairs.register_stair_and_slab("tiled_n", "tiled:tiled_n",
|
||||||
|
|
||||||
stairs.register_stair_and_slab("tiled", "tiled:tiled",
|
stairs.register_stair_and_slab("tiled", "tiled:tiled",
|
||||||
{cracky=3},
|
{cracky=3},
|
||||||
{{name="tiled_tiled.png", align_style="world", scale=8}},
|
{scaled_tile},
|
||||||
"Tiled Stair (world-aligned)".."\n"..align_help,
|
"Tiled Stair (world-aligned)".."\n"..align_help,
|
||||||
"Tiled Slab (world-aligned)".."\n"..align_help)
|
"Tiled Slab (world-aligned)".."\n"..align_help)
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_liquid", {
|
||||||
|
description =
|
||||||
|
"Tiled 'liquid' Node (world-aligned)".."\n"..
|
||||||
|
align_help.."\n"..
|
||||||
|
"(waving = 3)",
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "liquid",
|
||||||
|
tiles = {scaled_tile},
|
||||||
|
groups = {cracky=3},
|
||||||
|
waving = 3,
|
||||||
|
liquidtype = "source",
|
||||||
|
liquid_alternative_flowing = "tiled:tiled_flowingliquid",
|
||||||
|
liquid_alternative_source = "tiled:tiled_liquid",
|
||||||
|
liquid_renewable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_flowingliquid", {
|
||||||
|
description =
|
||||||
|
"Tiled 'flowingliquid' Node (world-aligned)".."\n"..
|
||||||
|
"Broken".."\n"..
|
||||||
|
"(waving = 3)",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "flowingliquid",
|
||||||
|
drawtype = "flowingliquid",
|
||||||
|
tiles = {scaled_tile},
|
||||||
|
special_tiles = {scaled_tile, scaled_tile},
|
||||||
|
groups = {cracky=3},
|
||||||
|
waving = 3,
|
||||||
|
liquidtype = "flowing",
|
||||||
|
liquid_alternative_flowing = "tiled:tiled_flowingliquid",
|
||||||
|
liquid_alternative_source = "tiled:tiled_liquid",
|
||||||
|
liquid_renewable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_glasslike", {
|
||||||
|
description =
|
||||||
|
"Tiled 'glasslike' Node (world-aligned)".."\n"..
|
||||||
|
"Broken",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tiles = {scaled_tile},
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_glasslike_framed", {
|
||||||
|
description =
|
||||||
|
"Tiled 'glasslike_framed' Node (world-aligned)".."\n"..
|
||||||
|
align_help,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "glasslike_framed",
|
||||||
|
tiles = {scaled_tile, scaled_tile},
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_glasslike_framed_optional", {
|
||||||
|
description =
|
||||||
|
"Tiled 'glasslike_framed_optional' Node (world-aligned)".."\n"..
|
||||||
|
align_help,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "glasslike_framed_optional",
|
||||||
|
tiles = {scaled_tile, "testnodes_glasslike_detail.png"}, --TODO: tiled detail png
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_allfaces", {
|
||||||
|
description =
|
||||||
|
"Tiled 'allfaces' Node (world-aligned)".."\n"..
|
||||||
|
align_help.."\n",
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
tiles = {scaled_tile},
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_allfaces_optional", {
|
||||||
|
description =
|
||||||
|
"Tiled 'allfaces_optional' Node (world-aligned)".."\n"..
|
||||||
|
"Broken for leaves_style = simple".."\n"..
|
||||||
|
"(waving = 2)",
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
tiles = {scaled_tile},
|
||||||
|
groups = {cracky=3},
|
||||||
|
waving = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("tiled:tiled_rooted", {
|
||||||
|
description =
|
||||||
|
"Tiled 'plantlike_rooted' Node (world-aligned)".."\n"..
|
||||||
|
"Base node texture spans over a space of 8×8 nodes".."\n"..
|
||||||
|
"A plantlike thing grows on top",
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "plantlike_rooted",
|
||||||
|
tiles = {scaled_tile},
|
||||||
|
special_tiles = {"tiled_tiled_node.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
name = tiled
|
name = tiled
|
||||||
description = Add nodes with a special texture that spans multiple nodes (aka "world-aligned")
|
description = Add nodes with a special texture that spans multiple nodes (aka "world-aligned")
|
||||||
depends = stairs
|
depends = stairs, testnodes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue