1
0
mirror of https://github.com/LDDestroier/CC/ synced 2025-04-29 05:53:09 +00:00

Fixed player death causing crash

This commit is contained in:
LDDestroier 2019-03-12 17:04:46 -04:00 committed by GitHub
parent 04275c732d
commit 0ed94bf6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,12 @@ local round = function(num)
return math.floor(0.5 + num) return math.floor(0.5 + num)
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
-- ripped from NFTE -- ripped from NFTE
local deepCopy local deepCopy
deepCopy = function(tbl) deepCopy = function(tbl)
@ -1290,8 +1296,12 @@ local runGame = function()
end end
for y = 1, #stage.panels do for y = 1, #stage.panels do
for x = 1, #stage.panels[y] do if stage.panels[y] then
stage.panels[y][x].reserved = false for x = 1, #stage.panels[y] do
if stage.panels[y][x] then
stage.panels[y][x].reserved = false
end
end
end end
end end
@ -1410,7 +1420,9 @@ local interpretNetMessage = function(msg)
elseif msg.gameID == gameID then elseif msg.gameID == gameID then
if isHost then if isHost then
if msg.command == "set_controls" then if msg.command == "set_controls" then
players[msg.pID].control = msg.control if players[msg.pID] then
players[msg.pID].control = msg.control
end
end end
else else
if msg.command == "get_state" then if msg.command == "get_state" then
@ -1436,12 +1448,6 @@ 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")