don't crash when a node is not found

master
Rubberduck 2017-09-02 15:00:45 +02:00
parent b2c2993137
commit 761fa087cf
2 changed files with 87 additions and 79 deletions

View File

@ -460,7 +460,12 @@ minetest.register_craft({
function meseconductors:register_lamp(mod, node)
if minetest.get_modpath(mod) then
local node2 = node
if minetest.registered_nodes[mod ..":"..node] == nil then
print("[Meseconductors] - Warning: The mod " .. mod .." has no node ".. node .. " (anymore?)")
return false
end
local offstate = "meseconductors:"..mod.."_"..node .. "_off"
local onstate = "meseconductors:"..mod.."_"..node
@ -553,8 +558,6 @@ function meseconductors:register_lamp(mod, node)
minetest.swap_node(pos, {name = "meseconductors:"..mod.."_"..node2.."_off", param2 = node.param2})
end,
}}
--groups = {cracky=2,not_in_creative_inventory=1, mesecon = 2},
})
end
end

View File

@ -4,6 +4,11 @@ function meseconductors:register_wire_block(mod, node)
if minetest.get_modpath(mod) then
if minetest.registered_nodes[mod ..":"..node] == nil then
print("[Meseconductors] - Warning: The mod " .. mod .." has no node ".. node .. " (anymore?)")
return false
end
local offstate = "meseconductors:"..mod.."_"..node
local onstate = "meseconductors:"..mod.."_"..node.."_on"
local description = minetest.registered_nodes[mod ..":"..node].description .. " (conductable)"