mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-31 19:29: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
|
||||||
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()
|
local startGame = function()
|
||||||
getModem()
|
getModem()
|
||||||
local time = os.epoch("utc")
|
local time = os.epoch("utc")
|
||||||
@ -1001,6 +1007,8 @@ local startGame = function()
|
|||||||
})
|
})
|
||||||
local msg
|
local msg
|
||||||
waitingForGame = true
|
waitingForGame = true
|
||||||
|
term.clear()
|
||||||
|
cwrite("Waiting for game...")
|
||||||
repeat
|
repeat
|
||||||
msg = receive()
|
msg = receive()
|
||||||
until interpretNetMessage(msg)
|
until interpretNetMessage(msg)
|
||||||
@ -1013,7 +1021,12 @@ local startGame = function()
|
|||||||
time = isHost and math.huge or -math.huge,
|
time = isHost and math.huge or -math.huge,
|
||||||
})
|
})
|
||||||
waitingForGame = false
|
waitingForGame = false
|
||||||
parallel.waitForAny(getInput, runGame, networking)
|
parallel.waitForAny(runGame, networking)
|
||||||
end
|
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