nodecore-cd2025/mods/nc_items/ent_falling.lua
Aaron Suen 21e8575465 Fix nc_items:stack vs group:is_stack_only usage
Now that there are multiple is_stack_only nodes, always use the
group where possible.
2022-10-26 08:14:52 -04:00

20 lines
713 B
Lua

-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore
= minetest, nodecore
-- LUALOCALS > ---------------------------------------------------------
local stacks_only = nodecore.group_expand("group:is_stack_only", true)
nodecore.register_falling_node_on_setnode(function(self, node, meta)
if not (node and stacks_only[node.name]) then return end
local stack = nodecore.stack_get_serial(meta)
if stack and not stack:is_empty() then
local pos = self.object:get_pos()
if not pos then return end
local ent = minetest.add_item(pos, stack)
if ent then ent:set_velocity(self.object:get_velocity()) end
self.object:remove()
return true
end
end)