better flying

This commit is contained in:
kepler155c@gmail.com
2019-02-14 11:06:54 -05:00
parent 68997b28a0
commit 152bb35cde
4 changed files with 24 additions and 27 deletions

View File

@@ -326,7 +326,6 @@ Nodes : %d
local oterm = term.redirect(activityTab.term.win)
activityTab.term.win.scrollBottom()
Util.print(...)
_G._p = activityTab.term
term.redirect(oterm)
if activityTab.enabled then
activityTab:sync()

View File

@@ -2,7 +2,7 @@ local device = _G.device
if not device.neuralInterface then
error('Missing neural interface')
elseif device.neuralInterface.getEquipment then
elseif not device.neuralInterface.getEquipment then
error('Missing kinetic augment')
else
device.neuralInterface.getEquipment().drop(6)

View File

@@ -1,33 +1,31 @@
-- credit: osmarks https://pastebin.com/ZP9Q1HCT
local Sound = require('sound')
local modules = _G.peripheral.wrap('back')
local os = _G.os
print('Based on code from osmarks')
print('https://pastebin.com/ZP9Q1HCT')
local function get_meta()
return modules.getMetaOwner()
end
while true do
local meta = get_meta()
if not meta.isSneaking then
local power = 4
if meta.isElytraFlying or meta.isFlying then power = 1 end
local meta = modules.getMetaOwner()
if not meta.isSneaking and meta.isElytraFlying then
while not meta.isSneaking and meta.isFlying or meta.isElytraFlying do
meta = get_meta()
if meta.pitch < 0 then
modules.launch(meta.yaw, meta.pitch, power)
end
os.sleep(0.1)
end
if meta.pitch < 0 then -- looking up
modules.launch(meta.yaw, meta.pitch, -meta.pitch / 22.5)
--Sound.play('entity.bobber.throw')
if not meta.isSneaking then
if meta.motionY < -0.8 then
modules.launch(0, 270, power / 2)
end
elseif meta.motionY < -0.5 then -- falling fast
modules.launch(0, 270, 2)
Sound.play('entity.bat.takeoff')
end
os.sleep(0.1)
elseif not meta.isSneaking and meta.motionY < -0.8 then
print('fallling...')
modules.launch(0, 270, 2)
Sound.play('entity.bat.takeoff')
os.sleep(0.1)
else
os.sleep(0.4)
end
os.sleep(0.4)
end

View File

@@ -105,7 +105,7 @@ local function handleTransaction(transaction)
local uid = math.random()
print(string.format('requesting %d of %s', count, t.itemId))
os.queueEvent('shop_provide', t.itemId, count, uid)
local timerId = os.startTimer(5)
local timerId = os.startTimer(60)
while true do
local e, p1, p2 = os.pullEvent()
if e == 'timer' and p1 == timerId then