forked from MineClone5/MineClone5
Merge pull request 'Remove arrow entities when the player joins to prevent killing on startup (working fix)' (#74) from arrow_fix into master
Reviewed-on: MineClone5/MineClone5#74
This commit is contained in:
commit
31c2ec359a
|
@ -419,10 +419,6 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
self.object:set_rotation({ x = 0, y = yaw, z = pitch })
|
self.object:set_rotation({ x = 0, y = yaw, z = pitch })
|
||||||
end
|
end
|
||||||
|
|
||||||
if self._in_player and not self.object:get_attach() then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Update internal variable
|
-- Update internal variable
|
||||||
self._lastpos={x=pos.x, y=pos.y, z=pos.z}
|
self._lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||||
end
|
end
|
||||||
|
@ -457,11 +453,21 @@ function ARROW_ENTITY.get_staticdata(self)
|
||||||
return minetest.serialize(out)
|
return minetest.serialize(out)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function remove_arrow_on_joinplayer(staticdata, self)
|
||||||
|
if not staticdata.activated then
|
||||||
|
staticdata.activated = true
|
||||||
|
else
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ARROW_ENTITY.on_activate(self, staticdata, dtime_s)
|
function ARROW_ENTITY.on_activate(self, staticdata, dtime_s)
|
||||||
self._time_in_air = 1.0
|
self._time_in_air = 1.0
|
||||||
self._in_player = false
|
self._in_player = false
|
||||||
local data = minetest.deserialize(staticdata)
|
local data = minetest.deserialize(staticdata)
|
||||||
if data then
|
if data then
|
||||||
|
remove_arrow_on_joinplayer(data, self)
|
||||||
|
|
||||||
self._stuck = data.stuck
|
self._stuck = data.stuck
|
||||||
if data.stuck then
|
if data.stuck then
|
||||||
if data.stuckstarttime then
|
if data.stuckstarttime then
|
||||||
|
|
Loading…
Reference in New Issue