Fix crash with vines

This commit is contained in:
Amaz 2018-07-31 11:30:53 +01:00 committed by MoNTE48
parent 95d0757658
commit 163214d264
1 changed files with 9 additions and 12 deletions

View File

@ -1010,7 +1010,6 @@ minetest.register_node("default:ladder", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
minetest.register_node("default:vine", { minetest.register_node("default:vine", {
description = "Vine", description = "Vine",
drawtype = "signlike", drawtype = "signlike",
@ -1030,27 +1029,25 @@ minetest.register_node("default:vine", {
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = "", drop = "",
after_dig_node = function(pos, oldnode, oldmetadata, user) after_dig_node = function(pos, oldnode, oldmetadata, user)
local item = user:get_wielded_item() local item = user:get_wielded_item()
if item:get_name() == "default:shears" then if item:get_name() == "default:shears" then
user:get_inventory():add_item("main", ItemStack(oldnode.name)) user:get_inventory():add_item("main", ItemStack(oldnode.name))
end end
local next_find = true local next_find = true
local ptr = 1 local down = 1
while next_find == true do while next_find == true do
local pos2 = {x=pos.x, y=pos.y-ptr, z=pos.z} local pos2 = {x = pos.x, y = pos.y - down, z = pos.z}
local node = minetest.env:get_node(pos2) local node = minetest.get_node(pos2)
if node.name == "default:vine" and check_attached_node(pos2, node) == false then if node.name == "default:vine" then
drop_attached_node(pos2) minetest.remove_node(pos2)
nodeupdate(pos2) down = down + 1
ptr = ptr + 1
else else
next_find = false next_find = false
end end
end end
end end,
}) })
minetest.register_node("default:cloud", { minetest.register_node("default:cloud", {
description = "Cloud", description = "Cloud",
tiles = {"default_cloud.png"}, tiles = {"default_cloud.png"},