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) local oterm = term.redirect(activityTab.term.win)
activityTab.term.win.scrollBottom() activityTab.term.win.scrollBottom()
Util.print(...) Util.print(...)
_G._p = activityTab.term
term.redirect(oterm) term.redirect(oterm)
if activityTab.enabled then if activityTab.enabled then
activityTab:sync() activityTab:sync()

View File

@@ -2,7 +2,7 @@ local device = _G.device
if not device.neuralInterface then if not device.neuralInterface then
error('Missing neural interface') error('Missing neural interface')
elseif device.neuralInterface.getEquipment then elseif not device.neuralInterface.getEquipment then
error('Missing kinetic augment') error('Missing kinetic augment')
else else
device.neuralInterface.getEquipment().drop(6) 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 modules = _G.peripheral.wrap('back')
local os = _G.os 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 while true do
local meta = get_meta() local meta = modules.getMetaOwner()
if not meta.isSneaking then if not meta.isSneaking and meta.isElytraFlying then
local power = 4
if meta.isElytraFlying or meta.isFlying then power = 1 end
while not meta.isSneaking and meta.isFlying or meta.isElytraFlying do if meta.pitch < 0 then -- looking up
meta = get_meta() modules.launch(meta.yaw, meta.pitch, -meta.pitch / 22.5)
if meta.pitch < 0 then --Sound.play('entity.bobber.throw')
modules.launch(meta.yaw, meta.pitch, power)
end
os.sleep(0.1)
end
if not meta.isSneaking then elseif meta.motionY < -0.5 then -- falling fast
if meta.motionY < -0.8 then modules.launch(0, 270, 2)
modules.launch(0, 270, power / 2) Sound.play('entity.bat.takeoff')
end
end 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 end
os.sleep(0.4)
end end

View File

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