mirror of
https://github.com/pyrollo/display_modpack.git
synced 2024-12-04 03:53:49 +01:00
Add nil check for node def
This commit is contained in:
parent
4e9af449ff
commit
09974f0c90
@ -162,6 +162,9 @@ function display_api.update_entities(pos)
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local ndef = minetest.registered_nodes[node.name]
|
local ndef = minetest.registered_nodes[node.name]
|
||||||
local ov = get_orientation_values(node)
|
local ov = get_orientation_values(node)
|
||||||
|
if not ndef or not ov then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for _, objref in pairs(get_display_objrefs(pos, true)) do
|
for _, objref in pairs(get_display_objrefs(pos, true)) do
|
||||||
local edef = ndef.display_entities[objref:get_luaentity().name]
|
local edef = ndef.display_entities[objref:get_luaentity().name]
|
||||||
@ -283,6 +286,9 @@ end
|
|||||||
function display_api.on_rotate(pos, node, user, _, new_param2)
|
function display_api.on_rotate(pos, node, user, _, new_param2)
|
||||||
node.param2 = new_param2
|
node.param2 = new_param2
|
||||||
local ov = get_orientation_values(node)
|
local ov = get_orientation_values(node)
|
||||||
|
if not ov then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if ov.restricted or not display_api.is_rotation_restricted() then
|
if ov.restricted or not display_api.is_rotation_restricted() then
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
|
Loading…
Reference in New Issue
Block a user