diff --git a/lib_planes/entities.lua b/lib_planes/entities.lua index 3952b63..a049f10 100644 --- a/lib_planes/entities.lua +++ b/lib_planes/entities.lua @@ -192,12 +192,17 @@ function airutils.logic(self) --if is_flying then minetest.chat_send_all('is flying') end local is_attached = airutils.checkAttach(self, player) + if self._indicated_speed == nil then self._indicated_speed = 0 end if not is_attached then -- for some engine error the player can be detached from the machine, so lets set him attached again airutils.checkattachBug(self) end + if self._custom_step_additional_function then + self._custom_step_additional_function(self) + end + if longit_speed == 0 and is_flying == false and is_attached == false and self._engine_running == false then return end @@ -450,10 +455,6 @@ function airutils.logic(self) self.object:set_bone_position("aileron.l", self._aileron_l_pos, {x=self._rudder_angle - 90,y=0,z=0}) end - if self._custom_step_additional_function then - self._custom_step_additional_function(self) - end - -- calculate energy consumption -- airutils.consumptionCalc(self, accel) diff --git a/lib_planes/gauges.lua b/lib_planes/gauges.lua index 778bcdc..f91198c 100644 --- a/lib_planes/gauges.lua +++ b/lib_planes/gauges.lua @@ -104,10 +104,29 @@ function airutils.plot_speed_gauge(self, scale, place_x, place_y) --local speed_angle = -(speed_percentage*350)/100 --minetest.chat_send_all(dump(fuel_angle)) - local fuel = "^[resize:"..scale.."x"..scale.."^[combine:"..bg_width_height.."x"..bg_width_height..":" + local speed = "^[resize:"..scale.."x"..scale.."^[combine:"..bg_width_height.."x"..bg_width_height..":" ..place_x..","..place_y.."=airutils_speed_gauge.png:" --fuel = fuel..get_pointer(speed_angle-180, gauge_center_x, gauge_center_y, 1) - return fuel + return speed +end + +function airutils.plot_power_gauge(self, scale, place_x, place_y) + local bg_width_height = 100 + local pointer_img = 8 + local gauge_center = (bg_width_height / 2) - (pointer_img/2) + local gauge_center_x = place_x + gauge_center + local gauge_center_y = place_y + gauge_center + + --local speed_percentage = (curr_level*100)/max_level + --local speed_angle = -(speed_percentage*350)/100 + --minetest.chat_send_all(dump(fuel_angle)) + + local rpm = "^[resize:"..scale.."x"..scale.."^[combine:"..bg_width_height.."x"..bg_width_height..":" + ..place_x..","..place_y.."=airutils_rpm_gauge.png:" + + --fuel = fuel..get_pointer(speed_angle-180, gauge_center_x, gauge_center_y, 1) + + return rpm end diff --git a/lib_planes/utilities.lua b/lib_planes/utilities.lua index ebb60ec..526077e 100644 --- a/lib_planes/utilities.lua +++ b/lib_planes/utilities.lua @@ -347,14 +347,16 @@ function airutils.testImpact(self, velocity, position) local player_name = self.driver_name --minetest.chat_send_all('damage: '.. damage .. ' - hp: ' .. self.hp_max) - if self.hp_max < 0 then --if acumulated damage is greater than 50, adieu - airutils.destroy(self, true) + if self.hp_max < 0 then --adieu + airutils.destroy(self, self._enable_explosion) end local player = minetest.get_player_by_name(player_name) if player then if player:get_hp() > 0 then - player:set_hp(player:get_hp()-(damage/2)) + local hurt_by_impact_divisor = 0.5 --less is more + if self.hp_max > 0 then hurt_by_impact = 2 end + player:set_hp(player:get_hp()-(damage/hurt_by_impact_divisor)) end end if self._passenger ~= nil then diff --git a/textures/airutils_climber_gauge.png b/textures/airutils_climber_gauge.png new file mode 100644 index 0000000..58eefa5 Binary files /dev/null and b/textures/airutils_climber_gauge.png differ diff --git a/textures/airutils_rpm_gauge.png b/textures/airutils_rpm_gauge.png new file mode 100644 index 0000000..40d68ea Binary files /dev/null and b/textures/airutils_rpm_gauge.png differ