diff --git a/lib_planes/entities.lua b/lib_planes/entities.lua index e4e2b08..c28092c 100644 --- a/lib_planes/entities.lua +++ b/lib_planes/entities.lua @@ -86,6 +86,8 @@ function airutils.on_activate(self, staticdata, dtime_s) self._passengers = {} if not self._vehicle_custom_data then self._vehicle_custom_data = {} end --initialize when it does not exists + if self._flap then airutils.flap_on(self) end + airutils.setText(self, self.infotext) end @@ -244,6 +246,13 @@ function airutils.logic(self) self._custom_step_additional_function(self) end + if self._wing_configuration == self._wing_angle_of_attack and self._flap then + airutils.flap_on(self) + end + if self._wing_configuration ~= self._wing_angle_of_attack and self._flap == false then + airutils.flap_off(self) + end + if longit_speed == 0 and is_flying == false and is_attached == false and self._engine_running == false then return end @@ -497,13 +506,6 @@ function airutils.logic(self) self.object:set_rotation({x=newpitch,y=newyaw,z=newroll}) --end - if self._wing_configuration == self._wing_angle_of_attack and self._flap then - airutils.flap_on(self) - end - if self._wing_configuration ~= self._wing_angle_of_attack and self._flap == false then - airutils.flap_off(self) - end - if longit_speed > self._max_speed and self._flap == true then if is_attached and self.driver_name then minetest.chat_send_player(self.driver_name, core.colorize('#ff0000', " >>> Flaps retracted due for overspeed")) diff --git a/lib_planes/utilities.lua b/lib_planes/utilities.lua index 7c5959e..bf88528 100644 --- a/lib_planes/utilities.lua +++ b/lib_planes/utilities.lua @@ -307,6 +307,26 @@ function airutils.testImpact(self, velocity, position) end end + if self._last_water_touch == nil then self._last_water_touch = 3 end + if self._last_water_touch <= 3 then self._last_water_touch = self._last_water_touch + self.dtime end + if impact > 0.2 and self._longit_speed > 0.6 and self._last_water_touch >=3 then + self._last_water_touch = 0 + local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=touch_point})) + if (noded and noded.drawtype ~= 'airlike') then + if noded.drawtype == 'liquid' then + minetest.sound_play("airutils_touch_water", { + --to_player = self.driver_name, + object = self.object, + max_hear_distance = 15, + gain = 1.0, + fade = 0.0, + pitch = 1.0, + }, true) + return + end + end + end + if vertical_impact > 0.5 and self._longit_speed > self._min_speed/2 then local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=touch_point})) if (noded and noded.drawtype ~= 'airlike') then diff --git a/sounds/airutils_touch_water.ogg b/sounds/airutils_touch_water.ogg new file mode 100644 index 0000000..a3bb33f Binary files /dev/null and b/sounds/airutils_touch_water.ogg differ