mirror of
https://github.com/Splizard/minetest-mod-snow.git
synced 2024-12-28 07:30:17 +01:00
Fix a bug when trying to place snow on an unknown node.
This commit is contained in:
parent
2c83d5ed76
commit
b2663d0ae3
13
init.lua
13
init.lua
@ -81,9 +81,11 @@ end
|
||||
--This function places snow checking at the same time for snow level and increasing as needed.
|
||||
--This also takes into account sourrounding snow and makes snow even.
|
||||
function snow.place(pos)
|
||||
local node = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
local node = minetest.get_node(pos)
|
||||
local drawtype = minetest.registered_nodes[node.name].drawtype
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
local drawtype = ""
|
||||
if node and minetest.registered_nodes[node.name] then
|
||||
drawtype = minetest.registered_nodes[node.name].drawtype
|
||||
end
|
||||
|
||||
local bnode = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
if node.name == "default:snow" and minetest.get_node_level(pos) < 63 then
|
||||
@ -124,7 +126,10 @@ snow.is_uneven = function(pos)
|
||||
for z=-1,1 do
|
||||
local node = get_node({x=pos.x+x,y=pos.y,z=pos.z+z})
|
||||
local bnode = get_node({x=pos.x+x,y=pos.y-1,z=pos.z+z})
|
||||
local drawtype = minetest.registered_nodes[node.name].drawtype
|
||||
local drawtype
|
||||
if node and minetest.registered_nodes[node.name] then
|
||||
drawtype = minetest.registered_nodes[node.name].drawtype
|
||||
end
|
||||
|
||||
if drawtype == "plantlike" then
|
||||
if bnode.name == "default:dirt_with_grass" then
|
||||
|
Loading…
Reference in New Issue
Block a user