mirror of
https://github.com/LDDestroier/CC/
synced 2025-04-29 13:53:10 +00:00
Fixed player death causing crash
This commit is contained in:
parent
04275c732d
commit
0ed94bf6f5
18
ccbn.lua
18
ccbn.lua
@ -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,10 +1296,14 @@ local runGame = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for y = 1, #stage.panels do
|
for y = 1, #stage.panels do
|
||||||
|
if stage.panels[y] then
|
||||||
for x = 1, #stage.panels[y] do
|
for x = 1, #stage.panels[y] do
|
||||||
|
if stage.panels[y][x] then
|
||||||
stage.panels[y][x].reserved = false
|
stage.panels[y][x].reserved = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for id, player in pairs(players) do
|
for id, player in pairs(players) do
|
||||||
if player.canMove then
|
if player.canMove then
|
||||||
@ -1410,8 +1420,10 @@ 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
|
||||||
|
if players[msg.pID] then
|
||||||
players[msg.pID].control = msg.control
|
players[msg.pID].control = msg.control
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if msg.command == "get_state" then
|
if msg.command == "get_state" then
|
||||||
os.queueEvent("ccbn_get_state", {
|
os.queueEvent("ccbn_get_state", {
|
||||||
@ -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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user