launch control for elytraFly + mirror fixes
This commit is contained in:
@@ -8,11 +8,13 @@ local parallel = _G.parallel
|
||||
|
||||
if not modules.launch or not modules.getMetaOwner then
|
||||
error([[Required:
|
||||
* kinetic augment is required')
|
||||
* error('introspection module is required]])
|
||||
* Kinetic augment
|
||||
* Introspection module]])
|
||||
end
|
||||
|
||||
local function run()
|
||||
local launchCounter = 0
|
||||
|
||||
while true do
|
||||
local meta = modules.getMetaOwner()
|
||||
|
||||
@@ -20,21 +22,38 @@ local function run()
|
||||
|
||||
if meta.pitch < 0 then -- looking up
|
||||
modules.launch(meta.yaw, meta.pitch, -meta.pitch / 22.5)
|
||||
Sound.play('entity.bobber.throw')
|
||||
Sound.play('entity.bobber.throw', .6)
|
||||
os.sleep(0.1)
|
||||
|
||||
elseif meta.motionY < -0.5 then -- falling fast
|
||||
modules.launch(0, 270, 2)
|
||||
modules.launch(0, 270, -meta.motionY + 1)
|
||||
Sound.play('entity.bat.takeoff')
|
||||
os.sleep(0)
|
||||
|
||||
else
|
||||
os.sleep(0.1)
|
||||
end
|
||||
|
||||
elseif meta.isSneaking and not meta.isElytraFlying and meta.pitch == -90 then
|
||||
if launchCounter < 2 then
|
||||
launchCounter = launchCounter + 1
|
||||
Sound.play('block.note.pling', .5)
|
||||
os.sleep(0.5)
|
||||
|
||||
else
|
||||
Sound.play('entity.bobber.throw', 1)
|
||||
modules.launch(0, 270, 4)
|
||||
os.sleep(0.2)
|
||||
end
|
||||
os.sleep(0.1)
|
||||
|
||||
elseif not meta.isSneaking and meta.motionY < -0.8 then
|
||||
print('falling...')
|
||||
modules.launch(0, 270, 2)
|
||||
modules.launch(0, 270, -meta.motionY + 1)
|
||||
Sound.play('entity.bat.takeoff')
|
||||
os.sleep(0.1)
|
||||
os.sleep(0)
|
||||
|
||||
else
|
||||
launchCounter = 0
|
||||
os.sleep(0.4)
|
||||
end
|
||||
end
|
||||
@@ -42,14 +61,17 @@ end
|
||||
|
||||
parallel.waitForAny(
|
||||
function()
|
||||
print('press any key to exit')
|
||||
print('\nFlight control initialized')
|
||||
print('\nSneak and look straight up for launch')
|
||||
print('\nPress any key to exit')
|
||||
os.pullEvent('char')
|
||||
end,
|
||||
function()
|
||||
while true do
|
||||
print('Starting')
|
||||
local s, m = pcall(run)
|
||||
print(m)
|
||||
local _, m = pcall(run)
|
||||
if m then
|
||||
print(m)
|
||||
end
|
||||
print('Waiting for 5 seconds before restarting')
|
||||
os.sleep(5)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user