1
0
Fork 0

Tweak drop behavior of ocean plants

This commit is contained in:
Wuzzy 2019-12-18 03:10:49 +01:00
parent 40e681a566
commit 2e9efe51e8
3 changed files with 11 additions and 3 deletions

View File

@ -254,7 +254,13 @@ function minetest.handle_node_drops(pos, drops, digger)
local drop_item = ItemStack(item) local drop_item = ItemStack(item)
drop_item:set_count(1) drop_item:set_count(1)
for i=1,count do for i=1,count do
local obj = core.add_item(pos, drop_item) local dpos = table.copy(pos)
-- Apply offset for plantlike_rooted nodes because of their special shape
if nodedef and nodedef.drawtype == "plantlike_rooted" and nodedef.walkable then
dpos.y = dpos.y + 1
end
-- Spawn item and apply random speed
local obj = core.add_item(dpos, drop_item)
if obj ~= nil then if obj ~= nil then
local x = math.random(1, 5) local x = math.random(1, 5)
if math.random(1,2) == 1 then if math.random(1,2) == 1 then

View File

@ -80,6 +80,7 @@ minetest.register_craftitem("mcl_ocean:kelp", {
inventory_image = "mcl_ocean_kelp_item.png", inventory_image = "mcl_ocean_kelp_item.png",
wield_image = "mcl_ocean_kelp_item.png", wield_image = "mcl_ocean_kelp_item.png",
on_place = kelp_on_place, on_place = kelp_on_place,
groups = { deco_block = 1 },
}) })
-- Kelp nodes: kelp on a surface node -- Kelp nodes: kelp on a surface node

View File

@ -84,6 +84,7 @@ minetest.register_craftitem("mcl_ocean:seagrass", {
inventory_image = "mcl_ocean_seagrass.png^[verticalframe:12:0", inventory_image = "mcl_ocean_seagrass.png^[verticalframe:12:0",
wield_image = "mcl_ocean_seagrass.png^[verticalframe:12:0", wield_image = "mcl_ocean_seagrass.png^[verticalframe:12:0",
on_place = seagrass_on_place, on_place = seagrass_on_place,
groups = { deco_block = 1 },
}) })
-- Seagrass nodes: seagrass on a surface node -- Seagrass nodes: seagrass on a surface node
@ -120,7 +121,7 @@ for s=1, #surfaces do
{ -0.5, 0.5, -0.5, 0.5, 1.3, 0.5 }, { -0.5, 0.5, -0.5, 0.5, 1.3, 0.5 },
}, },
}, },
groups = { dig_immediate = 3, deco_block = 1, plant = 1, seagrass = 1, falling_node = surfaces[s][3] }, groups = { handy = 1, shearsy = 1, deco_block = 1, plant = 1, seagrass = 1, falling_node = surfaces[s][3] },
sounds = sounds, sounds = sounds,
node_dig_prediction = surfaces[s][2], node_dig_prediction = surfaces[s][2],
after_dig_node = function(pos) after_dig_node = function(pos)
@ -128,7 +129,7 @@ for s=1, #surfaces do
end, end,
drop = "", drop = "",
_mcl_falling_node_alternative = alt, _mcl_falling_node_alternative = alt,
_mcl_shears_drop = true, _mcl_shears_drop = { "mcl_ocean:seagrass" },
_mcl_hardness = 0, _mcl_hardness = 0,
_mcl_blast_resistance = 0, _mcl_blast_resistance = 0,
}) })