forked from hkc/cc-stuff
hangglider_boost: use global variables available to all modules
This commit is contained in:
parent
317930d80f
commit
e8e980cbae
|
@ -1,27 +1,27 @@
|
||||||
return function()
|
return function()
|
||||||
local ni = peripheral.wrap("back")
|
|
||||||
|
|
||||||
local sneakTicks = 0
|
local sneakTicks = 0
|
||||||
local meta = nil
|
|
||||||
local windowEvents = {nil, nil, nil}
|
local windowEvents = {nil, nil, nil}
|
||||||
local windowDuration = 20
|
local windowDuration = 20
|
||||||
local clockCounter = 0
|
local clockCounter = 0
|
||||||
|
|
||||||
|
while _G.player == nil do
|
||||||
|
os.sleep(0.05)
|
||||||
|
end
|
||||||
|
|
||||||
parallel.waitForAny(
|
parallel.waitForAny(
|
||||||
function() while _G._running do
|
function() while _G._running do
|
||||||
if meta and windowEvents[3] ~= nil and windowEvents[3] + windowDuration >= clockCounter then
|
if player and windowEvents[3] ~= nil and windowEvents[3] + windowDuration >= clockCounter then
|
||||||
local mainHand = meta.heldItem and meta.heldItem.getMetadata().name
|
local mainHand = player.heldItem and player.heldItem.getMetadata().name
|
||||||
local offHand = meta.offhandItem and meta.offhandItem.getMetadata().name
|
local offHand = player.offhandItem and player.offhandItem.getMetadata().name
|
||||||
if mainHand == "openblocks:hang_glider" or offHand == "openblocks:hang_glider" then
|
if mainHand == "openblocks:hang_glider" or offHand == "openblocks:hang_glider" then
|
||||||
ni.launch(meta.yaw, meta.pitch, 4)
|
NI.launch(player.yaw, player.pitch, 4)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
os.sleep(0.05)
|
os.sleep(0.05)
|
||||||
end end,
|
end end,
|
||||||
function() while _G._running do
|
function() while _G._running do
|
||||||
meta = ni.getMetaOwner()
|
|
||||||
clockCounter = clockCounter + 1
|
clockCounter = clockCounter + 1
|
||||||
if meta.isSneaking then
|
if player.isSneaking then
|
||||||
sneakTicks = sneakTicks + 1
|
sneakTicks = sneakTicks + 1
|
||||||
elseif sneakTicks ~= 0 then
|
elseif sneakTicks ~= 0 then
|
||||||
windowEvents = {clockCounter, windowEvents[1], windowEvents[2]}
|
windowEvents = {clockCounter, windowEvents[1], windowEvents[2]}
|
||||||
|
|
Loading…
Reference in New Issue