From efd0286fe30186fc0f6112365d3b4af2dd105751 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Wed, 22 Feb 2017 11:15:10 -0500 Subject: [PATCH] fix crash in is_stairsplus() call (wasn't detecting grey blocks correctly) --- init.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index c3e966c..b6f1e28 100644 --- a/init.lua +++ b/init.lua @@ -134,11 +134,15 @@ local function is_stairsplus(name) local h, s, v = unifieddyes.get_hsv(name) - a,b = string.find(name, "_"..h..s) - if a then s2 = string.sub(name, b+1) - if string.find(s2, "wood") then s2 = string.sub(s2, 5) end + a,b = string.find(name, "wood") + if b then + s2 = string.sub(name, b+1) + local a,b = string.find(name, "grey") + if not a then + a,b = string.find(name, "_"..h..s) + end + return s1, string.sub(s2, 5) end - return s1, s2 end -- the actual nodes! @@ -313,6 +317,8 @@ minetest.register_lbm({ if s1 then + if not s2 then print("impossible conversion request! name = "..node.name.." --> ".."coloredwood:"..s1.."_wood_"..hue.."*nil*") return end + local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, true) local cfdir = paletteidx + (node.param2 % 32) local newname = "coloredwood:"..s1.."_wood_"..hue..s2