Optimize top snow level 8 rendering

This commit is contained in:
Wuzzy 2018-01-07 23:43:23 +01:00
parent c26c6e012b
commit dff88c70b3

View file

@ -879,7 +879,7 @@ for i=0,3 do
end end
for i=1,8 do for i=1,8 do
local id, desc, longdesc, usagehelp, help, walkable local id, desc, longdesc, usagehelp, help, walkable, drawtype, node_box
if i == 1 then if i == 1 then
id = "mcl_core:snow" id = "mcl_core:snow"
desc = "Top Snow" desc = "Top Snow"
@ -894,6 +894,13 @@ for i=1,8 do
end end
walkable = true walkable = true
end end
if i ~= 8 then
drawtype = "nodebox"
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.5 + (2*i)/16, 0.5 },
}
end
local on_place = function(itemstack, placer, pointed_thing) local on_place = function(itemstack, placer, pointed_thing)
-- Placement is only allowed on top of solid blocks -- Placement is only allowed on top of solid blocks
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
@ -962,7 +969,7 @@ for i=1,8 do
sunlight_propagates = true, sunlight_propagates = true,
buildable_to = true, buildable_to = true,
node_placement_prediction = "", -- to prevent client flickering when stacking snow node_placement_prediction = "", -- to prevent client flickering when stacking snow
drawtype = "nodebox", drawtype = drawtype,
stack_max = 64, stack_max = 64,
walkable = walkable, walkable = walkable,
floodable = true, floodable = true,
@ -971,12 +978,7 @@ for i=1,8 do
local node = minetest.get_node(npos) local node = minetest.get_node(npos)
mcl_core.clear_snow_dirt(npos, node) mcl_core.clear_snow_dirt(npos, node)
end, end,
node_box = { node_box = node_box,
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+(i*2)/16, 0.5},
},
},
groups = {shovely=1, attached_node=1,deco_block=1, dig_by_piston=1, snow_cover=1, top_snow=i}, groups = {shovely=1, attached_node=1,deco_block=1, dig_by_piston=1, snow_cover=1, top_snow=i},
sounds = mcl_sounds.node_sound_snow_defaults(), sounds = mcl_sounds.node_sound_snow_defaults(),
on_construct = mcl_core.on_snow_construct, on_construct = mcl_core.on_snow_construct,