forked from VoxeLibre/VoxeLibre
drop items once beacon gets destroyed
This commit is contained in:
parent
f7028bc836
commit
9e6af33469
|
@ -112,6 +112,14 @@ minetest.register_node("mcl_beacons:beacon", {
|
||||||
local form = formspec_string
|
local form = formspec_string
|
||||||
meta:set_string("formspec", form)
|
meta:set_string("formspec", form)
|
||||||
end,
|
end,
|
||||||
|
on_destruct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local input = meta:get_inventory():get_stack("input",1)
|
||||||
|
if not input:is_empty() then
|
||||||
|
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} --from mcl_anvils
|
||||||
|
minetest.add_item(p, input)
|
||||||
|
end
|
||||||
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then
|
if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then
|
||||||
local sender_name = sender:get_player_name()
|
local sender_name = sender:get_player_name()
|
||||||
|
|
Loading…
Reference in New Issue