forked from Mirrorlandia_minetest/minetest
Leveled nodebox: Change levels from 1/63rds to 1/64ths
Add missing documentation of leveled nodebox to lua_api.txt, plus a little cleaning up nearby.
This commit is contained in:
parent
27144b4716
commit
d8f20d029a
@ -15,8 +15,7 @@ Mods are contained and ran solely on the server side. Definitions and media
|
|||||||
files are automatically transferred to the client.
|
files are automatically transferred to the client.
|
||||||
|
|
||||||
If you see a deficiency in the API, feel free to attempt to add the
|
If you see a deficiency in the API, feel free to attempt to add the
|
||||||
functionality in the engine and API. You can send such improvements as
|
functionality in the engine and API.
|
||||||
source code patches to <celeron55@gmail.com>.
|
|
||||||
|
|
||||||
Programming in Lua
|
Programming in Lua
|
||||||
------------------
|
------------------
|
||||||
@ -824,6 +823,16 @@ node definition:
|
|||||||
0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y-
|
0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y-
|
||||||
facedir modulo 4 = rotation around that axis
|
facedir modulo 4 = rotation around that axis
|
||||||
paramtype2 == "leveled"
|
paramtype2 == "leveled"
|
||||||
|
^ Only valid for "nodebox" with 'type = "leveled"', and "plantlike_rooted".
|
||||||
|
Leveled nodebox:
|
||||||
|
The level of the top face of the nodebox is stored in param2.
|
||||||
|
The other faces are defined by 'fixed = {}' like 'type = "fixed"' nodeboxes.
|
||||||
|
The nodebox height is param2 / 64 nodes.
|
||||||
|
The maximum accepted value of param2 is 127.
|
||||||
|
Rooted plantlike:
|
||||||
|
The height of the 'plantlike' section is stored in param2.
|
||||||
|
The height is param2 / 16 nodes.
|
||||||
|
The maximum accepted value of param2 is 127.
|
||||||
paramtype2 == "degrotate"
|
paramtype2 == "degrotate"
|
||||||
^ The rotation of this node is stored in param2. Plants are rotated this way.
|
^ The rotation of this node is stored in param2. Plants are rotated this way.
|
||||||
Values range 0 - 179. The value stored in param2 is multiplied by two to
|
Values range 0 - 179. The value stored in param2 is multiplied by two to
|
||||||
@ -885,8 +894,8 @@ Look for examples in `games/minimal` or `games/minetest_game`.
|
|||||||
* `firelike`
|
* `firelike`
|
||||||
* `fencelike`
|
* `fencelike`
|
||||||
* `raillike`
|
* `raillike`
|
||||||
* `nodebox` -- See below. (**Experimental!**)
|
* `nodebox` -- See below
|
||||||
* `mesh` -- use models for nodes
|
* `mesh` -- Use models for nodes
|
||||||
* `plantlike_rooted`
|
* `plantlike_rooted`
|
||||||
|
|
||||||
`*_optional` drawtypes need less rendering time if deactivated (always client side).
|
`*_optional` drawtypes need less rendering time if deactivated (always client side).
|
||||||
@ -895,12 +904,8 @@ Node boxes
|
|||||||
-----------
|
-----------
|
||||||
Node selection boxes are defined using "node boxes"
|
Node selection boxes are defined using "node boxes"
|
||||||
|
|
||||||
The `nodebox` node drawtype allows defining visual of nodes consisting of
|
The `nodebox` node drawtype allows defining nodes consisting of an arbitrary
|
||||||
arbitrary number of boxes. It allows defining stuff like stairs. Only the
|
number of boxes. It allows defining stuff like stairs and slabs.
|
||||||
`fixed` and `leveled` box type is supported for these.
|
|
||||||
|
|
||||||
Please note that this is still experimental, and may be incompatibly
|
|
||||||
changed in the future.
|
|
||||||
|
|
||||||
A nodebox is defined as any of:
|
A nodebox is defined as any of:
|
||||||
|
|
||||||
@ -909,10 +914,18 @@ A nodebox is defined as any of:
|
|||||||
type = "regular"
|
type = "regular"
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
-- A fixed box (facedir param2 is used, if applicable)
|
-- A fixed box (or boxes) (facedir param2 is used, if applicable)
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = box OR {box1, box2, ...}
|
fixed = box OR {box1, box2, ...}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
-- A variable height box (or boxes) with the top face position defined by
|
||||||
|
-- the node parameter 'leveled = ', or if 'paramtype2 == "leveled"' by
|
||||||
|
-- param2.
|
||||||
|
-- Other faces are defined by 'fixed = {}' as with 'type = "fixed"'.
|
||||||
|
type = "leveled",
|
||||||
|
fixed = box OR {box1, box2, ...}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
-- A box like the selection box for torches
|
-- A box like the selection box for torches
|
||||||
-- (wallmounted param2 is used, if applicable)
|
-- (wallmounted param2 is used, if applicable)
|
||||||
@ -942,9 +955,6 @@ A box of a regular node would look like:
|
|||||||
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
|
||||||
`type = "leveled"` is same as `type = "fixed"`, but `y2` will be automatically
|
|
||||||
set to level from `param2`.
|
|
||||||
|
|
||||||
|
|
||||||
Meshes
|
Meshes
|
||||||
------
|
------
|
||||||
@ -4400,9 +4410,11 @@ Definition tables
|
|||||||
liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7)
|
liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7)
|
||||||
liquid_renewable = true, --[[
|
liquid_renewable = true, --[[
|
||||||
^ If true, a new liquid source can be created by placing two or more sources nearby ]]
|
^ If true, a new liquid source can be created by placing two or more sources nearby ]]
|
||||||
leveled = 0, --[[
|
leveled = 16, --[[
|
||||||
^ Block contains level in param2. Value is default level, used for snow.
|
^ Only valid for "nodebox" drawtype with 'type = "leveled"'.
|
||||||
^ Don't forget to use "leveled" type nodebox. ]]
|
^ Allows defining the nodebox height without using param2.
|
||||||
|
^ The nodebox height is 'leveled' / 64 nodes.
|
||||||
|
^ The maximum value of 'leveled' is 127. ]]
|
||||||
liquid_range = 8, -- number of flowing nodes around source (max. 8)
|
liquid_range = 8, -- number of flowing nodes around source (max. 8)
|
||||||
drowning = 0, -- Player will take this amount of damage if no bubbles are left
|
drowning = 0, -- Player will take this amount of damage if no bubbles are left
|
||||||
light_source = 0, --[[
|
light_source = 0, --[[
|
||||||
|
@ -250,9 +250,8 @@ void transformNodeBox(const MapNode &n, const NodeBox &nodebox,
|
|||||||
u8 axisdir = facedir>>2;
|
u8 axisdir = facedir>>2;
|
||||||
facedir&=0x03;
|
facedir&=0x03;
|
||||||
for (aabb3f box : fixed) {
|
for (aabb3f box : fixed) {
|
||||||
if (nodebox.type == NODEBOX_LEVELED) {
|
if (nodebox.type == NODEBOX_LEVELED)
|
||||||
box.MaxEdge.Y = -BS/2 + BS*((float)1/LEVELED_MAX) * n.getLevel(nodemgr);
|
box.MaxEdge.Y = (-0.5f + n.getLevel(nodemgr) / 64.0f) * BS;
|
||||||
}
|
|
||||||
|
|
||||||
switch (axisdir) {
|
switch (axisdir) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -102,8 +102,8 @@ enum Rotation {
|
|||||||
|
|
||||||
#define LIQUID_INFINITY_MASK 0x80 //0b10000000
|
#define LIQUID_INFINITY_MASK 0x80 //0b10000000
|
||||||
|
|
||||||
// mask for param2, now as for liquid
|
// mask for leveled nodebox param2
|
||||||
#define LEVELED_MASK 0x3F
|
#define LEVELED_MASK 0x7F
|
||||||
#define LEVELED_MAX LEVELED_MASK
|
#define LEVELED_MAX LEVELED_MASK
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user