mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-10 09:09:43 +01:00
Give arrows a maximum lifetime to prevent them from getting stuck in mid-air forever
This commit is contained in:
parent
20e228bcac
commit
4dec7e1ce5
1 changed files with 7 additions and 1 deletions
|
@ -124,7 +124,7 @@ local arrow_entity = {
|
||||||
_fire_damage_resistant = true,
|
_fire_damage_resistant = true,
|
||||||
|
|
||||||
_save_fields = {
|
_save_fields = {
|
||||||
"last_pos", "startpos", "damage", "is_critical", "stuck", "stuckin", "stuckin_player",
|
"last_pos", "startpos", "damage", "is_critical", "stuck", "stuckin", "stuckin_player", "time_in_air",
|
||||||
},
|
},
|
||||||
|
|
||||||
_startpos=nil,
|
_startpos=nil,
|
||||||
|
@ -307,6 +307,12 @@ local arrow_entity = {
|
||||||
|
|
||||||
self._time_in_air = self._time_in_air + dtime
|
self._time_in_air = self._time_in_air + dtime
|
||||||
|
|
||||||
|
-- Give the arrows a maximum flight time
|
||||||
|
if self._time_in_air > ARROW_TIMEOUT then
|
||||||
|
self._removed = true
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
--local dpos = vector.round(vector.new(pos)) -- digital pos
|
--local dpos = vector.round(vector.new(pos)) -- digital pos
|
||||||
--local node = minetest.get_node(dpos)
|
--local node = minetest.get_node(dpos)
|
||||||
|
|
Loading…
Reference in a new issue