Update server
This commit is contained in:
parent
4ac7f74be5
commit
35872227c4
@ -1,5 +1,8 @@
|
|||||||
rednet.open("back")
|
rednet.open("back")
|
||||||
|
|
||||||
|
state = {}
|
||||||
|
ores = {}
|
||||||
|
|
||||||
curjob = 69
|
curjob = 69
|
||||||
while true do
|
while true do
|
||||||
print("From what index do you want to resume jobs?")
|
print("From what index do you want to resume jobs?")
|
||||||
@ -16,6 +19,22 @@ function getNextJob()
|
|||||||
return curjob - 1
|
return curjob - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function drawState()
|
||||||
|
print("owwe")
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
end
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
sender, message, proto = rednet.receive()
|
sender, message, proto = rednet.receive()
|
||||||
if not message then
|
if not message then
|
||||||
@ -34,6 +53,7 @@ while true do
|
|||||||
else
|
else
|
||||||
rednet.send(receiver, "nojobs")
|
rednet.send(receiver, "nojobs")
|
||||||
end
|
end
|
||||||
|
drawState()
|
||||||
elseif message == "report" then
|
elseif message == "report" then
|
||||||
_, job, _ = rednet.receive()
|
_, job, _ = rednet.receive()
|
||||||
thejob = tonumber(job)
|
thejob = tonumber(job)
|
||||||
@ -46,31 +66,16 @@ while true do
|
|||||||
end
|
end
|
||||||
_, number, _ = rednet.receive()
|
_, number, _ = rednet.receive()
|
||||||
--thenumber = tonumber(thenumber)
|
--thenumber = tonumber(thenumber)
|
||||||
print(tostring(job)..": "..ore.." "..tostring(number).."x")
|
if ores[ore] then
|
||||||
|
ores[ore] = ores[ore] + tonumber(number)
|
||||||
|
else
|
||||||
|
ores[ore] = tonumber(number)
|
||||||
|
end
|
||||||
|
drawState()
|
||||||
end
|
end
|
||||||
rednet.send(receiver, "thanks")
|
rednet.send(receiver, "thanks")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- if message == "gibjob" then
|
|
||||||
-- if rs.getInput("top") then
|
|
||||||
-- job = getNextJob()
|
|
||||||
-- rednet.send(sender, tostring(job), "newjob")
|
|
||||||
-- print("Found job request. Offering "..tostring(job))
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- -- numberic job is complete
|
|
||||||
-- completejob = tonumber(message)
|
|
||||||
-- fuelused = "??"
|
|
||||||
-- fuelsender, fuelmessage, fuelproto = rednet.receive("fuel")
|
|
||||||
-- if fuelmessage then
|
|
||||||
-- fuelused = fuelmessage
|
|
||||||
-- end
|
|
||||||
-- print("Job "..tostring(completejob).." was completed, "..fuelused.." fuel was used")
|
|
||||||
-- rednet.broadcast("thanks", "jobcomplete")
|
|
||||||
-- log = io.open("jobs.log","a")
|
|
||||||
-- log:write(tostring(completejob),"\n")
|
|
||||||
-- log:close()
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user