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
1 changed files with 15 additions and 9 deletions

View File

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