mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 09:31:07 +01:00
Shears selfdrop dead bush, tall grass, fern, vine, leaves
This commit is contained in:
parent
627d103b20
commit
54fb702c8f
5 changed files with 21 additions and 19 deletions
|
@ -217,6 +217,21 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
return
|
return
|
||||||
end
|
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
|
for _,item in ipairs(drops) do
|
||||||
local count, name
|
local count, name
|
||||||
if type(item) == "string" then
|
if type(item) == "string" then
|
||||||
|
|
|
@ -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},
|
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(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
drop = "",
|
drop = "",
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
_mcl_shears_drop = true,
|
||||||
local item = user:get_wielded_item()
|
|
||||||
if item:get_name() == "mcl_tools:shears" then
|
|
||||||
minetest.add_item(pos, oldnode.name)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
-- Restrict placement of vines
|
-- Restrict placement of vines
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
|
@ -98,6 +98,7 @@ minetest.register_node("mcl_core:deadbush", {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_mcl_shears_drop = true,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
|
|
@ -72,6 +72,7 @@ local register_leaves = function(subname, description, longdesc, tiles, drop1, d
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
|
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
|
||||||
drop = drop,
|
drop = drop,
|
||||||
|
_mcl_shears_drop = true,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
_mcl_blast_resistance = 1,
|
_mcl_blast_resistance = 1,
|
||||||
_mcl_hardness = 0.2,
|
_mcl_hardness = 0.2,
|
||||||
|
|
|
@ -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},
|
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(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
drop = wheat_seed_drop,
|
drop = wheat_seed_drop,
|
||||||
|
_mcl_shears_drop = true,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = on_place_flower,
|
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_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
})
|
})
|
||||||
|
@ -125,13 +120,8 @@ minetest.register_node("mcl_flowers:fern", {
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = on_place_flower,
|
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,
|
drop = wheat_seed_drop,
|
||||||
|
_mcl_shears_drop = true,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -4/16, -0.5, -4/16, 4/16, 7/16, 4/16 },
|
fixed = { -4/16, -0.5, -4/16, 4/16, 7/16, 4/16 },
|
||||||
|
|
Loading…
Reference in a new issue