Force stuck arrows to be rechecked after punch

This commit is contained in:
Wuzzy 2018-05-09 16:49:37 +02:00
parent b61576e529
commit e783ab17dc

View File

@ -81,6 +81,7 @@ local ARROW_ENTITY={
_shooter=nil, -- ObjectRef of player or mob who shot it _shooter=nil, -- ObjectRef of player or mob who shot it
} }
-- Destroy arrow entity self at pos and drops it as an item
local spawn_item = function(self, pos) local spawn_item = function(self, pos)
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
local item = minetest.add_item(pos, "mcl_bows:arrow") local item = minetest.add_item(pos, "mcl_bows:arrow")
@ -275,6 +276,14 @@ ARROW_ENTITY.on_step = function(self, dtime)
self._lastpos={x=pos.x, y=pos.y, z=pos.z} self._lastpos={x=pos.x, y=pos.y, z=pos.z}
end end
-- Force recheck of stuck arrows when punched.
-- Otherwise, punching has no effect.
ARROW_ENTITY.on_punch = function(self)
if self._stuck then
self._stuckrechecktimer = STUCK_RECHECK_TIME
end
end
ARROW_ENTITY.get_staticdata = function(self) ARROW_ENTITY.get_staticdata = function(self)
local out = { local out = {
lastpos = self._lastpos, lastpos = self._lastpos,