From 98d76a8ea1e6073aeff6bd95b472c7203b6b13a9 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sat, 16 Nov 2013 17:38:46 -0500 Subject: [PATCH] fix crash when regular cubical leaves mode is enabled --- node_defs.lua | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/node_defs.lua b/node_defs.lua index dc51939..4a6a377 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -135,9 +135,9 @@ for i in ipairs(moretrees.treelist) do droprarity = 20 end - moretrees_render_inventory_image = nil + moretrees_leaves_inventory_image = nil if moretrees.plantlike_leaves then - moretrees_render_inventory_image = minetest.inventorycube + moretrees_leaves_inventory_image = minetest.inventorycube("moretrees_"..treename.."_leaves.png") end minetest.register_node("moretrees:"..treename.."_leaves", { @@ -145,7 +145,7 @@ for i in ipairs(moretrees.treelist) do drawtype = moretrees_new_leaves_drawtype, visual_scale = moretrees_new_leaves_visual_scale, tiles = { "moretrees_"..treename.."_leaves"..moretrees_new_leaves_extension }, - inventory_image = moretrees_render_inventory_image("moretrees_"..treename.."_leaves.png"), + inventory_image = moretrees_leaves_inventory_image, paramtype = "light", groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, sounds = default.node_sound_leaves_defaults(), @@ -347,12 +347,18 @@ local jungleleaves = {"green","yellow","red"} local jungleleavesnames = {"Green", "Yellow", "Red"} for color = 1, 3 do local leave_name = "moretrees:jungletree_leaves_"..jungleleaves[color] + + moretrees_leaves_inventory_image = nil + if moretrees.plantlike_leaves then + moretrees_leaves_inventory_image = minetest.inventorycube("moretrees_jungletree_leaves_"..jungleleaves[color]..".png") + end + minetest.register_node(leave_name, { description = "Jungle Tree Leaves ("..jungleleavesnames[color]..")", drawtype = moretrees_new_leaves_drawtype, visual_scale = moretrees_new_leaves_visual_scale, tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..moretrees_new_leaves_extension}, - inventory_image = moretrees_render_inventory_image("moretrees_jungletree_leaves_"..jungleleaves[color]..".png"), + inventory_image = moretrees_leaves_inventory_image, paramtype = "light", groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, drop = { @@ -368,12 +374,17 @@ end -- Extra needles for firs +moretrees_leaves_inventory_image = nil +if moretrees.plantlike_leaves then + moretrees_leaves_inventory_image = minetest.inventorycube("moretrees_fir_leaves_bright.png") +end + minetest.register_node("moretrees:fir_leaves_bright", { drawtype = moretrees_new_leaves_drawtype, visual_scale = moretrees_new_leaves_visual_scale, description = "Douglas Fir Leaves (Bright)", tiles = { "moretrees_fir_leaves_bright"..moretrees_new_leaves_extension }, - inventory_image = moretrees_render_inventory_image("moretrees_fir_leaves_bright.png"), + inventory_image = moretrees_leaves_inventory_image, paramtype = "light", groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1 }, drop = { -- 2.30.2