node def nil check

master
Juraj Vajda 2018-12-08 09:39:45 -05:00
parent 327544ba47
commit 5425e54ab2
1 changed files with 4 additions and 3 deletions

View File

@ -1251,7 +1251,7 @@ minetest.register_node("basic_machines:mover", {
minetest.set_node(pos2, {name = node1.name})
-- add particles only when not too far
if vector.distance(pos1, pos2) <= 16 then
if def and vector.distance(pos1, pos2) <= 16 then
local texture = "default_dirt.png"
if type(def.tiles[1]) == "string" then
@ -1289,11 +1289,12 @@ minetest.register_node("basic_machines:mover", {
if dig then
minetest.check_for_falling(pos1)
end
local def = minetest.registered_nodes[node1.name]
minetest.set_node(pos1, {name = "air"})
-- add particles only when not too far
if vector.distance(pos1, pos2) <= 16 then
local def = minetest.registered_nodes[node1.name]
if def and vector.distance(pos1, pos2) <= 16 then
local texture = "default_dirt.png"
if type(def.tiles[1]) == "string" then