mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-04 16:53:46 +01:00
Fix damaging anvil too aggressively
parent
9277bf4552
commit
0b80b60cf1
@ -242,17 +242,18 @@ local anvildef = {
|
|||||||
end
|
end
|
||||||
update_anvil_slots(meta)
|
update_anvil_slots(meta)
|
||||||
|
|
||||||
local destroyed = damage_anvil(pos, player)
|
if from_list == "output" then
|
||||||
-- Close formspec if anvil was destroyed
|
local destroyed = damage_anvil(pos, player)
|
||||||
if destroyed then
|
-- Close formspec if anvil was destroyed
|
||||||
--[[ Closing the formspec w/ emptyformname is discouraged. But this is justified
|
if destroyed then
|
||||||
because node formspecs seem to only have an empty formname in MT 0.4.16.
|
--[[ Closing the formspec w/ emptyformname is discouraged. But this is justified
|
||||||
Also, sice this is on_metadata_inventory_take, we KNOW which formspec has
|
because node formspecs seem to only have an empty formname in MT 0.4.16.
|
||||||
been opened by the player. So this should be safe nonetheless.
|
Also, sice this is on_metadata_inventory_take, we KNOW which formspec has
|
||||||
TODO: Update this line when node formspecs get proper identifiers in Minetest. ]]
|
been opened by the player. So this should be safe nonetheless.
|
||||||
minetest.close_formspec(player:get_player_name(), "")
|
TODO: Update this line when node formspecs get proper identifiers in Minetest. ]]
|
||||||
|
minetest.close_formspec(player:get_player_name(), "")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -272,12 +273,13 @@ local anvildef = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
update_anvil_slots(meta)
|
update_anvil_slots(meta)
|
||||||
local destroyed = damage_anvil(pos, player)
|
if listname == "output" then
|
||||||
|
local destroyed = damage_anvil(pos, player)
|
||||||
-- Close formspec if anvil was destroyed
|
-- Close formspec if anvil was destroyed
|
||||||
if destroyed then
|
if destroyed then
|
||||||
-- See above for justification.
|
-- See above for justification.
|
||||||
minetest.close_formspec(player:get_player_name(), "")
|
minetest.close_formspec(player:get_player_name(), "")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user