initialize

This commit is contained in:
Andrew-71 2024-03-10 23:45:44 +03:00
commit 5b23ea99fd
43 changed files with 2336 additions and 0 deletions

96
TARDIM/NavDash.lua Normal file
View file

@ -0,0 +1,96 @@
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

85
TARDIM/NavDashTwo.lua Normal file
View file

@ -0,0 +1,85 @@
local tardim = peripheral.find("digital_tardim_interface")
local screen = peripheral.find("monitor")
-- This changes the colors to be like the gruvbox theme
local function SetColourscheme(screen, scheme)
local schemes = {
gruvbox = {
red = 0xfb4934,
blue = 0x83a598,
green = 0xb8bb26,
purple = 0xd3869b,
cyan = 0x8ec07c,
white = 0xf9f5d7,
black = 0x1d2021
},
starfield = {
red = 0xc72138,
blue = 0x304c7a,
yellow = 0xd7a64b,
white = 0xf4f5f7,
orange = 0xe06236,
black = 0x121212
}
}
for i, _ in pairs(schemes[scheme]) do
screen.setPaletteColour(colours[i], schemes[scheme][i])
end
end
local function DrawStripes(screen)
local stripes = {
[1] = 'b',
[2] = '4',
[3] = '1',
[4] = 'e'
}
local _, y = screen.getSize()
for h=1,y do
for w=1,4 do
screen.setCursorPos(w, h)
screen.blit(' ', '0', stripes[w])
end
end
end
local function DrawFuel(screen, fuel)
local bar_colours = {
[75] = 'd', -- green
[60] = '4', -- orange
[30] = '1', -- yellow
[1] = 'e' -- red
}
fuel = math.floor(fuel)
local col = bar_colours[1]
for i, _ in pairs(bar_colours) do
if fuel > i then
col = bar_colours[i]
break
end
end
local x, y = screen.getSize()
screen.setCursorPos(8, y - 2)
screen.write('FUEL - ' .. tostring(fuel))
screen.setCursorPos(8, y - 1)
screen.blit(string.rep(' ', x - 16), string.rep('8', x - 16), string.rep('8', x - 16))
screen.setCursorPos(8, y - 1)
screen.blit(string.rep(' ', x - 25), string.rep('8', x - 25), string.rep(col, x - 25))
end
SetColourscheme(screen, 'starfield')
screen.setCursorBlink(false)
screen.setTextScale(0.5)
screen.setTextColour(colours.black)
screen.setBackgroundColour(colours.white)
screen.clear()
DrawStripes(screen)
screen.setCursorPos(10, 5)
screen.write("Hello Universe!")
DrawFuel(screen, tardim.getFuel())