Compare commits

..

No commits in common. "5898cc4e1c130363fe901a88add94c7ccdeae96f" and "e41dfb3344baad67da834c4ac442d8da6c470461" have entirely different histories.

2 changed files with 2 additions and 20 deletions

View File

@ -19,30 +19,12 @@ industrialtest.JetpackBase=table.copy(industrialtest.GearTool)
industrialtest.internal.unpackTableInto(industrialtest.JetpackBase,{
part="torso"
})
local soundHandles = {}
function industrialtest.JetpackBase.update(self, player, inv, itemstack, dtime)
local playerName = player:get_player_name()
local control = player:get_player_control()
function industrialtest.JetpackBase.update(self,player,inv,itemstack,dtime)
local control=player:get_player_control()
if control.jump and self:tryFly(itemstack) then
self.addYVelocityClamped(player,1,10)
if not soundHandles[playerName] then
local pos = player:get_pos()
local handle = minetest.sound_play("industrialtest_jetpack_loop", {
pos = pos,
gain = 1.0, -- Volume of the sound
max_hear_distance = 16, -- Maximum distance to hear the sound
object = player, -- Attach the sound to the player
loop = true, -- The sound is played in a loop
})
soundHandles[playerName] = handle
end
return true
else
if soundHandles[playerName] then
minetest.sound_stop(soundHandles[playerName])
soundHandles[playerName] = nil
end
end
return false
end