mirror of
https://github.com/LDDestroier/CC/
synced 2025-07-05 19:42:55 +00:00
Further optimizations
This commit is contained in:
parent
f4bd0470bb
commit
2f450c6cab
255
tron
255
tron
@ -6,42 +6,9 @@
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
local port = 701
|
local port = 701
|
||||||
|
|
||||||
local scr_x, scr_y = term.getSize()
|
local scr_x, scr_y = term.getSize()
|
||||||
local modem = peripheral.find("modem")
|
|
||||||
if (not modem) and ccemux then
|
|
||||||
ccemux.attach("top", "wireless_modem")
|
|
||||||
modem = peripheral.find("modem")
|
|
||||||
end
|
|
||||||
|
|
||||||
if modem then
|
|
||||||
modem.open(port)
|
|
||||||
else
|
|
||||||
error("You should attach a modem.")
|
|
||||||
end
|
|
||||||
|
|
||||||
local gamename = ""
|
|
||||||
local isHost
|
|
||||||
local squareGrid = true
|
|
||||||
|
|
||||||
local waitingForGame = true
|
|
||||||
|
|
||||||
local deepCopy
|
|
||||||
deepCopy = function(tbl, ...)
|
|
||||||
local output = {}
|
|
||||||
for k,v in pairs(tbl) do
|
|
||||||
if type(v) == "table" then
|
|
||||||
output[k] = deepCopy(v)
|
|
||||||
else
|
|
||||||
output[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for i = 1, #arg do
|
|
||||||
output[#output+1] = arg[i]
|
|
||||||
end
|
|
||||||
return output
|
|
||||||
end
|
|
||||||
|
|
||||||
|
local gameDelayInit = 0.1 -- lower value = faster game. I'd reccommend 0.1 for SMP play.
|
||||||
local initGrid = {
|
local initGrid = {
|
||||||
x1 = -100,
|
x1 = -100,
|
||||||
y1 = -100,
|
y1 = -100,
|
||||||
@ -53,28 +20,8 @@ local initGrid = {
|
|||||||
backcol = "7",
|
backcol = "7",
|
||||||
edgecol = "0"
|
edgecol = "0"
|
||||||
}
|
}
|
||||||
grid = deepCopy(initGrid)
|
|
||||||
|
|
||||||
local you = 1
|
|
||||||
local nou = 2
|
|
||||||
|
|
||||||
local keysDown = {}
|
|
||||||
local netKeysDown = {}
|
|
||||||
|
|
||||||
-- the scrolling of the screen
|
|
||||||
local scrollX = 0
|
|
||||||
local scrollY = 0
|
|
||||||
|
|
||||||
-- used when panning with WASD
|
|
||||||
local scrollAdjX = 0
|
|
||||||
local scrollAdjY = 0
|
|
||||||
|
|
||||||
local lockInput = false
|
|
||||||
local gameDelayInit = 0.1 -- lower value = faster game. I'd reccommend 0.1 for SMP play.
|
|
||||||
local player
|
|
||||||
|
|
||||||
local resetPlayers = function()
|
local resetPlayers = function()
|
||||||
player = {
|
return {
|
||||||
[1] = {
|
[1] = {
|
||||||
num = 1,
|
num = 1,
|
||||||
x = -2,
|
x = -2,
|
||||||
@ -118,7 +65,76 @@ local resetPlayers = function()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
resetPlayers()
|
local modem = peripheral.find("modem")
|
||||||
|
if (not modem) and ccemux then
|
||||||
|
ccemux.attach("top", "wireless_modem")
|
||||||
|
modem = peripheral.find("modem")
|
||||||
|
end
|
||||||
|
|
||||||
|
local transmit = function(port, message)
|
||||||
|
modem.transmit(port, port, message)
|
||||||
|
end
|
||||||
|
|
||||||
|
if modem then
|
||||||
|
modem.open(port)
|
||||||
|
else
|
||||||
|
error("You should attach a modem.")
|
||||||
|
end
|
||||||
|
|
||||||
|
local gamename = ""
|
||||||
|
local isHost
|
||||||
|
local squareGrid = true
|
||||||
|
|
||||||
|
local waitingForGame = true
|
||||||
|
|
||||||
|
local termblit, termwrite, termclear = term.blit, term.write, term.clear
|
||||||
|
local termsetCursorPos, termgetCursorPos = term.setCursorPos, term.getCursorPos
|
||||||
|
local tableunpack, tableremove = unpack, table.remove
|
||||||
|
local mathfloor, mathceil, mathcos, mathsin = math.floor, math.ceil, math.cos, math.sin
|
||||||
|
local termsetTextColor, termsetBackgroundColor = term.setTextColor, term.setBackgroundColor
|
||||||
|
|
||||||
|
local tsv = function(visible)
|
||||||
|
if term.current().setVisible then
|
||||||
|
term.current().setVisible(visible)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local deepCopy
|
||||||
|
deepCopy = function(tbl, ...)
|
||||||
|
local output = {}
|
||||||
|
for k,v in pairs(tbl) do
|
||||||
|
if type(v) == "table" then
|
||||||
|
output[k] = deepCopy(v)
|
||||||
|
else
|
||||||
|
output[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i = 1, #arg do
|
||||||
|
output[#output+1] = arg[i]
|
||||||
|
end
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
|
||||||
|
grid = deepCopy(initGrid)
|
||||||
|
|
||||||
|
local you = 1
|
||||||
|
local nou = 2
|
||||||
|
|
||||||
|
local keysDown = {}
|
||||||
|
local netKeysDown = {}
|
||||||
|
|
||||||
|
-- the scrolling of the screen
|
||||||
|
local scrollX = 0
|
||||||
|
local scrollY = 0
|
||||||
|
|
||||||
|
-- used when panning with WASD
|
||||||
|
local scrollAdjX = 0
|
||||||
|
local scrollAdjY = 0
|
||||||
|
|
||||||
|
local lockInput = false
|
||||||
|
local player
|
||||||
|
|
||||||
|
player = resetPlayers()
|
||||||
|
|
||||||
local images = {
|
local images = {
|
||||||
logo = {
|
logo = {
|
||||||
@ -264,18 +280,18 @@ for k,v in pairs(toblit) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local drawImage = function(im, x, y)
|
local drawImage = function(im, x, y)
|
||||||
local cx, cy = term.getCursorPos()
|
local cx, cy = termgetCursorPos()
|
||||||
term.setBackgroundColor(tocolors[initGrid.voidcol])
|
termsetBackgroundColor(tocolors[initGrid.voidcol])
|
||||||
term.setTextColor(tocolors[initGrid.voidcol])
|
termsetTextColor(tocolors[initGrid.voidcol])
|
||||||
for iy = 1, #im[1] do
|
for iy = 1, #im[1] do
|
||||||
for ix = 1, #im[1][iy] do
|
for ix = 1, #im[1][iy] do
|
||||||
term.setCursorPos(x+(ix-1),y+(iy-1))
|
termsetCursorPos(x+(ix-1),y+(iy-1))
|
||||||
if not (im[2][iy]:sub(ix,ix) == " " and im[3][iy]:sub(ix,ix) == " ") then
|
if not (im[2][iy]:sub(ix,ix) == " " and im[3][iy]:sub(ix,ix) == " ") then
|
||||||
term.blit(im[1][iy]:sub(ix,ix), im[2][iy]:sub(ix,ix), im[3][iy]:sub(ix,ix))
|
termblit(im[1][iy]:sub(ix,ix), im[2][iy]:sub(ix,ix), im[3][iy]:sub(ix,ix))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
term.setCursorPos(cx,cy)
|
termsetCursorPos(cx,cy)
|
||||||
end
|
end
|
||||||
|
|
||||||
local deadGuys = {}
|
local deadGuys = {}
|
||||||
@ -382,7 +398,7 @@ end
|
|||||||
|
|
||||||
--draws grid and background at scroll 'x' and 'y', along with trails and players
|
--draws grid and background at scroll 'x' and 'y', along with trails and players
|
||||||
local drawGrid = function(x, y, onlyDrawGrid)
|
local drawGrid = function(x, y, onlyDrawGrid)
|
||||||
x, y = math.floor(x + 0.5), math.floor(y + 0.5)
|
x, y = mathfloor(x + 0.5), mathfloor(y + 0.5)
|
||||||
local bg = {{},{},{}}
|
local bg = {{},{},{}}
|
||||||
local foreX, foreY
|
local foreX, foreY
|
||||||
local backX, backY
|
local backX, backY
|
||||||
@ -397,8 +413,8 @@ local drawGrid = function(x, y, onlyDrawGrid)
|
|||||||
adjY = (sy + y)
|
adjY = (sy + y)
|
||||||
foreX = 1 + (sx + x) % #gridFore[1]
|
foreX = 1 + (sx + x) % #gridFore[1]
|
||||||
foreY = 1 + (sy + y) % #gridFore
|
foreY = 1 + (sy + y) % #gridFore
|
||||||
backX = 1 + math.floor(sx + (x / 2)) % #gridBack[1]
|
backX = 1 + mathfloor(sx + (x / 2)) % #gridBack[1]
|
||||||
backY = 1 + math.floor(sy + (y / 2)) % #gridBack
|
backY = 1 + mathfloor(sy + (y / 2)) % #gridBack
|
||||||
trailChar, trailColor, trailAge = getTrail(adjX, adjY)
|
trailChar, trailColor, trailAge = getTrail(adjX, adjY)
|
||||||
isPlayer = false
|
isPlayer = false
|
||||||
if not onlyDrawGrid then
|
if not onlyDrawGrid then
|
||||||
@ -448,33 +464,35 @@ local drawGrid = function(x, y, onlyDrawGrid)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
for sy = 1, scr_y do
|
for sy = 1, scr_y do
|
||||||
term.setCursorPos(1,sy)
|
termsetCursorPos(1,sy)
|
||||||
term.blit(bg[1][sy], bg[2][sy], bg[3][sy])
|
termblit(bg[1][sy], bg[2][sy], bg[3][sy])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local render = function()
|
local render = function()
|
||||||
|
tsv(false)
|
||||||
local p = player[you]
|
local p = player[you]
|
||||||
drawGrid(scrollX + scrollAdjX, scrollY + scrollAdjY)
|
drawGrid(scrollX + scrollAdjX, scrollY + scrollAdjY)
|
||||||
term.setCursorPos(1,1)
|
termsetCursorPos(1,1)
|
||||||
term.setTextColor(player[you].color[1])
|
termsetTextColor(player[you].color[1])
|
||||||
term.write("P" .. you)
|
termwrite("P" .. you)
|
||||||
|
tsv(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local pleaseWait = function()
|
local pleaseWait = function()
|
||||||
local periods = 1
|
local periods = 1
|
||||||
local maxPeriods = 5
|
local maxPeriods = 5
|
||||||
term.setBackgroundColor(colors.black)
|
termsetBackgroundColor(colors.black)
|
||||||
term.setTextColor(colors.gray)
|
termsetTextColor(colors.gray)
|
||||||
term.clear()
|
termclear()
|
||||||
|
|
||||||
local tID = os.startTimer(0.2)
|
local tID = os.startTimer(0.2)
|
||||||
local evt
|
local evt
|
||||||
local txt = "Waiting for game"
|
local txt = "Waiting for game"
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
term.setCursorPos(math.floor(scr_x / 2 - (#txt + maxPeriods) / 2), scr_y - 2)
|
termsetCursorPos(mathfloor(scr_x / 2 - (#txt + maxPeriods) / 2), scr_y - 2)
|
||||||
term.write(txt .. ("."):rep(periods))
|
termwrite(txt .. ("."):rep(periods))
|
||||||
evt = {os.pullEvent()}
|
evt = {os.pullEvent()}
|
||||||
if evt[1] == "timer" and evt[2] == tID then
|
if evt[1] == "timer" and evt[2] == tID then
|
||||||
tID = os.startTimer(0.5)
|
tID = os.startTimer(0.5)
|
||||||
@ -497,18 +515,18 @@ local startCountdown = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local cMessage = "You are "
|
local cMessage = "You are "
|
||||||
scrollX = player[you].x - math.floor(scr_x / 2)
|
scrollX = player[you].x - mathfloor(scr_x / 2)
|
||||||
scrollY = player[you].y - math.floor(scr_y / 2)
|
scrollY = player[you].y - mathfloor(scr_y / 2)
|
||||||
for i = 3, 1, -1 do
|
for i = 3, 1, -1 do
|
||||||
render()
|
render()
|
||||||
term.setCursorPos(math.floor(scr_x / 2 - (#cMessage + #cName) / 2), math.floor(scr_y / 2) + 2)
|
termsetCursorPos(mathfloor(scr_x / 2 - (#cMessage + #cName) / 2), mathfloor(scr_y / 2) + 2)
|
||||||
term.setTextColor(colors.white)
|
termsetTextColor(colors.white)
|
||||||
term.write(cMessage)
|
termwrite(cMessage)
|
||||||
term.setTextColor(col)
|
termsetTextColor(col)
|
||||||
term.write(cName)
|
termwrite(cName)
|
||||||
term.setTextColor(colors.white)
|
termsetTextColor(colors.white)
|
||||||
term.setCursorPos(math.floor(scr_x / 2 - 2), math.floor(scr_y / 2) + 4)
|
termsetCursorPos(mathfloor(scr_x / 2 - 2), mathfloor(scr_y / 2) + 4)
|
||||||
term.write(i .. "...")
|
termwrite(i .. "...")
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -520,27 +538,27 @@ local makeMenu = function(x, y, options, doAnimate)
|
|||||||
local step = 0
|
local step = 0
|
||||||
local lastPos = cpos
|
local lastPos = cpos
|
||||||
if not doAnimate then
|
if not doAnimate then
|
||||||
drawImage(images.logo, math.ceil(scr_x / 2 - images.logo.x / 2), 2)
|
drawImage(images.logo, mathceil(scr_x / 2 - images.logo.x / 2), 2)
|
||||||
end
|
end
|
||||||
local rend = function()
|
local rend = function()
|
||||||
if doAnimate then
|
if doAnimate then
|
||||||
drawImage(images.logo, math.ceil(scr_x / 2 - images.logo.x / 2), 2)
|
drawImage(images.logo, mathceil(scr_x / 2 - images.logo.x / 2), 2)
|
||||||
end
|
end
|
||||||
for i = 1, #options do
|
for i = 1, #options do
|
||||||
if i == cpos then
|
if i == cpos then
|
||||||
term.setCursorPos(x, y + (i - 1))
|
termsetCursorPos(x, y + (i - 1))
|
||||||
term.setTextColor(colors.white)
|
termsetTextColor(colors.white)
|
||||||
term.write(cursor .. options[i])
|
termwrite(cursor .. options[i])
|
||||||
else
|
else
|
||||||
if i == lastPos then
|
if i == lastPos then
|
||||||
term.setCursorPos(x, y + (i - 1))
|
termsetCursorPos(x, y + (i - 1))
|
||||||
term.write((" "):rep(#cursor))
|
termwrite((" "):rep(#cursor))
|
||||||
lastPos = nil
|
lastPos = nil
|
||||||
else
|
else
|
||||||
term.setCursorPos(x + #cursor, y + (i - 1))
|
termsetCursorPos(x + #cursor, y + (i - 1))
|
||||||
end
|
end
|
||||||
term.setTextColor(colors.gray)
|
termsetTextColor(colors.gray)
|
||||||
term.write(options[i])
|
termwrite(options[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -571,7 +589,7 @@ local makeMenu = function(x, y, options, doAnimate)
|
|||||||
gstID = os.startTimer(0.05)
|
gstID = os.startTimer(0.05)
|
||||||
drawGrid(gsX, gsY, true)
|
drawGrid(gsX, gsY, true)
|
||||||
step = step + 1
|
step = step + 1
|
||||||
if math.ceil(step / 100) % 2 == 1 then
|
if mathceil(step / 100) % 2 == 1 then
|
||||||
gsX = gsX + 1
|
gsX = gsX + 1
|
||||||
else
|
else
|
||||||
gsY = gsY - 1
|
gsY = gsY - 1
|
||||||
@ -581,8 +599,7 @@ local makeMenu = function(x, y, options, doAnimate)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local titleScreen = function()
|
local titleScreen = function()
|
||||||
term.clear()
|
termclear()
|
||||||
|
|
||||||
local choice = makeMenu(2, scr_y - 4, {
|
local choice = makeMenu(2, scr_y - 4, {
|
||||||
"Start Game",
|
"Start Game",
|
||||||
"How to Play",
|
"How to Play",
|
||||||
@ -601,10 +618,10 @@ local titleScreen = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cleanExit = function()
|
local cleanExit = function()
|
||||||
term.setBackgroundColor(colors.black)
|
termsetBackgroundColor(colors.black)
|
||||||
term.setTextColor(colors.white)
|
termsetTextColor(colors.white)
|
||||||
term.clear()
|
termclear()
|
||||||
term.setCursorPos(1,1)
|
termsetCursorPos(1,1)
|
||||||
print("Thanks for playing!")
|
print("Thanks for playing!")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -658,7 +675,7 @@ local gridDemo = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local sendInfo = function(gameID)
|
local sendInfo = function(gameID)
|
||||||
modem.transmit(port, port, {
|
transmit(port, {
|
||||||
player = isHost and player or nil,
|
player = isHost and player or nil,
|
||||||
gameID = gameID,
|
gameID = gameID,
|
||||||
keysDown = isHost and nil or keysDown,
|
keysDown = isHost and nil or keysDown,
|
||||||
@ -681,23 +698,23 @@ local deadAnimation = function(doSend)
|
|||||||
sendInfo(gamename)
|
sendInfo(gamename)
|
||||||
end
|
end
|
||||||
if deadGuys[you] or deadGuys[nou] then
|
if deadGuys[you] or deadGuys[nou] then
|
||||||
term.setTextColor(colors.white)
|
termsetTextColor(colors.white)
|
||||||
if deadGuys[you] and deadGuys[nou] then
|
if deadGuys[you] and deadGuys[nou] then
|
||||||
scrollToPosition(player[nou].x, player[nou].y)
|
scrollToPosition(player[nou].x, player[nou].y)
|
||||||
scrollToPosition(player[you].x, player[you].y)
|
scrollToPosition(player[you].x, player[you].y)
|
||||||
drawImage(images.tie, math.ceil(scr_x / 2 - images.tie.x / 2), math.floor(scr_y / 2 - images.tie.y / 2))
|
drawImage(images.tie, mathceil(scr_x / 2 - images.tie.x / 2), mathfloor(scr_y / 2 - images.tie.y / 2))
|
||||||
waitForKey(1)
|
waitForKey(1)
|
||||||
return "end"
|
return "end"
|
||||||
else
|
else
|
||||||
if deadGuys[you] then
|
if deadGuys[you] then
|
||||||
scrollX, scrollY = player[nou].x - scr_x / 2, player[nou].y - scr_y / 2
|
scrollX, scrollY = player[nou].x - scr_x / 2, player[nou].y - scr_y / 2
|
||||||
scrollToPosition(player[you].x, player[you].y)
|
scrollToPosition(player[you].x, player[you].y)
|
||||||
drawImage(images.lose, math.ceil(scr_x / 2 - images.lose.x / 2), math.floor(scr_y / 2 - images.lose.y / 2))
|
drawImage(images.lose, mathceil(scr_x / 2 - images.lose.x / 2), mathfloor(scr_y / 2 - images.lose.y / 2))
|
||||||
waitForKey(1)
|
waitForKey(1)
|
||||||
return "end"
|
return "end"
|
||||||
elseif deadGuys[nou] then
|
elseif deadGuys[nou] then
|
||||||
scrollToPosition(player[nou].x, player[nou].y)
|
scrollToPosition(player[nou].x, player[nou].y)
|
||||||
drawImage(images.win, math.ceil(scr_x / 2 - images.win.x / 2), math.floor(scr_y / 2 - images.win.y / 2))
|
drawImage(images.win, mathceil(scr_x / 2 - images.win.x / 2), mathfloor(scr_y / 2 - images.win.y / 2))
|
||||||
waitForKey(1)
|
waitForKey(1)
|
||||||
return "end"
|
return "end"
|
||||||
end
|
end
|
||||||
@ -711,8 +728,8 @@ local moveTick = function(doSend)
|
|||||||
p = player[i]
|
p = player[i]
|
||||||
if not p.dead then
|
if not p.dead then
|
||||||
if isHost then
|
if isHost then
|
||||||
p.x = p.x + math.floor(math.cos(math.rad(p.direction * 90)))
|
p.x = p.x + mathfloor(mathcos(math.rad(p.direction * 90)))
|
||||||
p.y = p.y + math.floor(math.sin(math.rad(p.direction * 90)))
|
p.y = p.y + mathfloor(mathsin(math.rad(p.direction * 90)))
|
||||||
if doesIntersectBorder(p.x, p.y) or getTrail(p.x, p.y) then
|
if doesIntersectBorder(p.x, p.y) or getTrail(p.x, p.y) then
|
||||||
p.dead = true
|
p.dead = true
|
||||||
deadGuys[i] = true
|
deadGuys[i] = true
|
||||||
@ -720,7 +737,7 @@ local moveTick = function(doSend)
|
|||||||
putTrail(p)
|
putTrail(p)
|
||||||
lastTrails[#lastTrails+1] = {p.x, p.y, p.num}
|
lastTrails[#lastTrails+1] = {p.x, p.y, p.num}
|
||||||
if #lastTrails > #player then
|
if #lastTrails > #player then
|
||||||
table.remove(lastTrails, 1)
|
tableremove(lastTrails, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -795,8 +812,8 @@ local game = function()
|
|||||||
if outcome == "end" then
|
if outcome == "end" then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
scrollX = p.x - math.floor(scr_x / 2)
|
scrollX = p.x - mathfloor(scr_x / 2)
|
||||||
scrollY = p.y - math.floor(scr_y / 2)
|
scrollY = p.y - mathfloor(scr_y / 2)
|
||||||
|
|
||||||
render()
|
render()
|
||||||
if isHost then
|
if isHost then
|
||||||
@ -826,7 +843,7 @@ local networking = function()
|
|||||||
isHost = true
|
isHost = true
|
||||||
end
|
end
|
||||||
you, nou = nou, you
|
you, nou = nou, you
|
||||||
modem.transmit(port, port, {
|
transmit(port, {
|
||||||
player = player,
|
player = player,
|
||||||
gameID = gamename,
|
gameID = gamename,
|
||||||
new = isHost and (-math.huge) or (math.huge),
|
new = isHost and (-math.huge) or (math.huge),
|
||||||
@ -857,10 +874,10 @@ local networking = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local helpScreen = function()
|
local helpScreen = function()
|
||||||
term.setBackgroundColor(colors.black)
|
termsetBackgroundColor(colors.black)
|
||||||
term.setTextColor(colors.white)
|
termsetTextColor(colors.white)
|
||||||
term.clear()
|
termclear()
|
||||||
term.setCursorPos(1,2)
|
termsetCursorPos(1,2)
|
||||||
print([[
|
print([[
|
||||||
Move with arrow keys.
|
Move with arrow keys.
|
||||||
Pan the camera with WASD.
|
Pan the camera with WASD.
|
||||||
@ -880,14 +897,14 @@ while true do
|
|||||||
deadGuys = {}
|
deadGuys = {}
|
||||||
gameDelay = gameDelayInit
|
gameDelay = gameDelayInit
|
||||||
grid = deepCopy(initGrid)
|
grid = deepCopy(initGrid)
|
||||||
resetPlayers()
|
player = resetPlayers()
|
||||||
you, nou = 1, 2
|
you, nou = 1, 2
|
||||||
gamename = ""
|
gamename = ""
|
||||||
for i = 1, 32 do
|
for i = 1, 32 do
|
||||||
gamename = gamename .. string.char(math.random(1,126))
|
gamename = gamename .. string.char(math.random(1,126))
|
||||||
end
|
end
|
||||||
waitingForGame = true
|
waitingForGame = true
|
||||||
modem.transmit(port, port, {
|
transmit(port, {
|
||||||
player = player,
|
player = player,
|
||||||
gameID = gamename,
|
gameID = gamename,
|
||||||
new = os.time(),
|
new = os.time(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user