Update server
This commit is contained in:
parent
35872227c4
commit
9d4bb4b6a8
@ -3,15 +3,22 @@ rednet.open("back")
|
|||||||
state = {}
|
state = {}
|
||||||
ores = {}
|
ores = {}
|
||||||
|
|
||||||
|
thelog = {"", "", "", "", "", "", "", ""}
|
||||||
|
logsize = 8
|
||||||
|
logpos = 1
|
||||||
|
|
||||||
curjob = 69
|
curjob = 69
|
||||||
|
firstjob = nil
|
||||||
|
totalfuel = 0
|
||||||
while true do
|
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()
|
x = read()
|
||||||
if tonumber(x) then
|
if tonumber(x) then
|
||||||
curjob = tonumber(x)
|
curjob = tonumber(x)
|
||||||
|
firstjob = tonumber(x)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
print("That's not a number.")
|
log("That's not a number.")
|
||||||
end
|
end
|
||||||
|
|
||||||
function getNextJob()
|
function getNextJob()
|
||||||
@ -19,20 +26,44 @@ function getNextJob()
|
|||||||
return curjob - 1
|
return curjob - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getOres(ore)
|
||||||
|
return ores[ore] or 0
|
||||||
|
end
|
||||||
|
|
||||||
function drawState()
|
function drawState()
|
||||||
print("owwe")
|
-- server has 19x50 terminal
|
||||||
print()
|
print(" [ Server Control Panel ]")
|
||||||
print()
|
print(" First Job: "..tostring(firstjob))
|
||||||
print()
|
print(" Current Job: "..tostring(curjob))
|
||||||
print()
|
print(" Fuel consumed: "..tostring(totalfuel).." "..tostring(math.floor(totalfuel/80)))
|
||||||
print()
|
|
||||||
print()
|
|
||||||
print()
|
|
||||||
print()
|
|
||||||
print()
|
|
||||||
print()
|
|
||||||
print()
|
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()
|
||||||
|
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
|
end
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
@ -49,7 +80,7 @@ while true do
|
|||||||
if rs.getInput("top") then
|
if rs.getInput("top") then
|
||||||
job = getNextJob()
|
job = getNextJob()
|
||||||
rednet.send(receiver, tostring(job))
|
rednet.send(receiver, tostring(job))
|
||||||
print("Found job request. Offering "..tostring(job))
|
log("Found job request. Offering "..tostring(job))
|
||||||
else
|
else
|
||||||
rednet.send(receiver, "nojobs")
|
rednet.send(receiver, "nojobs")
|
||||||
end
|
end
|
||||||
@ -59,6 +90,7 @@ while true do
|
|||||||
thejob = tonumber(job)
|
thejob = tonumber(job)
|
||||||
_, fuel, _ = rednet.receive()
|
_, fuel, _ = rednet.receive()
|
||||||
thefuel = tonumber(fuel)
|
thefuel = tonumber(fuel)
|
||||||
|
totalfuel = totalfuel + thefuel
|
||||||
while true do
|
while true do
|
||||||
_, ore, _ = rednet.receive()
|
_, ore, _ = rednet.receive()
|
||||||
if ore == "done" then
|
if ore == "done" then
|
||||||
|
Loading…
Reference in New Issue
Block a user