mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-31 11:19:11 +00:00
Made exits more clean
It'll close the skynet socket upon exit as best it can.
This commit is contained in:
parent
6ae70b0866
commit
e40e30798e
17
ccbn.lua
17
ccbn.lua
@ -989,6 +989,12 @@ local networking = function()
|
||||
end
|
||||
end
|
||||
|
||||
local cwrite = function(text, y)
|
||||
local cx, cy = term.getCursorPos()
|
||||
term.setCursorPos(scr_x / 2 - #text / 2, y or (scr_y / 2))
|
||||
term.write(text)
|
||||
end
|
||||
|
||||
local startGame = function()
|
||||
getModem()
|
||||
local time = os.epoch("utc")
|
||||
@ -1001,6 +1007,8 @@ local startGame = function()
|
||||
})
|
||||
local msg
|
||||
waitingForGame = true
|
||||
term.clear()
|
||||
cwrite("Waiting for game...")
|
||||
repeat
|
||||
msg = receive()
|
||||
until interpretNetMessage(msg)
|
||||
@ -1013,7 +1021,12 @@ local startGame = function()
|
||||
time = isHost and math.huge or -math.huge,
|
||||
})
|
||||
waitingForGame = false
|
||||
parallel.waitForAny(getInput, runGame, networking)
|
||||
parallel.waitForAny(runGame, networking)
|
||||
end
|
||||
|
||||
startGame()
|
||||
parallel.waitForAny(startGame, getInput)
|
||||
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.clear()
|
||||
cwrite("Thanks for playing!")
|
||||
term.setCursorPos(1, scr_y)
|
||||
|
Loading…
Reference in New Issue
Block a user