Fix error when removing doors with a chainsaw.

This commit is contained in:
Duane 2016-07-30 19:05:43 -05:00
parent 7b6de7195c
commit 9c121b4c09
2 changed files with 86 additions and 57 deletions

View file

@ -204,11 +204,7 @@ dofile(fun_caves.path .. "/fungal_tree.lua")
dofile(fun_caves.path .. "/wallhammer.lua")
dofile(fun_caves.path .. "/mapgen.lua")
dofile(fun_caves.path .. "/wooden_buckets.lua")
if minetest.get_modpath('tnt') then
dofile(fun_caves.path .. "/spec_bomb.lua")
end
dofile(fun_caves.path .. "/tools.lua")
dofile(fun_caves.path .. "/elixir.lua") -- must go after all items are registered
dofile(fun_caves.path .. "/chat.lua")

View file

@ -25,6 +25,7 @@ local function floor(pos, blocks, node_name, user_name)
end
if minetest.get_modpath('tnt') then
-- Floor bombs
local nodes = {{'default:sandstone', 'default:sandstone_block'}, {'default:wood', 'fun_caves:wood_block'}, {'default:stone', 'default:stone_block'},}
for _, node in pairs(nodes) do
@ -92,6 +93,7 @@ for _, node in pairs(nodes) do
}
})
end
end
local function power(player, pos, tool_type, max)
if not (player and pos and tool_type) then
@ -171,6 +173,10 @@ local function power(player, pos, tool_type, max)
diggable[data[ivm]] = diggable[data[ivm]] + minetest.get_item_group(names[data[ivm]], 'snappy') or 0
diggable[data[ivm]] = diggable[data[ivm]] + minetest.get_item_group(names[data[ivm]], 'fleshy') or 0
end
if names[data[ivm]] and names[data[ivm]]:find('^door') then
diggable[data[ivm]] = 0
end
end
if count < max_nodes and diggable[data[ivm]] > 0 and not minetest.is_protected(p, player_name) then
@ -392,3 +398,30 @@ minetest.register_craft({
{'', 'tnt:gunpowder', ''},
}
})
if false then
minetest.register_tool("fun_caves:destroyer", {
description = "Destroyer",
inventory_image = "default_torch_on_floor.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=80, maxlevel=2},
},
damage_groups = {fleshy=4},
},
on_use = function(itemstack, user, pointed_thing)
if not (user and pointed_thing and pointed_thing.above) then
return
end
local node = minetest.get_node_or_nil(pointed_thing.above)
if not node then
return
end
print(dump(node))
minetest.remove_node(pointed_thing.above)
end,
})
end