mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-09-09 07:09:48 -04:00
Renaming global variables
Removing unnecessary `require(...)`s
This commit is contained in:
parent
03d355dfe6
commit
8fdf6b73e8
@ -1,8 +1,3 @@
|
||||
component = require("component")
|
||||
term = require("term")
|
||||
computer = require("computer")
|
||||
event = require("event")
|
||||
|
||||
local AR = {}
|
||||
|
||||
local terminal = {x = 8257, y = 199, z = -2731}
|
||||
|
@ -1,8 +1,6 @@
|
||||
component = require("component")
|
||||
term = require("term")
|
||||
computer = require("computer")
|
||||
event = require("event")
|
||||
thread = require("thread")
|
||||
get = require("easy")
|
||||
ARG = require("ARGraphics")
|
||||
colors = require("colors")
|
||||
|
@ -1,5 +1,3 @@
|
||||
component = require("component")
|
||||
colors = require("colors")
|
||||
local graphics = {}
|
||||
|
||||
function graphics.pixel(GPU, x, y, color)
|
||||
@ -66,10 +64,10 @@ function graphics.centeredText(GPU, x, y, color, string)
|
||||
end
|
||||
|
||||
function graphics.border(GPU, w, h, color)
|
||||
draw.rectangle(GPU, 1, 1, w, 1, color)
|
||||
draw.rectangle(GPU, 1, h * 2, w, 1, color)
|
||||
draw.rectangle(GPU, 1, 1, 1, h * 2, color)
|
||||
draw.rectangle(GPU, w, 1, 1, h * 2, color)
|
||||
graphics.rectangle(GPU, 1, 1, w, 1, color)
|
||||
graphics.rectangle(GPU, 1, h * 2, w, 1, color)
|
||||
graphics.rectangle(GPU, 1, 1, 1, h * 2, color)
|
||||
graphics.rectangle(GPU, w, 1, 1, h * 2, color)
|
||||
end
|
||||
graphics.currentWindows = {}
|
||||
function graphics.checkCollision(GPU, x, y)
|
||||
|
@ -1,10 +1,9 @@
|
||||
local draw = require("graphics")
|
||||
graphics = require("graphics")
|
||||
event = require("event")
|
||||
local thread = require("thread")
|
||||
local uc = require("unicode")
|
||||
component = require("component")
|
||||
GPU = component.proxy(component.get("f26678f4"))
|
||||
local colors = require("colors")
|
||||
colors = require("colors")
|
||||
|
||||
local gui, quit, editing = {}, false, false
|
||||
local currentWindows = {}
|
||||
@ -38,9 +37,9 @@ gui.contextMenu = function(GPU, x, y, data)
|
||||
end
|
||||
local contextWindow = gui.createWindow(GPU, longestData, #data * 2, "ContextMenu" .. contextMenus)
|
||||
GPU.setActiveBuffer(contextWindow)
|
||||
draw.rectangle(GPU, 1, 1, longestData, #data * 2, colors.lightGray)
|
||||
graphics.rectangle(GPU, 1, 1, longestData, #data * 2, colors.lightGray)
|
||||
for i = 1, #data do
|
||||
draw.text(GPU, 1, 1 + i * 2 - 2, colors.cyan, data[i])
|
||||
graphics.text(GPU, 1, 1 + i * 2 - 2, colors.cyan, data[i])
|
||||
end
|
||||
currentWindows["ContextMenu" .. contextMenus].x = x
|
||||
currentWindows["ContextMenu" .. contextMenus].y = y
|
||||
@ -73,13 +72,13 @@ gui.processCommand = function(GPU, window, option)
|
||||
end
|
||||
GPU.setActiveBuffer(currentWindows["ColorBox"].page)
|
||||
if option == 1 then
|
||||
draw.rectangle(GPU, 1, 1, 10, 10, colors.red)
|
||||
graphics.rectangle(GPU, 1, 1, 10, 10, colors.red)
|
||||
end
|
||||
if option == 2 then
|
||||
draw.rectangle(GPU, 1, 1, 10, 10, colors.blue)
|
||||
graphics.rectangle(GPU, 1, 1, 10, 10, colors.blue)
|
||||
end
|
||||
if option == 3 then
|
||||
draw.rectangle(GPU, 1, 1, 10, 10, colors.green)
|
||||
graphics.rectangle(GPU, 1, 1, 10, 10, colors.green)
|
||||
end
|
||||
GPU.setActiveBuffer(0)
|
||||
end
|
||||
@ -88,7 +87,7 @@ local i, xOffset, yOffset = 1, 0, 0
|
||||
gui.mouseListener = function()
|
||||
local function processClick(event, address, x, y, key, player)
|
||||
activeWindow = gui.checkCollision(x, y)
|
||||
draw.text(GPU, 1, 1, colors.cyan, "Active window: " .. activeWindow)
|
||||
graphics.text(GPU, 1, 1, colors.cyan, "Active window: " .. activeWindow)
|
||||
if key == 1.0 and editing then
|
||||
if inContextMenu then
|
||||
contextMenus = 0
|
||||
@ -172,13 +171,13 @@ GPU.freeAllBuffers()
|
||||
keyInput, mouseInput, drag = gui.keyboardListener(), gui.mouseListener(), gui.dragListener()
|
||||
gui.createWindow(GPU, 160, 100, "Black")
|
||||
GPU.setActiveBuffer(currentWindows["Black"].page)
|
||||
draw.rectangle(GPU, 1, 1, 160, 100, 0x000000)
|
||||
graphics.rectangle(GPU, 1, 1, 160, 100, 0x000000)
|
||||
currentWindows["Black"].w = 0
|
||||
currentWindows["Black"].h = 0
|
||||
GPU.setActiveBuffer(0)
|
||||
gui.createWindow(GPU, 160, 100, "State")
|
||||
GPU.setActiveBuffer(currentWindows["State"].page)
|
||||
draw.rectangle(GPU, 1, 1, 160, 100, 0x000000)
|
||||
graphics.rectangle(GPU, 1, 1, 160, 100, 0x000000)
|
||||
currentWindows["State"].w = 0
|
||||
currentWindows["State"].h = 0
|
||||
GPU.setActiveBuffer(0)
|
||||
|
@ -1,7 +1,3 @@
|
||||
component = require("component")
|
||||
term = require("term")
|
||||
computer = require("computer")
|
||||
event = require("event")
|
||||
graphics = require("graphics")
|
||||
util = require("utility")
|
||||
colors = require("colors")
|
||||
|
@ -1,7 +1,6 @@
|
||||
local comp = require("component")
|
||||
local event = require("event")
|
||||
local modem = comp.modem
|
||||
local screen = require("term")
|
||||
component = require("component")
|
||||
event = require("event")
|
||||
local modem = component.modem
|
||||
local util = require("utility")
|
||||
AR = require("AR")
|
||||
glasses = util.machine("3770e3f9")
|
||||
|
@ -1,14 +1,13 @@
|
||||
local comp = require("component")
|
||||
local event = require("event")
|
||||
local thread = require("thread")
|
||||
component = require("component")
|
||||
event = require("event")
|
||||
local uc = require("unicode")
|
||||
local utility = {}
|
||||
local modem = comp.modem
|
||||
local modem = component.modem
|
||||
|
||||
function utility.machine(address)
|
||||
machineAddress = comp.get(address)
|
||||
machineAddress = component.get(address)
|
||||
if (machineAddress ~= nil) then
|
||||
return comp.proxy(machineAddress)
|
||||
return component.proxy(machineAddress)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
@ -1,14 +1,10 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
screen = require("term")
|
||||
computer = require("computer")
|
||||
thread = require("thread")
|
||||
term = require("term")
|
||||
local AU = require("util")
|
||||
local AT = require("transport")
|
||||
local S = require("serialization")
|
||||
local uc = require("unicode")
|
||||
local D = require("dictionary")
|
||||
local network = comp.modem
|
||||
local network = component.modem
|
||||
local id, AD
|
||||
local function requestID()
|
||||
network.broadcast(100, "requestID")
|
||||
@ -103,10 +99,10 @@ local function processRecipe(recipe)
|
||||
os.sleep(0.2)
|
||||
end
|
||||
if not AD.controller.hasWork() then
|
||||
screen.write(" ... Error with starting assembly!")
|
||||
term.write(" ... Error with starting assembly!")
|
||||
network.broadcast(id, "jammed")
|
||||
else
|
||||
screen.write(" ... Assembly Started")
|
||||
term.write(" ... Assembly Started")
|
||||
while AD.controller.hasWork() do
|
||||
os.sleep(0.1)
|
||||
end
|
||||
@ -115,14 +111,14 @@ local function processRecipe(recipe)
|
||||
end
|
||||
end
|
||||
AT.clearAll(AD)
|
||||
screen.write(" ... finished task!\n")
|
||||
term.write(" ... finished task!\n")
|
||||
network.broadcast(id, "complete")
|
||||
end
|
||||
|
||||
local function processMessage(localAddress, remoteAddress, port, distance, type, eventType, value2, value3)
|
||||
if eventType == "startAssembly" then
|
||||
local recipe = S.unserialize(value2)
|
||||
screen.write("Starting assembly of " .. recipe.label)
|
||||
term.write("Starting assembly of " .. recipe.label)
|
||||
processRecipe(recipe)
|
||||
elseif eventType == "clear" then
|
||||
AT.clearAll(AD)
|
||||
@ -130,7 +126,7 @@ local function processMessage(localAddress, remoteAddress, port, distance, type,
|
||||
end
|
||||
|
||||
local function quit()
|
||||
screen.write("Quitting...")
|
||||
term.write("Quitting...")
|
||||
event.ignore("modem_message", processMessage)
|
||||
event.ignore("key_up", processKey)
|
||||
os.exit()
|
||||
|
@ -1,13 +1,10 @@
|
||||
comp = require("component")
|
||||
component = require("component")
|
||||
event = require("event")
|
||||
screen = require("term")
|
||||
computer = require("computer")
|
||||
thread = require("thread")
|
||||
uc = require("unicode")
|
||||
term = require("term")
|
||||
AU = require("util")
|
||||
local uc = require("unicode")
|
||||
local S = require("serialization")
|
||||
local D = require("dictionary")
|
||||
local network = comp.modem
|
||||
local network = component.modem
|
||||
local mainChannel = 100
|
||||
-- mainChannel = Main channel for bi-directional communication
|
||||
|
||||
@ -58,7 +55,7 @@ local function processMessage(type, localAddress, remoteAddress, port, distance,
|
||||
end
|
||||
|
||||
local function quit()
|
||||
screen.write("Quitting...")
|
||||
term.write("Quitting...")
|
||||
event.ignore("modem_message", processMessage)
|
||||
event.ignore("key_up", processKey)
|
||||
run = false
|
||||
@ -101,7 +98,7 @@ local function spairs(t, order)
|
||||
end
|
||||
end
|
||||
function matchRecipe(recipes)
|
||||
local items = comp.me_interface.getItemsInNetwork()
|
||||
local items = component.me_interface.getItemsInNetwork()
|
||||
local foundItems = {}
|
||||
if #items > 0 then
|
||||
for i = 1, #items, 1 do
|
||||
@ -164,10 +161,10 @@ local function scheduleTasks()
|
||||
if not contains(assemblyStatus, recipe.label) then
|
||||
local taskid = getFree()
|
||||
if taskid ~= nil then
|
||||
screen.write("Started assembly of " .. recipe.label .. " with AL #" .. taskid .. "\n")
|
||||
term.write("Started assembly of " .. recipe.label .. " with AL #" .. taskid .. "\n")
|
||||
startAssembly(taskid, recipe)
|
||||
else
|
||||
screen.write("No free assembly lines.\n")
|
||||
term.write("No free assembly lines.\n")
|
||||
end
|
||||
end
|
||||
return true
|
||||
@ -176,9 +173,9 @@ local function scheduleTasks()
|
||||
local taskid = getFree()
|
||||
if taskid ~= nil then
|
||||
startAssembly(taskid, recipe)
|
||||
screen.write("Started assembly of " .. recipe.label .. " with AL #" .. taskid .. "\n")
|
||||
term.write("Started assembly of " .. recipe.label .. " with AL #" .. taskid .. "\n")
|
||||
else
|
||||
screen.write("No free assembly lines.\n")
|
||||
term.write("No free assembly lines.\n")
|
||||
end
|
||||
craftable = craftable - 8
|
||||
end
|
||||
|
@ -1,8 +1,4 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
screen = require("term")
|
||||
computer = require("computer")
|
||||
thread = require("thread")
|
||||
component = require("component")
|
||||
|
||||
local transport = {}
|
||||
|
||||
@ -16,7 +12,7 @@ function transport.empty(transposer)
|
||||
transposer.transferItem(1, 0, 64, 2, 9)
|
||||
end
|
||||
function transport.clear(interface)
|
||||
interface.setInterfaceConfiguration(1, comp.database.address, 1, 0)
|
||||
interface.setInterfaceConfiguration(1, component.database.address, 1, 0)
|
||||
end
|
||||
function transport.check(transposer, item, amount)
|
||||
local itemstack = transposer.getStackInSlot(0, 1)
|
||||
|
@ -1,27 +1,25 @@
|
||||
comp = require("component")
|
||||
component = require("component")
|
||||
event = require("event")
|
||||
screen = require("term")
|
||||
computer = require("computer")
|
||||
thread = require("thread")
|
||||
term = require("term")
|
||||
|
||||
local assemblyUtil = {}
|
||||
|
||||
local function addEntries(file, prompt, amount, type)
|
||||
local a, b, c
|
||||
for i = 1, amount, 1 do
|
||||
screen.write(prompt .. " " .. i .. " ")
|
||||
term.write(prompt .. " " .. i .. " ")
|
||||
a, b, c = event.pull()
|
||||
while a ~= "component_added" do
|
||||
a, b, c = event.pull()
|
||||
os.sleep()
|
||||
end
|
||||
file:write(type .. i .. "," .. b .. "\n")
|
||||
screen.write(b .. "\n")
|
||||
term.write(b .. "\n")
|
||||
end
|
||||
end
|
||||
local function addAuxilary(file, proxy, type)
|
||||
if proxy == nil then
|
||||
screen.write("Cant find a valid " .. type .. "! Exiting...\n")
|
||||
term.write("Cant find a valid " .. type .. "! Exiting...\n")
|
||||
os.exit()
|
||||
else
|
||||
file:write(type .. "," .. proxy.address .. "\n")
|
||||
@ -41,9 +39,9 @@ local function split(s, sep)
|
||||
return fields
|
||||
end
|
||||
local function proxy(address)
|
||||
machineAddress = comp.get(address)
|
||||
machineAddress = component.get(address)
|
||||
if (machineAddress ~= nil) then
|
||||
return comp.proxy(machineAddress)
|
||||
return component.proxy(machineAddress)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@ -54,27 +52,27 @@ local function configureClient()
|
||||
addEntries(file, "Add fluid interface", 4, "fluid")
|
||||
addEntries(file, "Add item transposer", 15, "inputTransposer")
|
||||
addEntries(file, "Add fluid transposer", 4, "fluidTransposer")
|
||||
addAuxilary(file, comp.me_interface, "items")
|
||||
addAuxilary(file, comp.database, "database")
|
||||
addAuxilary(file, comp.gt_machine, "controller")
|
||||
addAuxilary(file, component.me_interface, "items")
|
||||
addAuxilary(file, component.database, "database")
|
||||
addAuxilary(file, component.gt_machine, "controller")
|
||||
end
|
||||
function assemblyUtil.buildClient()
|
||||
screen.write("Starting Assembly Line initalization...")
|
||||
term.write("Starting Assembly Line initalization...")
|
||||
local assemblyStructure = {}
|
||||
local file = io.open("addresses", "r")
|
||||
if file == nil then
|
||||
screen.write(" no address configuration found, configuring:\n")
|
||||
term.write(" no address configuration found, configuring:\n")
|
||||
configureClient()
|
||||
file = io.lines("addresses")
|
||||
else
|
||||
file = io.lines("addresses")
|
||||
end
|
||||
for line in file do
|
||||
screen.write(".")
|
||||
term.write(".")
|
||||
local tokens = split(line, ",")
|
||||
assemblyStructure[tokens[1]] = proxy(tokens[2])
|
||||
end
|
||||
screen.write("\n")
|
||||
term.write("\n")
|
||||
return assemblyStructure
|
||||
end
|
||||
local function voltageToTier(voltage)
|
||||
@ -142,7 +140,7 @@ local function addRecipe(recipelist, slot, source, sourceSide)
|
||||
end
|
||||
end
|
||||
function assemblyUtil.getRecipes(recipelist)
|
||||
for address, type in pairs(comp.list()) do
|
||||
for address, type in pairs(component.list()) do
|
||||
if type == "transposer" then
|
||||
local dataSource = proxy(address)
|
||||
for side = 0, 5 do
|
||||
|
@ -2,9 +2,7 @@ component = require("component")
|
||||
term = require("term")
|
||||
computer = require("computer")
|
||||
event = require("event")
|
||||
thread = require("thread")
|
||||
local sides = require("sides")
|
||||
ARG = require("ARGraphics")
|
||||
graphics = require("graphics")
|
||||
S = require("stockerUtil")
|
||||
local uc = require("unicode")
|
||||
|
@ -1,7 +1,4 @@
|
||||
component = require("component")
|
||||
term = require("term")
|
||||
computer = require("computer")
|
||||
ARG = require("ARGraphics")
|
||||
graphics = require("graphics")
|
||||
local tx = require("transforms")
|
||||
GPU = component.gpu
|
||||
|
@ -1,18 +1,16 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
component = require("component")
|
||||
AR = require("ARWidgets")
|
||||
ARG = require("ARGraphics")
|
||||
local wSampsa, hSampsa = 853, 473
|
||||
local powerHudX, powerHudY, powerHudW, powerHudH = 0, hSampsa - 24, wSampsa * 0.39 + 3, 14
|
||||
local glasses = comp.glasses
|
||||
local glasses = component.glasses
|
||||
glasses.removeAll()
|
||||
AR.minimapOverlay(glasses)
|
||||
AR.hudOverlayBase(glasses, 335, 449)
|
||||
AR.clear()
|
||||
AR.crossHair(glasses, 422, 231)
|
||||
screen.clear()
|
||||
term.clear()
|
||||
while true do
|
||||
AR.powerDisplay(glasses, comp.gt_machine, powerHudX, powerHudY, powerHudW, powerHudH)
|
||||
AR.powerDisplay(glasses, component.gt_machine, powerHudX, powerHudY, powerHudW, powerHudH)
|
||||
AR.fluidMonitor(
|
||||
glasses,
|
||||
795,
|
||||
|
@ -1,7 +1,6 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
component = require("component")
|
||||
AR = require("ARWidgets")
|
||||
|
||||
while true do
|
||||
AR.itemTicker(comp.glasses, 348, 0, 380)
|
||||
AR.itemTicker(component.glasses, 348, 0, 380)
|
||||
end
|
||||
|
@ -1,8 +1,7 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
component = require("component")
|
||||
AR = require("ARWidgets")
|
||||
|
||||
while true do
|
||||
AR.displayTPS(comp.glasses, 0, 0)
|
||||
AR.cpuMonitor(comp.glasses, 520, 449)
|
||||
AR.displayTPS(component.glasses, 0, 0)
|
||||
AR.cpuMonitor(component.glasses, 520, 449)
|
||||
end
|
||||
|
@ -1,50 +1,47 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
screen = require("term")
|
||||
computer = require("computer")
|
||||
thread = require("thread")
|
||||
component = require("component")
|
||||
term = require("term")
|
||||
|
||||
local GPU = comp.gpu
|
||||
local GPU = component.gpu
|
||||
GPU.setResolution(54, 26)
|
||||
function enableReactors()
|
||||
comp.redstone.setOutput(1, 15)
|
||||
local function enableReactors()
|
||||
component.redstone.setOutput(1, 15)
|
||||
end
|
||||
function disableReactors()
|
||||
comp.redstone.setOutput(1, 0)
|
||||
local function disableReactors()
|
||||
component.redstone.setOutput(1, 0)
|
||||
end
|
||||
|
||||
function checkHeatLevels()
|
||||
screen.setCursor(1, 1)
|
||||
local function checkHeatLevels()
|
||||
term.setCursor(1, 1)
|
||||
local i = 1
|
||||
for address, type in pairs(comp.list()) do
|
||||
for address, type in pairs(component.list()) do
|
||||
if type == "reactor_chamber" then
|
||||
screen.write("Reactor " .. i)
|
||||
term.write("Reactor " .. i)
|
||||
if i < 10 then
|
||||
screen.write(" ")
|
||||
term.write(" ")
|
||||
end
|
||||
local reactor = comp.proxy(address)
|
||||
local reactor = component.proxy(address)
|
||||
if reactor.getHeat() > 0 then
|
||||
GPU.setForeground(0xFF0000)
|
||||
screen.write(" REACTOR HEATING! SHUTTING DOWN")
|
||||
term.write(" REACTOR HEATING! SHUTTING DOWN")
|
||||
disableReactors()
|
||||
GPU.setForeground(0xFFFFFF)
|
||||
os.sleep(1)
|
||||
os.exit()
|
||||
else
|
||||
if reactor.getReactorEUOutput() > 0 then
|
||||
screen.write(" status: ")
|
||||
term.write(" status: ")
|
||||
GPU.setForeground(0x00FF00)
|
||||
screen.write("NOMINAL")
|
||||
term.write("NOMINAL")
|
||||
GPU.setForeground(0xFFFFFF)
|
||||
screen.write(" - Producing ")
|
||||
term.write(" - Producing ")
|
||||
GPU.setForeground(0xFF00FF)
|
||||
screen.write(math.floor(reactor.getReactorEUOutput()))
|
||||
term.write(math.floor(reactor.getReactorEUOutput()))
|
||||
GPU.setForeground(0xFFFFFF)
|
||||
screen.write(" EU/t\n")
|
||||
term.write(" EU/t\n")
|
||||
else
|
||||
screen.write(" status: ")
|
||||
term.write(" status: ")
|
||||
GPU.setForeground(0xFFFF00)
|
||||
screen.write("INACTIVE\n")
|
||||
term.write("INACTIVE\n")
|
||||
end
|
||||
end
|
||||
i = i + 1
|
||||
@ -53,7 +50,7 @@ function checkHeatLevels()
|
||||
end
|
||||
|
||||
enableReactors()
|
||||
screen.clear()
|
||||
term.clear()
|
||||
while true do
|
||||
checkHeatLevels()
|
||||
os.sleep(1)
|
||||
|
@ -7,13 +7,9 @@ destinations = {
|
||||
[6] = {name = "Test", id = 3004}
|
||||
}
|
||||
|
||||
local comp = require("component")
|
||||
local event = require("event")
|
||||
local screen = require("term")
|
||||
local computer = require("computer")
|
||||
local util = require("utility")
|
||||
local draw = require("graphics")
|
||||
local GPU = comp.gpu
|
||||
graphics = require("graphics")
|
||||
local GPU = component.gpu
|
||||
GPU.setResolution(80, 25)
|
||||
|
||||
local boundingBoxes = {}
|
||||
@ -21,15 +17,15 @@ function createDestination(x, y, index)
|
||||
local width, height = 18, 6
|
||||
local page = GPU.allocateBuffer(width, math.ceil(height / 2))
|
||||
GPU.setActiveBuffer(page)
|
||||
draw.rect(GPU, 1, 1, 18, 6, 0x111111)
|
||||
graphics.rectangle(GPU, 1, 1, 18, 6, 0x111111)
|
||||
local destinationColor = destinations[index].color or 0x0055FF
|
||||
draw.rect(GPU, 3, 3, 14, 2, 0x000000)
|
||||
draw.centeredText(GPU, 10, 3, destinationColor, destinations[index].name)
|
||||
graphics.rectangle(GPU, 3, 3, 14, 2, 0x000000)
|
||||
graphics.centeredText(GPU, 10, 3, destinationColor, destinations[index].name)
|
||||
windows[index] = {GPU = GPU, page = page, address = "", x = x, y = y, w = width, h = height}
|
||||
GPU.setActiveBuffer(0)
|
||||
end
|
||||
function setDestination(code)
|
||||
for address, type in pairs(comp.list()) do
|
||||
for address, type in pairs(component.list()) do
|
||||
if type == "ender_chest" then
|
||||
util.machine(address).setFrequency(code)
|
||||
end
|
||||
@ -39,12 +35,12 @@ function checkClick(_, address, x, y, button, name)
|
||||
for i = 1, #boundingBoxes, 1 do
|
||||
local xb, yb = boundingBoxes[i].x, math.ceil(boundingBoxes[i].y / 2)
|
||||
if x >= xb and x < xb + 21 and y >= yb and y < yb + 3 then
|
||||
draw.rect(GPU, boundingBoxes[i].x + 2, boundingBoxes[i].y + 2, 14, 2, 0x00CC00)
|
||||
graphics.rectangle(GPU, boundingBoxes[i].x + 2, boundingBoxes[i].y + 2, 14, 2, 0x00CC00)
|
||||
local destinationColor = destinations[i].color or 0x0055FF
|
||||
setDestination(destinations[i].id)
|
||||
draw.rect(GPU, 30, 43, 22, 2, 0x000000)
|
||||
draw.centeredText(GPU, 40, 43, destinationColor, destinations[i].name)
|
||||
event.timer(0.2, draw.update)
|
||||
graphics.rectangle(GPU, 30, 43, 22, 2, 0x000000)
|
||||
graphics.centeredText(GPU, 40, 43, destinationColor, destinations[i].name)
|
||||
event.timer(0.2, graphics.update)
|
||||
return i
|
||||
end
|
||||
end
|
||||
@ -53,7 +49,7 @@ function addBoundingBox(index)
|
||||
boundingBoxes[index] = {x = 2 + ((index - 1) % 5) * 20, y = 3 + math.floor((index - 1) / 4) * 8}
|
||||
end
|
||||
function getDestination()
|
||||
for address, type in pairs(comp.list()) do
|
||||
for address, type in pairs(component.list()) do
|
||||
if type == "ender_chest" then
|
||||
return util.machine(address).getFrequency()
|
||||
end
|
||||
@ -62,13 +58,13 @@ end
|
||||
event.listen("touch", checkClick)
|
||||
GPU.freeAllBuffers()
|
||||
GPU.fill(0, 0, 100, 100, " ")
|
||||
draw.rect(GPU, 28, 41, 26, 6, 0x111111)
|
||||
draw.rect(GPU, 30, 43, 22, 2, 0x000000)
|
||||
draw.text(GPU, 31, 39, 0xFFFFFF, "Current Destination")
|
||||
graphics.rectangle(GPU, 28, 41, 26, 6, 0x111111)
|
||||
graphics.rectangle(GPU, 30, 43, 22, 2, 0x000000)
|
||||
graphics.text(GPU, 31, 39, 0xFFFFFF, "Current Destination")
|
||||
for i = 1, #destinations, 1 do
|
||||
addBoundingBox(i)
|
||||
createDestination(boundingBoxes[i].x, boundingBoxes[i].y, i)
|
||||
draw.update()
|
||||
graphics.update()
|
||||
end
|
||||
while true do
|
||||
os.sleep()
|
||||
|
@ -1,15 +1,13 @@
|
||||
local comp = require("component")
|
||||
local event = require("event")
|
||||
local screen = require("term")
|
||||
local computer = require("computer")
|
||||
component = require("component")
|
||||
computer = require("computer")
|
||||
|
||||
function cycle()
|
||||
comp.redstone.setOutput(2, 15)
|
||||
component.redstone.setOutput(2, 15)
|
||||
os.sleep(1)
|
||||
comp.redstone.setOutput(2, 0)
|
||||
component.redstone.setOutput(2, 0)
|
||||
end
|
||||
|
||||
comp.gpu.setResolution(80, 40)
|
||||
component.gpu.setResolution(80, 40)
|
||||
|
||||
local incoming = 4
|
||||
local sending = 3
|
||||
@ -26,7 +24,7 @@ function setDestination(destination)
|
||||
end
|
||||
|
||||
function unload(index)
|
||||
local transposer = comp.transposer
|
||||
local transposer = component.transposer
|
||||
if transposer.getStackInSlot(controller, 1) ~= nil then
|
||||
--Using a return ticket
|
||||
cycle()
|
||||
@ -55,11 +53,11 @@ function copyWindow(GPU, x, y, page, destination)
|
||||
end
|
||||
windows = {}
|
||||
function doStartupSequence()
|
||||
local gpu = comp.gpu
|
||||
local gpu = component.gpu
|
||||
gpu.freeAllBuffers()
|
||||
local colors = {
|
||||
[0] = 0x00a6ff,
|
||||
[1] = 0x000000
|
||||
[0] = colors.steelBlue,
|
||||
[1] = colors.black
|
||||
}
|
||||
local buffer = gpu.allocateBuffer()
|
||||
gpu.setActiveBuffer(buffer)
|
||||
@ -68,7 +66,7 @@ function doStartupSequence()
|
||||
copyWindow(gpu, 0, 0, buffer, 0)
|
||||
end
|
||||
gpu.setForeground(colors[i % 2])
|
||||
comp.gpu.fill(2 + i * 2, 1 + i, 80 - i * 4, 40 - i * 2, "█")
|
||||
component.gpu.fill(2 + i * 2, 1 + i, 80 - i * 4, 40 - i * 2, "█")
|
||||
os.sleep(0.1)
|
||||
end
|
||||
gpu.setActiveBuffer(0)
|
||||
@ -79,7 +77,7 @@ function doStartupSequence()
|
||||
end
|
||||
local starting = false
|
||||
function send()
|
||||
local transposer = comp.transposer
|
||||
local transposer = component.transposer
|
||||
if transposer.getStackInSlot(controller, 1) == nil then
|
||||
--screen.write("The operating cell is missing!\n")
|
||||
else
|
||||
@ -90,7 +88,7 @@ function send()
|
||||
end
|
||||
end
|
||||
function checkArrivals()
|
||||
local transposer = comp.transposer
|
||||
local transposer = component.transposer
|
||||
for i = 1, 26 do
|
||||
if transposer.getStackInSlot(incoming, i) ~= nil then
|
||||
return i
|
||||
@ -111,7 +109,7 @@ function activateTeleporter()
|
||||
lastActivation = computer.uptime()
|
||||
end
|
||||
event.listen("walk", activateTeleporter)
|
||||
comp.gpu.fill(0, 0, 100, 50, " ")
|
||||
component.gpu.fill(0, 0, 100, 50, " ")
|
||||
while true do
|
||||
local arrival = checkArrivals()
|
||||
if arrival ~= 0 then
|
||||
|
@ -1,7 +1,6 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
component = require("component")
|
||||
|
||||
local transposer = comp.transposer
|
||||
local transposer = component.transposer
|
||||
local dark = 2
|
||||
local charger = 3
|
||||
function swap()
|
||||
|
@ -1,5 +1,5 @@
|
||||
Comp = require("component")
|
||||
local transposer = Comp.transposer
|
||||
component = require("component")
|
||||
local transposer = component.transposer
|
||||
local players = {["Sampsa"] = 3, ["Dark"] = 2}
|
||||
local function findEmptyCans(player)
|
||||
local allItems = transposer.getAllStacks(players[player]).getAll()
|
||||
|
@ -1,13 +1,11 @@
|
||||
local comp = require("component")
|
||||
local event = require("event")
|
||||
local screen = require("term")
|
||||
local computer = require("computer")
|
||||
component = require("component")
|
||||
term = require("term")
|
||||
|
||||
local transposers = {}
|
||||
function configureTransposers()
|
||||
for address, type in pairs(comp.list()) do
|
||||
for address, type in pairs(component.list()) do
|
||||
if type == "transposer" then
|
||||
local transposer = comp.proxy(comp.get(address))
|
||||
local transposer = component.proxy(component.get(address))
|
||||
local foundTanks = {}
|
||||
for side = 0, 5, 1 do
|
||||
if transposer.getTankCapacity(side) > 0 then
|
||||
@ -21,15 +19,15 @@ function configureTransposers()
|
||||
transposers[address] = {source = foundTanks[1].side, sink = foundTanks[2].side}
|
||||
end
|
||||
else
|
||||
screen.write("Some transposers have more than two tanks! FIX IT!\n")
|
||||
term.write("Some transposers have more than two tanks! FIX IT!\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
screen.write("Found " .. countTransposers() .. " output hatches to keep at 50%\n")
|
||||
term.write("Found " .. countTransposers() .. " output hatches to keep at 50%\n")
|
||||
end
|
||||
function countTransposers()
|
||||
local count = 0
|
||||
for address, type in pairs(comp.list()) do
|
||||
for address, type in pairs(component.list()) do
|
||||
if type == "transposer" then
|
||||
count = count + 1
|
||||
end
|
||||
@ -38,7 +36,7 @@ function countTransposers()
|
||||
end
|
||||
function tick()
|
||||
for address, sides in pairs(transposers) do
|
||||
local transposer = comp.proxy(comp.get(address))
|
||||
local transposer = component.proxy(component.get(address))
|
||||
local sourceCurrent, sourceMax = transposer.getTankLevel(sides.source), transposer.getTankCapacity(sides.source)
|
||||
if sourceCurrent / sourceMax > 0.5 then
|
||||
local fluidToRemove = sourceCurrent - sourceMax / 2
|
||||
|
@ -1,16 +1,11 @@
|
||||
comp = require("component")
|
||||
event = require("event")
|
||||
screen = require("term")
|
||||
computer = require("computer")
|
||||
thread = require("thread")
|
||||
uc = require("unicode")
|
||||
component = require("component")
|
||||
|
||||
local LSC = comp.gt_machine
|
||||
local LSC = component.gt_machine
|
||||
local engaged = false
|
||||
local function machine(address)
|
||||
machineAddress = comp.get(address)
|
||||
machineAddress = component.get(address)
|
||||
if (machineAddress ~= nil) then
|
||||
return comp.proxy(machineAddress)
|
||||
return component.proxy(machineAddress)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
@ -1,6 +1,4 @@
|
||||
-- Import section
|
||||
computer = require("computer")
|
||||
comp = require("component")
|
||||
MultiBlock = require("data.datasource.multi-block")
|
||||
SingleBlock = require("data.datasource.single-block")
|
||||
EnergyProvider = require("data.datasource.energy-provider")
|
||||
|
Loading…
x
Reference in New Issue
Block a user