Update server
This commit is contained in:
parent
35872227c4
commit
9d4bb4b6a8
@ -3,15 +3,22 @@ rednet.open("back")
|
||||
state = {}
|
||||
ores = {}
|
||||
|
||||
thelog = {"", "", "", "", "", "", "", ""}
|
||||
logsize = 8
|
||||
logpos = 1
|
||||
|
||||
curjob = 69
|
||||
firstjob = nil
|
||||
totalfuel = 0
|
||||
while true do
|
||||
print("From what index do you want to resume jobs?")
|
||||
log("From what index do you want to resume jobs?")
|
||||
x = read()
|
||||
if tonumber(x) then
|
||||
curjob = tonumber(x)
|
||||
firstjob = tonumber(x)
|
||||
break
|
||||
end
|
||||
print("That's not a number.")
|
||||
log("That's not a number.")
|
||||
end
|
||||
|
||||
function getNextJob()
|
||||
@ -19,20 +26,44 @@ function getNextJob()
|
||||
return curjob - 1
|
||||
end
|
||||
|
||||
function getOres(ore)
|
||||
return ores[ore] or 0
|
||||
end
|
||||
|
||||
function drawState()
|
||||
print("owwe")
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
-- server has 19x50 terminal
|
||||
print(" [ Server Control Panel ]")
|
||||
print(" First Job: "..tostring(firstjob))
|
||||
print(" Current Job: "..tostring(curjob))
|
||||
print(" Fuel consumed: "..tostring(totalfuel).." "..tostring(math.floor(totalfuel/80)))
|
||||
print()
|
||||
n1 = tostring(getOres("minecraft:coal_ore"))
|
||||
n2 = tostring(getOres("minecraft:iron_ore"))
|
||||
n3 = tostring(getOres("minecraft:gold_ore"))
|
||||
n4 = tostring(getOres("minecraft:lapis_ore"))
|
||||
n5 = tostring(getOres("minecraft:redstone_ore"))
|
||||
n6 = tostring(getOres("minecraft:emerald_ore"))
|
||||
n7 = tostring(getOres("minecraft:diamond_ore"))
|
||||
n8 = tostring(getOres("mekanism:tin_ore"))
|
||||
n9 = tostring(getOres("mekanism:copper_ore"))
|
||||
n10 = tostring(getOres("mekanism:osmium_ore"))
|
||||
n11 = tostring(getOres("create:zinc_ore"))
|
||||
n12 = tostring(getOres("create:copper_ore"))
|
||||
print(" C I G "..n1.." "..n2" "..n3)
|
||||
print(" L R E D "..n4.." "..n5" "..n6" "..n7)
|
||||
print(" T C O "..n8.." "..n9" "..n10)
|
||||
print(" Z C "..n11.." "..n12)
|
||||
print()
|
||||
print("Log:")
|
||||
for i = (logpos + logsize - 1), logpos, -1 do
|
||||
print(thelog[i % logsize])
|
||||
end
|
||||
end
|
||||
|
||||
function log(s)
|
||||
thelog[logpos] = s
|
||||
logpos = logpos + 1
|
||||
drawState()
|
||||
end
|
||||
|
||||
while true do
|
||||
@ -49,7 +80,7 @@ while true do
|
||||
if rs.getInput("top") then
|
||||
job = getNextJob()
|
||||
rednet.send(receiver, tostring(job))
|
||||
print("Found job request. Offering "..tostring(job))
|
||||
log("Found job request. Offering "..tostring(job))
|
||||
else
|
||||
rednet.send(receiver, "nojobs")
|
||||
end
|
||||
@ -59,6 +90,7 @@ while true do
|
||||
thejob = tonumber(job)
|
||||
_, fuel, _ = rednet.receive()
|
||||
thefuel = tonumber(fuel)
|
||||
totalfuel = totalfuel + thefuel
|
||||
while true do
|
||||
_, ore, _ = rednet.receive()
|
||||
if ore == "done" then
|
||||
|
Loading…
Reference in New Issue
Block a user