From 2033a9bf1de2e46893b36c840d5d558d7067644f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 12 Jul 2021 16:07:20 +0200 Subject: [PATCH] Refactor potion arrow flight time calculation --- mods/ITEMS/mcl_potions/tipped_arrow.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_potions/tipped_arrow.lua b/mods/ITEMS/mcl_potions/tipped_arrow.lua index f71974b8..5dbb0de6 100644 --- a/mods/ITEMS/mcl_potions/tipped_arrow.lua +++ b/mods/ITEMS/mcl_potions/tipped_arrow.lua @@ -130,7 +130,7 @@ function mcl_potions.register_arrow(name, desc, color, def) end ARROW_ENTITY.on_step = function(self, 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 @@ -220,7 +220,7 @@ function mcl_potions.register_arrow(name, desc, color, def) 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 @@ -397,7 +397,7 @@ function mcl_potions.register_arrow(name, desc, color, def) 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