Avoid crash if place a stair like node on colored one of same categorie

This commit is contained in:
bri cassa 2021-07-18 21:02:35 +02:00
parent 2f211a6545
commit 46d347c00a
1 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,8 @@ stairsplus.rotate_node_aux = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local under_node = minetest.get_node(under)
local under_prefix = under_node and name_to_category(under_node.name)
-- NALC Addition to avoid coloredwood/unifiedbricks crash by Sys4
local under_pmod = string.sub(under_node.name, 1, string.find(under_node.name, ":")-1)
local same_cat = item_prefix == under_prefix
@ -65,7 +67,8 @@ stairsplus.rotate_node_aux = function(itemstack, placer, pointed_thing)
-- under node has a non-standard shape, so use the distance between under and above
local wallmounted = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.above, under))
if same_cat and not aux then
if same_cat and (under_pmod ~= "coloredwood" and under_pmod ~= "unifiedbricks")
and not aux then
p2 = under_node.param2
-- flip if placing above or below an upright or upside-down node
-- TODO should we also flip when placing next to a side-mounted node?