small updates + elytraFly hud
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
_G.requireInjector(_ENV)
|
|
||||||
|
|
||||||
local Point = require('point')
|
local Point = require('point')
|
||||||
local Util = require('util')
|
local Util = require('util')
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ while true do
|
|||||||
return acc
|
return acc
|
||||||
end, { })
|
end, { })
|
||||||
|
|
||||||
Point.eachClosest(turtle.point, sensed, function(s)
|
Point.eachClosest(turtle.point, sensed, turtle.suckDownAt)
|
||||||
turtle.suckDownAt(s)
|
|
||||||
end)
|
|
||||||
|
|
||||||
os.sleep(5)
|
os.sleep(5)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -231,20 +231,13 @@ _G._debug('STORAGE: Forcing full refresh')
|
|||||||
return self:listItems(throttle)
|
return self:listItems(throttle)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Timer()
|
|
||||||
local ct = os.clock()
|
|
||||||
return function()
|
|
||||||
return os.clock() - ct
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- provide a consolidated list of items
|
-- provide a consolidated list of items
|
||||||
function Storage:listItems(throttle)
|
function Storage:listItems(throttle)
|
||||||
if not self.dirty then
|
if not self.dirty then
|
||||||
return self.cache
|
return self.cache
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = Timer()
|
local timer = Util.Timer()
|
||||||
local cache = { }
|
local cache = { }
|
||||||
throttle = throttle or Util.throttle()
|
throttle = throttle or Util.throttle()
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ if fs.exists('packages/milo/Milo.lua') then
|
|||||||
fs.delete('packages/milo/plugins/listing.lua')
|
fs.delete('packages/milo/plugins/listing.lua')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fs.delete('packages/milo/apis/milo.lua')
|
||||||
|
|
||||||
if device.workbench then
|
if device.workbench then
|
||||||
shell.openForegroundTab('MiloLocal')
|
shell.openForegroundTab('MiloLocal')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
-- moved
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
-- credit: osmarks https://pastebin.com/ZP9Q1HCT
|
-- credit: osmarks https://pastebin.com/ZP9Q1HCT
|
||||||
|
|
||||||
local Sound = require('sound')
|
local Sound = require('sound')
|
||||||
|
local Util = require('util')
|
||||||
|
|
||||||
local modules = _G.peripheral.wrap('back')
|
local modules = _G.peripheral.wrap('back')
|
||||||
local os = _G.os
|
local os = _G.os
|
||||||
@@ -12,6 +13,30 @@ if not modules.launch or not modules.getMetaOwner then
|
|||||||
* Introspection module]])
|
* Introspection module]])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local canvas = modules.canvas and modules.canvas()
|
||||||
|
|
||||||
|
local function display(meta)
|
||||||
|
if canvas then
|
||||||
|
if not canvas.group then
|
||||||
|
canvas.group = canvas.addGroup({ 4, 90 })
|
||||||
|
canvas.bg = canvas.group.addRectangle(0, 0, 60, 24, 0x00000033)
|
||||||
|
canvas.pitch = canvas.group.addText({ 4, 5 }, '') -- , 0x202020FF)
|
||||||
|
canvas.pitch.setShadow(true)
|
||||||
|
canvas.pitch.setScale(.75)
|
||||||
|
end
|
||||||
|
canvas.pitch.setText(string.format('Pitch: %s\nMotion Y: %s',
|
||||||
|
math.floor(-meta.pitch),
|
||||||
|
Util.round(meta.motionY, 2)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function clearDisplay()
|
||||||
|
if canvas and canvas.group then
|
||||||
|
canvas.group.remove()
|
||||||
|
canvas.group = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function run()
|
local function run()
|
||||||
local launchCounter = 0
|
local launchCounter = 0
|
||||||
|
|
||||||
@@ -23,14 +48,17 @@ local function run()
|
|||||||
if meta.pitch < 0 then -- looking up
|
if meta.pitch < 0 then -- looking up
|
||||||
modules.launch(meta.yaw, meta.pitch, -meta.pitch / 22.5)
|
modules.launch(meta.yaw, meta.pitch, -meta.pitch / 22.5)
|
||||||
Sound.play('entity.bobber.throw', .6)
|
Sound.play('entity.bobber.throw', .6)
|
||||||
|
display(meta)
|
||||||
os.sleep(0.1)
|
os.sleep(0.1)
|
||||||
|
|
||||||
elseif meta.motionY < -0.5 then -- falling fast
|
elseif meta.motionY < -0.5 then -- falling fast
|
||||||
modules.launch(0, 270, -meta.motionY + 1)
|
modules.launch(0, 270, -meta.motionY + 1)
|
||||||
Sound.play('entity.bat.takeoff')
|
Sound.play('entity.bat.takeoff')
|
||||||
|
display(meta)
|
||||||
os.sleep(0)
|
os.sleep(0)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
display(meta)
|
||||||
os.sleep(0.1)
|
os.sleep(0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -53,6 +81,7 @@ local function run()
|
|||||||
os.sleep(0)
|
os.sleep(0)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
clearDisplay()
|
||||||
launchCounter = 0
|
launchCounter = 0
|
||||||
os.sleep(0.4)
|
os.sleep(0.4)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user