fix crash when regular cubical leaves mode is enabled

This commit is contained in:
Vanessa Ezekowitz 2013-11-16 17:38:46 -05:00
parent 621dc7eb44
commit 98d76a8ea1

View File

@ -135,9 +135,9 @@ for i in ipairs(moretrees.treelist) do
droprarity = 20 droprarity = 20
end end
moretrees_render_inventory_image = nil moretrees_leaves_inventory_image = nil
if moretrees.plantlike_leaves then if moretrees.plantlike_leaves then
moretrees_render_inventory_image = minetest.inventorycube moretrees_leaves_inventory_image = minetest.inventorycube("moretrees_"..treename.."_leaves.png")
end end
minetest.register_node("moretrees:"..treename.."_leaves", { minetest.register_node("moretrees:"..treename.."_leaves", {
@ -145,7 +145,7 @@ for i in ipairs(moretrees.treelist) do
drawtype = moretrees_new_leaves_drawtype, drawtype = moretrees_new_leaves_drawtype,
visual_scale = moretrees_new_leaves_visual_scale, visual_scale = moretrees_new_leaves_visual_scale,
tiles = { "moretrees_"..treename.."_leaves"..moretrees_new_leaves_extension }, 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", paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
@ -347,12 +347,18 @@ local jungleleaves = {"green","yellow","red"}
local jungleleavesnames = {"Green", "Yellow", "Red"} local jungleleavesnames = {"Green", "Yellow", "Red"}
for color = 1, 3 do for color = 1, 3 do
local leave_name = "moretrees:jungletree_leaves_"..jungleleaves[color] 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, { minetest.register_node(leave_name, {
description = "Jungle Tree Leaves ("..jungleleavesnames[color]..")", description = "Jungle Tree Leaves ("..jungleleavesnames[color]..")",
drawtype = moretrees_new_leaves_drawtype, drawtype = moretrees_new_leaves_drawtype,
visual_scale = moretrees_new_leaves_visual_scale, visual_scale = moretrees_new_leaves_visual_scale,
tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..moretrees_new_leaves_extension}, 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", paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1},
drop = { drop = {
@ -368,12 +374,17 @@ end
-- Extra needles for firs -- 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", { minetest.register_node("moretrees:fir_leaves_bright", {
drawtype = moretrees_new_leaves_drawtype, drawtype = moretrees_new_leaves_drawtype,
visual_scale = moretrees_new_leaves_visual_scale, visual_scale = moretrees_new_leaves_visual_scale,
description = "Douglas Fir Leaves (Bright)", description = "Douglas Fir Leaves (Bright)",
tiles = { "moretrees_fir_leaves_bright"..moretrees_new_leaves_extension }, 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", paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1 }, groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1 },
drop = { drop = {