forked from hkc/cc-stuff
1
0
Fork 0
cc-stuff/augment/modules/hangglider_boost.lua

33 lines
1.1 KiB
Lua
Raw Normal View History

2023-10-13 13:45:25 +03:00
return function()
local sneakTicks = 0
local windowEvents = {nil, nil, nil}
local windowDuration = 20
local clockCounter = 0
while _G.player == nil do
os.sleep(0.05)
end
2023-10-13 13:45:25 +03:00
parallel.waitForAny(
function() while _G._running do
if player and windowEvents[3] ~= nil and windowEvents[3] + windowDuration >= clockCounter then
local mainHand = player.heldItem and player.heldItem.getMetadata().name
local offHand = player.offhandItem and player.offhandItem.getMetadata().name
2023-10-13 13:45:25 +03:00
if mainHand == "openblocks:hang_glider" or offHand == "openblocks:hang_glider" then
NI.launch(player.yaw, player.pitch, 4)
2023-10-13 13:45:25 +03:00
end
end
os.sleep(0.05)
end end,
function() while _G._running do
clockCounter = clockCounter + 1
if player.isSneaking then
2023-10-13 13:45:25 +03:00
sneakTicks = sneakTicks + 1
elseif sneakTicks ~= 0 then
windowEvents = {clockCounter, windowEvents[1], windowEvents[2]}
sneakTicks = 0
end
os.sleep(0.05)
end end)
end