mirror of
https://notabug.org/TenPlus1/protector.git
synced 2024-12-14 09:29:29 +01:00
violation drop after delay to stop stack doubling
This commit is contained in:
parent
4e51158cdc
commit
82344b7a0d
16
init.lua
16
init.lua
@ -228,16 +228,18 @@ function minetest.is_protected(pos, digger)
|
|||||||
|
|
||||||
if holding:to_string() ~= "" then
|
if holding:to_string() ~= "" then
|
||||||
|
|
||||||
|
-- take stack
|
||||||
local sta = holding:take_item(holding:get_count())
|
local sta = holding:take_item(holding:get_count())
|
||||||
local obj = minetest.add_item(player:getpos(), sta)
|
player:set_wielded_item(holding)
|
||||||
|
|
||||||
if obj then
|
-- incase of lag, reset stack
|
||||||
obj:setvelocity({x = 0, y = 5, z = 0})
|
minetest.after(0.1, function()
|
||||||
player:set_wielded_item(holding)
|
player:set_wielded_item(holding)
|
||||||
minetest.after(0.2, function()
|
|
||||||
player:set_wielded_item(holding)
|
-- drop stack
|
||||||
end)
|
local obj = minetest.add_item(player:getpos(), sta)
|
||||||
end
|
obj:setvelocity({x = 0, y = 5, z = 0})
|
||||||
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user