Falling nodes dig hand-diggables, not displace

Having a piece of gravel fall onto a sedge and have it
move the sedge over intact was immersion-breaking
and "cheaty" as it allowed players to move things that
normally they would have to mature in-place, harvest,
and then replant.
This commit is contained in:
Aaron Suen 2022-10-28 19:52:33 -04:00
parent 7336c042a9
commit 945b07739f

View File

@ -1,6 +1,6 @@
-- LUALOCALS < ---------------------------------------------------------
local ipairs, minetest, nodecore, pairs, vector
= ipairs, minetest, nodecore, pairs, vector
local ItemStack, ipairs, minetest, nodecore, pairs, vector
= ItemStack, ipairs, minetest, nodecore, pairs, vector
-- LUALOCALS > ---------------------------------------------------------
nodecore.register_falling_node_step,
@ -19,10 +19,14 @@ local data_load, data_save = nodecore.entity_staticdata_helpers({
setvel = true
})
local hand = ItemStack("")
local function displace_check(pos)
local node = minetest.get_node(pos)
local def = minetest.registered_nodes[node.name]
if def and def.buildable_to then return end
if def and def.diggable and nodecore.tool_digs(hand, def.groups) then
minetest.dig_node(pos)
end
for rel in nodecore.settlescan() do
local p = vector.add(pos, rel)
if nodecore.buildable_to(p) then