diff --git a/sounds/collision.ogg b/sounds/trike_collision.ogg similarity index 100% rename from sounds/collision.ogg rename to sounds/trike_collision.ogg diff --git a/sounds/engine.ogg b/sounds/trike_engine.ogg similarity index 100% rename from sounds/engine.ogg rename to sounds/trike_engine.ogg diff --git a/sounds/trike_touch.ogg b/sounds/trike_touch.ogg new file mode 100644 index 0000000..90d35c4 Binary files /dev/null and b/sounds/trike_touch.ogg differ diff --git a/trike_control.lua b/trike_control.lua index 8321c8d..18fe52a 100644 --- a/trike_control.lua +++ b/trike_control.lua @@ -46,7 +46,7 @@ function trike.control(self, dtime, hull_direction, longit_speed, elseif self._engine_running == false and self._energy > 0 then self._engine_running = true -- sound and animation - self.sound_handle = minetest.sound_play({name = "engine"}, + self.sound_handle = minetest.sound_play({name = "trike_engine"}, {object = self.object, gain = 2.0, pitch = 0.5 + ((self._power_lever/100)/2),max_hear_distance = 32, loop = true,}) @@ -75,7 +75,7 @@ function trike.control(self, dtime, hull_direction, longit_speed, --sound if self.sound_handle then minetest.sound_stop(self.sound_handle) - self.sound_handle = minetest.sound_play({name = "engine"}, + self.sound_handle = minetest.sound_play({name = "trike_engine"}, {object = self.object, gain = 2.0, pitch = 0.5 + ((self._power_lever/100)/2),max_hear_distance = 32, loop = true,}) @@ -104,7 +104,7 @@ function trike.control(self, dtime, hull_direction, longit_speed, else --sound minetest.sound_stop(self.sound_handle) - self.sound_handle = minetest.sound_play({name = "engine"}, + self.sound_handle = minetest.sound_play({name = "trike_engine"}, {object = self.object, gain = 2.0, pitch = 0.5 + ((self._power_lever/100)/2), max_hear_distance = 32, loop = true,}) diff --git a/trike_entities.lua b/trike_entities.lua index 4942795..27f28dd 100644 --- a/trike_entities.lua +++ b/trike_entities.lua @@ -334,7 +334,7 @@ minetest.register_entity("trike:trike", { --airutils.hurt(self,toolcaps.damage_groups.fleshy - 1) --airutils.make_sound(self,'hit') self.hp_max = self.hp_max - 10 - minetest.sound_play("collision", { + minetest.sound_play("trike_collision", { object = self.object, max_hear_distance = 5, gain = 1.0, diff --git a/trike_utilities.lua b/trike_utilities.lua index c8f9f8e..488f69e 100644 --- a/trike_utilities.lua +++ b/trike_utilities.lua @@ -216,13 +216,27 @@ function trike.testImpact(self, velocity) end end + if impact > 0.5 and self._longit_speed > 2 then + local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=-0.1})) + if (noded and noded.drawtype ~= 'airlike') then + minetest.sound_play("trike_touch", { + --to_player = self.driver_name, + object = self.object, + max_hear_distance = 15, + gain = 1.0, + fade = 0.0, + pitch = 1.0, + }, true) + end + end + if collision then --self.object:set_velocity({x=0,y=0,z=0}) local damage = impact / 2 self.hp_max = self.hp_max - damage --subtract the impact value directly to hp meter if self.driver_name then - minetest.sound_play("collision", { + minetest.sound_play("trike_collision", { to_player = self.driver_name, --pos = curr_pos, --max_hear_distance = 5, @@ -399,10 +413,12 @@ function trike.flightstep(self) if self.isinliquid then self._engine_running = false end - --[[if player then - trike.attach(self, player) - end]]-- - self.object:set_acceleration(new_accel) + --added accell check to avoid mercurio server problem + if new_accel then + if new_accel.x ~= nil and new_accel.y ~= nil and new_accel.z ~= nil then + self.object:set_acceleration(new_accel) + end + end -- end lift --adjust wing pitch (3d model)