Fixes for colorwallmounted and colorfacedir nodes
authorDániel Juhász <juhdanad@gmail.com>
Sat, 18 Feb 2017 19:26:19 +0000 (20:26 +0100)
committerparamat <mat.gregory@virginmedia.com>
Sat, 18 Feb 2017 22:47:24 +0000 (22:47 +0000)
Correct node placement prediction for attached colorwallmounted nodes.
Correct placement direction for colorfacedir and colorwallmounted nodes.
Correct detatch mechanism for attached colorwallmounted nodes.

builtin/game/falling.lua
builtin/game/item.lua
src/game.cpp

index 39a74008cdd2b2e972fdc76b6da3f940b9256a95..5ef5289be7a1d04534ef8d566ce1c978be244b3b 100644 (file)
@@ -134,7 +134,8 @@ end
 function builtin_shared.check_attached_node(p, n)
        local def = core.registered_nodes[n.name]
        local d = {x = 0, y = 0, z = 0}
-       if def.paramtype2 == "wallmounted" then
+       if def.paramtype2 == "wallmounted" or
+                       def.paramtype2 == "colorwallmounted" then
                -- The fallback vector here is in case 'wallmounted to dir' is nil due
                -- to voxelmanip placing a wallmounted node without resetting a
                -- pre-existing param2 value that is out-of-range for wallmounted.
index a8dc51d6183791181a81f1126cf42433246b1722..38ef1714f12917a17cffe0ab626042e197b42000 100644 (file)
@@ -262,7 +262,8 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
        -- Calculate direction for wall mounted stuff like torches and signs
        if def.place_param2 ~= nil then
                newnode.param2 = def.place_param2
-       elseif def.paramtype2 == 'wallmounted' and not param2 then
+       elseif (def.paramtype2 == 'wallmounted' or
+                       def.paramtype2 == 'colorwallmounted') and not param2 then
                local dir = {
                        x = under.x - above.x,
                        y = under.y - above.y,
@@ -270,7 +271,8 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
                }
                newnode.param2 = core.dir_to_wallmounted(dir)
        -- Calculate the direction for furnaces and chests and stuff
-       elseif def.paramtype2 == 'facedir' and not param2 then
+       elseif (def.paramtype2 == 'facedir' or
+                       def.paramtype2 == 'colorfacedir') and not param2 then
                local placer_pos = placer:getpos()
                if placer_pos then
                        local dir = {
index 1735737dece8d0ca16e5ff666d1842fb754d5a37..55b2ccec9d8d3df487ea4ed388ccadf4f5a2fe6e 100644 (file)
@@ -884,7 +884,8 @@ bool nodePlacementPrediction(Client &client,
                        };
                        v3s16 pp;
 
-                       if (nodedef->get(id).param_type_2 == CPT2_WALLMOUNTED)
+                       if (nodedef->get(id).param_type_2 == CPT2_WALLMOUNTED ||
+                                       nodedef->get(id).param_type_2 == CPT2_COLORED_WALLMOUNTED)
                                pp = p + wallmounted_dirs[param2];
                        else
                                pp = p + v3s16(0, -1, 0);