forked from MineClone5/MineClone5
#361 Fix a crash in mcl_copper/functions.lua:71
This commit is contained in:
parent
eefaba3f49
commit
01b2f65309
|
@ -63,38 +63,40 @@ local function add_wear(placer, itemstack)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function anti_oxidation(itemstack, placer, pointed_thing)
|
local function anti_oxidation(itemstack, placer, pointed_thing)
|
||||||
|
local pointed_thing = pointed_thing
|
||||||
if pointed_thing.type ~= "node" then return end
|
if pointed_thing.type ~= "node" then return end
|
||||||
|
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local pointed_thing_under = pointed_thing.under
|
||||||
local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
local node = minetest.get_node(pointed_thing_under)
|
||||||
|
local node_def = minetest.registered_nodes[node.name]
|
||||||
|
if not node_def then return end
|
||||||
|
|
||||||
if not placer:get_player_control().sneak and noddef.on_rightclick then
|
if not placer:get_player_control().sneak and node_def.on_rightclick then
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
local placer_name = placer:get_player_name()
|
||||||
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
|
if minetest.is_protected(pointed_thing_under, placer_name) then
|
||||||
|
minetest.record_protection_violation(pointed_thing_under, placer_name)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
if noddef._mcl_stripped_variant == nil then
|
if not node_def._mcl_stripped_variant then
|
||||||
for _, c in pairs(stairs) do
|
for _, c in pairs(stairs) do
|
||||||
if noddef.name == "mcl_stairs:"..c[1].."_copper_"..c[2].."_cut"..c[3] then
|
if node_def.name == "mcl_stairs:"..c[1].."_copper_"..c[2].."_cut"..c[3] then
|
||||||
minetest.swap_node(pointed_thing.under, {name="mcl_stairs:"..c[1].."_copper_"..c[4], param2=node.param2})
|
minetest.swap_node(pointed_thing_under, {name="mcl_stairs:"..c[1].."_copper_"..c[4], param2=node.param2})
|
||||||
anti_oxidation_particles(pointed_thing)
|
anti_oxidation_particles(pointed_thing)
|
||||||
add_wear(placer, itemstack)
|
add_wear(placer, itemstack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if noddef._mcl_anti_oxidation_variant ~= nil then
|
if node_def._mcl_anti_oxidation_variant then
|
||||||
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_anti_oxidation_variant, param2=node.param2})
|
minetest.swap_node(pointed_thing_under, {name=node_def._mcl_anti_oxidation_variant, param2=node.param2})
|
||||||
anti_oxidation_particles(pointed_thing)
|
anti_oxidation_particles(pointed_thing)
|
||||||
add_wear(placer, itemstack)
|
add_wear(placer, itemstack)
|
||||||
end
|
end
|
||||||
elseif noddef._mcl_stripped_variant ~= nil then
|
elseif node_def._mcl_stripped_variant then
|
||||||
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
|
minetest.swap_node(pointed_thing_under, {name=node_def._mcl_stripped_variant, param2=node.param2})
|
||||||
add_wear(placer, itemstack)
|
add_wear(placer, itemstack)
|
||||||
else
|
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue