Compare commits
No commits in common. "5898cc4e1c130363fe901a88add94c7ccdeae96f" and "e41dfb3344baad67da834c4ac442d8da6c470461" have entirely different histories.
5898cc4e1c
...
e41dfb3344
Binary file not shown.
@ -19,30 +19,12 @@ industrialtest.JetpackBase=table.copy(industrialtest.GearTool)
|
|||||||
industrialtest.internal.unpackTableInto(industrialtest.JetpackBase,{
|
industrialtest.internal.unpackTableInto(industrialtest.JetpackBase,{
|
||||||
part="torso"
|
part="torso"
|
||||||
})
|
})
|
||||||
local soundHandles = {}
|
|
||||||
|
|
||||||
function industrialtest.JetpackBase.update(self, player, inv, itemstack, dtime)
|
function industrialtest.JetpackBase.update(self,player,inv,itemstack,dtime)
|
||||||
local playerName = player:get_player_name()
|
local control=player:get_player_control()
|
||||||
local control = player:get_player_control()
|
|
||||||
if control.jump and self:tryFly(itemstack) then
|
if control.jump and self:tryFly(itemstack) then
|
||||||
self.addYVelocityClamped(player,1,10)
|
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
|
return true
|
||||||
else
|
|
||||||
if soundHandles[playerName] then
|
|
||||||
minetest.sound_stop(soundHandles[playerName])
|
|
||||||
soundHandles[playerName] = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user