mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Add new ContentParamType2 "CPT2_DEGROTATE"
This might break some mods, but it is important for all uses of the param2 to be documented. This doesn't need a serialisation version or network protocol version change, as old clients will still work on new servers, and it is bearable to have new clients getting non rotated plants on old servers.
This commit is contained in:
parent
5130dbce7b
commit
b0523adc5f
@ -538,6 +538,10 @@ 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's two less significant bits are rotation around the axis
|
facedir's two less significant bits are rotation around the axis
|
||||||
paramtype2 == "leveled"
|
paramtype2 == "leveled"
|
||||||
|
paramtype2 == "degrotate"
|
||||||
|
^ 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
|
||||||
|
get the actual rotation of the node.
|
||||||
collision_box = {
|
collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -1125,16 +1125,16 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||||||
video::S3DVertex( s,-BS/2 + s*2,0, 0,0,0, c, 1,0),
|
video::S3DVertex( s,-BS/2 + s*2,0, 0,0,0, c, 1,0),
|
||||||
video::S3DVertex(-s,-BS/2 + s*2,0, 0,0,0, c, 0,0),
|
video::S3DVertex(-s,-BS/2 + s*2,0, 0,0,0, c, 0,0),
|
||||||
};
|
};
|
||||||
|
float rotate_degree = 0;
|
||||||
|
if (f.param_type_2 == CPT2_DEGROTATE)
|
||||||
|
rotate_degree = n.param2 * 2;
|
||||||
|
|
||||||
if(j == 0)
|
if (j == 0) {
|
||||||
{
|
|
||||||
for(u16 i = 0; i < 4; i++)
|
for(u16 i = 0; i < 4; i++)
|
||||||
vertices[i].Pos.rotateXZBy(46 + n.param2 * 2);
|
vertices[i].Pos.rotateXZBy(46 + rotate_degree);
|
||||||
}
|
} else if (j == 1) {
|
||||||
else if(j == 1)
|
|
||||||
{
|
|
||||||
for(u16 i = 0; i < 4; i++)
|
for(u16 i = 0; i < 4; i++)
|
||||||
vertices[i].Pos.rotateXZBy(-44 + n.param2 * 2);
|
vertices[i].Pos.rotateXZBy(-44 + rotate_degree);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
|
@ -63,6 +63,8 @@ enum ContentParamType2
|
|||||||
CPT2_WALLMOUNTED,
|
CPT2_WALLMOUNTED,
|
||||||
// Block level like FLOWINGLIQUID
|
// Block level like FLOWINGLIQUID
|
||||||
CPT2_LEVELED,
|
CPT2_LEVELED,
|
||||||
|
// 2D rotation for things like plants
|
||||||
|
CPT2_DEGROTATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LiquidType
|
enum LiquidType
|
||||||
|
@ -57,6 +57,7 @@ struct EnumString ScriptApiNode::es_ContentParamType2[] =
|
|||||||
{CPT2_FACEDIR, "facedir"},
|
{CPT2_FACEDIR, "facedir"},
|
||||||
{CPT2_WALLMOUNTED, "wallmounted"},
|
{CPT2_WALLMOUNTED, "wallmounted"},
|
||||||
{CPT2_LEVELED, "leveled"},
|
{CPT2_LEVELED, "leveled"},
|
||||||
|
{CPT2_DEGROTATE, "degrotate"},
|
||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user