fix naming

This commit is contained in:
Kindaglia 2025-04-25 10:12:45 +02:00
parent f5f27ef999
commit f651e407f7

View File

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