mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-19 05:32:51 +00:00
Ridded unnecessary os.epoch(), and all os.time()'s
This commit is contained in:
parent
869a8b29d3
commit
11d471e40a
32
tron.lua
32
tron.lua
@ -14,23 +14,23 @@ local scr_mx, scr_my = scr_x / 2, scr_y / 2
|
|||||||
local isColor = term.isColor()
|
local isColor = term.isColor()
|
||||||
|
|
||||||
-- lower value = faster game. I'd reccommend 0.1 for SMP play.
|
-- lower value = faster game. I'd reccommend 0.1 for SMP play.
|
||||||
local gameDelayInit = 0.1
|
local gameDelayInit = 0.05
|
||||||
-- draws the names of players onscreen
|
-- draws the names of players onscreen
|
||||||
local doDrawPlayerNames = true
|
local doDrawPlayerNames = true
|
||||||
-- if doDrawPlayerNames, also draws your own name
|
-- if doDrawPlayerNames, also draws your own name
|
||||||
local doRenderOwnName = false
|
local doRenderOwnName = false
|
||||||
-- whether or not to use term.current().setVisible, which speeds things up at the cost of multishell
|
-- whether or not to use term.current().setVisible, which speeds things up at the cost of multishell
|
||||||
local useSetVisible = false
|
local useSetVisible = true
|
||||||
-- determines which grid is used
|
-- determines which grid is used
|
||||||
local gridID = 3
|
local gridID = 3
|
||||||
|
|
||||||
local initGrid = {
|
local initGrid = {
|
||||||
x1 = -100,
|
x1 = -40,
|
||||||
y1 = -100,
|
y1 = -40,
|
||||||
x2 = 100,
|
x2 = 40,
|
||||||
y2 = 100,
|
y2 = 40,
|
||||||
border = "#",
|
border = "F",
|
||||||
voidcol = "f",
|
voidcol = "e",
|
||||||
forecol = "8",
|
forecol = "8",
|
||||||
backcol = "7",
|
backcol = "7",
|
||||||
edgecol = "0"
|
edgecol = "0"
|
||||||
@ -42,7 +42,7 @@ local resetPlayers = function()
|
|||||||
x = -3,
|
x = -3,
|
||||||
y = -5,
|
y = -5,
|
||||||
direction = -1,
|
direction = -1,
|
||||||
char = "@",
|
char = "F",
|
||||||
color = {
|
color = {
|
||||||
colors.blue,
|
colors.blue,
|
||||||
colors.blue,
|
colors.blue,
|
||||||
@ -56,7 +56,7 @@ local resetPlayers = function()
|
|||||||
},
|
},
|
||||||
dead = false,
|
dead = false,
|
||||||
trailLevel = 10,
|
trailLevel = 10,
|
||||||
trailMax = 10,
|
trailMax = 20,
|
||||||
trailRegen = 0.1,
|
trailRegen = 0.1,
|
||||||
putTrail = true,
|
putTrail = true,
|
||||||
name = "BLU",
|
name = "BLU",
|
||||||
@ -67,7 +67,7 @@ local resetPlayers = function()
|
|||||||
x = 3,
|
x = 3,
|
||||||
y = -5,
|
y = -5,
|
||||||
direction = -1,
|
direction = -1,
|
||||||
char = "@",
|
char = "~",
|
||||||
color = {
|
color = {
|
||||||
colors.red,
|
colors.red,
|
||||||
colors.red,
|
colors.red,
|
||||||
@ -81,7 +81,7 @@ local resetPlayers = function()
|
|||||||
},
|
},
|
||||||
dead = false,
|
dead = false,
|
||||||
trailLevel = 10,
|
trailLevel = 10,
|
||||||
trailMax = 10,
|
trailMax = 20,
|
||||||
trailRegen = 0.1,
|
trailRegen = 0.1,
|
||||||
putTrail = true,
|
putTrail = true,
|
||||||
name = "RED",
|
name = "RED",
|
||||||
@ -1456,10 +1456,10 @@ local networking = function()
|
|||||||
end
|
end
|
||||||
if channel == port and type(msg) == "table" then
|
if channel == port and type(msg) == "table" then
|
||||||
if type(msg.gameID) == "string" then
|
if type(msg.gameID) == "string" then
|
||||||
if waitingForGame and (type(msg.new) == "number") then
|
if waitingForGame and (type(msg.time) == "number") then
|
||||||
|
|
||||||
-- called while waiting for match
|
-- called while waiting for match
|
||||||
if msg.new < os.time() then
|
if msg.time < os.epoch("utc") then
|
||||||
isHost = false
|
isHost = false
|
||||||
you, nou = nou, you
|
you, nou = nou, you
|
||||||
gamename = msg.gameID
|
gamename = msg.gameID
|
||||||
@ -1476,8 +1476,7 @@ local networking = function()
|
|||||||
transmit(port, {
|
transmit(port, {
|
||||||
player = player,
|
player = player,
|
||||||
gameID = gamename,
|
gameID = gamename,
|
||||||
new = isHost and (-math.huge) or (math.huge),
|
time = isHost and (-math.huge) or (math.huge),
|
||||||
time = os.epoch("utc"),
|
|
||||||
name = argumentName,
|
name = argumentName,
|
||||||
grid = initGrid
|
grid = initGrid
|
||||||
})
|
})
|
||||||
@ -1560,7 +1559,6 @@ local startGame = function()
|
|||||||
transmit(port, {
|
transmit(port, {
|
||||||
player = player,
|
player = player,
|
||||||
gameID = gamename,
|
gameID = gamename,
|
||||||
new = os.time(),
|
|
||||||
gameDelay = gameDelayInit,
|
gameDelay = gameDelayInit,
|
||||||
time = os.epoch("utc"),
|
time = os.epoch("utc"),
|
||||||
name = argumentName,
|
name = argumentName,
|
||||||
|
Loading…
Reference in New Issue
Block a user