forked from Mineclonia/Mineclonia
Refactor regular arrow flight time calculation
This commit is contained in:
parent
c45c0df118
commit
99ebf08873
|
@ -136,7 +136,7 @@ end
|
|||
ARROW_ENTITY.on_step = function(self, dtime)
|
||||
mcl_burning.tick(self.object, dtime)
|
||||
|
||||
self._time_in_air = self._time_in_air + .001
|
||||
self._time_in_air = self._time_in_air + dtime
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
local dpos = table.copy(pos) -- digital pos
|
||||
|
@ -228,7 +228,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
|||
local obj = closest_object
|
||||
local is_player = obj:is_player()
|
||||
local lua = obj:get_luaentity()
|
||||
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
||||
if obj == self._shooter and self._time_in_air > 1 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
||||
if obj:get_hp() > 0 then
|
||||
-- Check if there is no solid node between arrow and object
|
||||
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
||||
|
@ -413,7 +413,7 @@ end
|
|||
|
||||
ARROW_ENTITY.on_activate = function(self, staticdata, dtime_s)
|
||||
local data = minetest.deserialize(staticdata)
|
||||
self._time_in_air = 1.0
|
||||
self._time_in_air = dtime_s
|
||||
if data then
|
||||
self._stuck = data.stuck
|
||||
if data.stuck then
|
||||
|
|
Loading…
Reference in New Issue