1
0
Fork 0

Shears selfdrop dead bush, tall grass, fern, vine, leaves

This commit is contained in:
Wuzzy 2017-08-03 02:27:55 +02:00
parent 627d103b20
commit 54fb702c8f
5 changed files with 21 additions and 19 deletions

View File

@ -217,6 +217,21 @@ function minetest.handle_node_drops(pos, drops, digger)
return
end
--[[ Special node drops when dug by shears by reading _mcl_shears_drop
from the node definition.
Definition of _mcl_shears_drop:
* true: Drop itself when dug by shears
* table: Drop every itemstring in this table when dub by shears
]]
local nodedef = minetest.registered_nodes[dug_node.name]
if toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then
if nodedef._mcl_shears_drop == true then
drops = { dug_node.name }
else
drops = nodedef._mcl_shears_drop
end
end
for _,item in ipairs(drops) do
local count, name
if type(item) == "string" then

View File

@ -95,12 +95,7 @@ minetest.register_node("mcl_core:vine", {
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,destroy_by_lava_flow=1,dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = "",
after_dig_node = function(pos, oldnode, oldmetadata, user)
local item = user:get_wielded_item()
if item:get_name() == "mcl_tools:shears" then
minetest.add_item(pos, oldnode.name)
end
end,
_mcl_shears_drop = true,
node_placement_prediction = "",
-- Restrict placement of vines
on_place = function(itemstack, placer, pointed_thing)

View File

@ -98,6 +98,7 @@ minetest.register_node("mcl_core:deadbush", {
},
}
},
_mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",

View File

@ -72,6 +72,7 @@ local register_leaves = function(subname, description, longdesc, tiles, drop1, d
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = drop,
_mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,

View File

@ -95,14 +95,9 @@ minetest.register_node("mcl_flowers:tallgrass", {
groups = {dig_immediate=3, flammable=3,attached_node=1,plant=1,place_flowerlike=1,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = wheat_seed_drop,
_mcl_shears_drop = true,
node_placement_prediction = "",
on_place = on_place_flower,
after_dig_node = function(pos, oldnode, oldmetadata, user)
local item = user:get_wielded_item()
if item:get_name() == "mcl_tools:shears" then
minetest.add_item(pos, oldnode.name)
end
end,
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
@ -125,13 +120,8 @@ minetest.register_node("mcl_flowers:fern", {
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
on_place = on_place_flower,
after_dig_node = function(pos, oldnode, oldmetadata, user)
local item = user:get_wielded_item()
if item:get_name() == "mcl_tools:shears" then
minetest.add_item(pos, oldnode.name)
end
end,
drop = wheat_seed_drop,
_mcl_shears_drop = true,
selection_box = {
type = "fixed",
fixed = { -4/16, -0.5, -4/16, 4/16, 7/16, 4/16 },