From 3a8475ea8ced1b566619541c0baf30c51a261e19 Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Fri, 27 Oct 2023 19:49:16 -0300 Subject: [PATCH] fix nan hp --- init.lua | 1 + lib_planes/entities.lua | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 7f35367..3e8ba40 100644 --- a/init.lua +++ b/init.lua @@ -107,6 +107,7 @@ end function airutils.setText(self, vehicle_name) local properties = self.object:get_properties() local formatted = "" + if type( self.hp_max ) != "number" then self.hp_max = 0.1 end --strange error when hpmax is NaN if self.hp_max then formatted = " Current hp: " .. string.format( "%.2f", self.hp_max diff --git a/lib_planes/entities.lua b/lib_planes/entities.lua index cbd7730..a32029e 100644 --- a/lib_planes/entities.lua +++ b/lib_planes/entities.lua @@ -110,7 +110,6 @@ function airutils.on_step(self,dtime,colinfo) local vel = self.object:get_velocity() local pos = self.object:get_pos() local props = self.object:get_properties() - if type( self.hp_max ) != "number" then self.hp_max = 0.1 end --strange error when hpmax is NaN -- handle visibility on radar if (pos and pos.y < airutils.radarMinHeight and props.show_on_minimap) then