1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow place_param2 = 0 node placement predictions (#13787)

The placement prediction value 0 was accidentally ignored
and made the clients fall back to automatic rotation based
on the node paramtype2 value.

This now changes the internal representation to properly
indicate the disabled state (e.g. 'nil' in Lua).
This commit is contained in:
SmallJoker 2023-09-13 13:57:57 +02:00 committed by GitHub
parent 833c324498
commit 4ef93fe25f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 9 deletions

View file

@ -443,7 +443,8 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
default: {
// Render non-trivial drawtypes like the actual node
MapNode n(id);
n.setParam2(def.place_param2);
if (def.place_param2)
n.setParam2(*def.place_param2);
mesh = createSpecialNodeMesh(client, n, &m_colors, f);
changeToMesh(mesh);
@ -638,7 +639,8 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
default: {
// Render non-trivial drawtypes like the actual node
MapNode n(id);
n.setParam2(def.place_param2);
if (def.place_param2)
n.setParam2(*def.place_param2);
mesh = createSpecialNodeMesh(client, n, &result->buffer_colors, f);
scaleMesh(mesh, v3f(0.12, 0.12, 0.12));