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:
est31 2015-10-02 23:36:28 +02:00
parent 5130dbce7b
commit b0523adc5f
4 changed files with 58 additions and 51 deletions

View File

@ -538,6 +538,10 @@ node definition:
0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y-
facedir's two less significant bits are rotation around the axis
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 = {
type = "fixed",
fixed = {

View File

@ -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, 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++)
vertices[i].Pos.rotateXZBy(46 + n.param2 * 2);
}
else if(j == 1)
{
vertices[i].Pos.rotateXZBy(46 + rotate_degree);
} else if (j == 1) {
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++)

View File

@ -63,6 +63,8 @@ enum ContentParamType2
CPT2_WALLMOUNTED,
// Block level like FLOWINGLIQUID
CPT2_LEVELED,
// 2D rotation for things like plants
CPT2_DEGROTATE,
};
enum LiquidType

View File

@ -57,6 +57,7 @@ struct EnumString ScriptApiNode::es_ContentParamType2[] =
{CPT2_FACEDIR, "facedir"},
{CPT2_WALLMOUNTED, "wallmounted"},
{CPT2_LEVELED, "leveled"},
{CPT2_DEGROTATE, "degrotate"},
{0, NULL},
};