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

@ -3627,10 +3627,10 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
// Compare core.item_place_node() for what the server does with param2
MapNode predicted_node(id, 0, 0);
const u8 place_param2 = selected_def.place_param2;
const auto place_param2 = selected_def.place_param2;
if (place_param2) {
predicted_node.setParam2(place_param2);
predicted_node.setParam2(*place_param2);
} else if (predicted_f.param_type_2 == CPT2_WALLMOUNTED ||
predicted_f.param_type_2 == CPT2_COLORED_WALLMOUNTED) {
v3s16 dir = nodepos - neighborpos;