96 lines
No EOL
3 KiB
Lua
96 lines
No EOL
3 KiB
Lua
local tardim = peripheral.find("digital_tardim_interface")
|
|
local screen = peripheral.find("monitor")
|
|
|
|
screen.clear()
|
|
screen.setCursorBlink(false)
|
|
screen.setTextScale(0.5)
|
|
|
|
-- 15x24
|
|
--[[
|
|
~ Current pos
|
|
X
|
|
Y
|
|
Z
|
|
Dimension
|
|
Facing
|
|
~ Destination
|
|
X
|
|
Y
|
|
Z
|
|
Dimension
|
|
Facing
|
|
~ Fuel
|
|
Remaining
|
|
Required
|
|
]]
|
|
|
|
-- This changes the colors to be like the gruvbox theme
|
|
local function set_colorscheme(screen)
|
|
screen.setPaletteColour(colours.red, 0xfb4934)
|
|
screen.setPaletteColour(colours.blue, 0x83a598)
|
|
screen.setPaletteColour(colours.green, 0xb8bb26)
|
|
screen.setPaletteColour(colours.purple, 0xd3869b)
|
|
screen.setPaletteColour(colours.cyan, 0x8ec07c)
|
|
|
|
screen.setPaletteColour(colours.white, 0xf9f5d7)
|
|
screen.setPaletteColour(colours.black, 0x1d2021)
|
|
end
|
|
|
|
local function dim_char(dimension_str)
|
|
|
|
if dimension_str == "minecraft:overworld" then
|
|
return "OWR"
|
|
elseif dimension_str == "minecraft:the_nether" then
|
|
return "NETH"
|
|
elseif dimension_str == "minecraft:the_end" then
|
|
return "END"
|
|
else
|
|
return "???"
|
|
end
|
|
|
|
end
|
|
|
|
local function drawPos(screen, pos, screen_y)
|
|
screen.setCursorPos(1, screen_y)
|
|
screen.blit("X: " .. pos.pos.x, "e" .. string.rep("0", #tostring(pos.pos.x) + 2), string.rep("f", #tostring(pos.pos.x) + 3))
|
|
screen.setCursorPos(1, screen_y + 1)
|
|
screen.blit("Y: " .. pos.pos.y, "d" .. string.rep("0", #tostring(pos.pos.y) + 2), string.rep("f", #tostring(pos.pos.y) + 3))
|
|
screen.setCursorPos(1, screen_y + 2)
|
|
screen.blit("Z: " .. pos.pos.z, "b" .. string.rep("0", #tostring(pos.pos.z) + 2), string.rep("f", #tostring(pos.pos.z) + 3))
|
|
screen.setCursorPos(1, screen_y + 3)
|
|
screen.write("Dimension: " .. dim_char(pos.dimension), "00000000000111", "ffffffffffffff")
|
|
screen.setCursorPos(1, screen_y + 4)
|
|
screen.write("Facing: " .. pos.facing)
|
|
end
|
|
|
|
set_colorscheme(screen)
|
|
screen.setCursorPos(1, 1)
|
|
screen.blit("> TARDIM NAV", "009999990999", "ffffffffffff")
|
|
|
|
while true do
|
|
screen.setCursorPos(1, 3)
|
|
|
|
local pos = tardim.getCurrentLocation()
|
|
screen.write("> Current pos")
|
|
drawPos(screen, pos, 4)
|
|
|
|
local dest = tardim.getTravelLocation()
|
|
screen.setCursorPos(1, 10)
|
|
screen.write("> Destination")
|
|
drawPos(screen, dest, 11)
|
|
|
|
local fuel = tardim.getFuel()
|
|
screen.setCursorPos(1, 17)
|
|
screen.write("> Fuel")
|
|
screen.setCursorPos(1, 18)
|
|
screen.write("REM.: " .. fuel .. "/100")
|
|
screen.setCursorPos(1, 19)
|
|
local Required = tardim.calculateFuelForJourney()
|
|
screen.write("REQ.: " .. Required)
|
|
screen.setCursorPos(1, 20)
|
|
screen.blit("ENOUGH: " .. (fuel >= Required and "YES" or "NO "), "00000000" .. (fuel >= Required and "ddd" or "eee"), "ffffffff" .. (fuel >= Required and "fff" or "fff"))
|
|
|
|
local inFlight = tardim.isInFlight()
|
|
screen.setCursorPos(1, 22)
|
|
screen.blit("IN FLIGHT: " .. (inFlight and "YES" or "NO "), "00000000000" .. (inFlight and "ddd" or "eef"), "fffffffffff" .. (inFlight and "fff" or "fff"))
|
|
end |