mirror of
https://github.com/LDDestroier/CC/
synced 2025-05-31 10:54:04 +00:00
Reduced network load further
Now, clients will not send their playerdata -- only their inputs. Likewise, hosts don't send their inputs. This is to prepare for the eventual usage of Skynet, but also just to optimize a bit.
This commit is contained in:
parent
d55cd40dd1
commit
f4bd0470bb
22
tron
22
tron
@ -659,11 +659,11 @@ end
|
|||||||
|
|
||||||
local sendInfo = function(gameID)
|
local sendInfo = function(gameID)
|
||||||
modem.transmit(port, port, {
|
modem.transmit(port, port, {
|
||||||
player = player,
|
player = isHost and player or nil,
|
||||||
gameID = gameID,
|
gameID = gameID,
|
||||||
keysDown = keysDown,
|
keysDown = isHost and nil or keysDown,
|
||||||
trail = isHost and lastTrails or {},
|
trail = isHost and lastTrails or nil,
|
||||||
deadGuys = isHost and deadGuys or {},
|
deadGuys = isHost and deadGuys or nil,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -813,7 +813,7 @@ local networking = function()
|
|||||||
while true do
|
while true do
|
||||||
evt, side, channel, repchannel, msg, distance = os.pullEvent("modem_message")
|
evt, side, channel, repchannel, msg, distance = os.pullEvent("modem_message")
|
||||||
if channel == port and repchannel == port and type(msg) == "table" then
|
if channel == port and repchannel == port and type(msg) == "table" then
|
||||||
if type(msg.player) == "table" and type(msg.gameID) == "string" then
|
if type(msg.gameID) == "string" then
|
||||||
|
|
||||||
if waitingForGame and (type(msg.new) == "number") then
|
if waitingForGame and (type(msg.new) == "number") then
|
||||||
if msg.new < os.time() then
|
if msg.new < os.time() then
|
||||||
@ -838,12 +838,14 @@ local networking = function()
|
|||||||
|
|
||||||
elseif msg.gameID == gamename then
|
elseif msg.gameID == gamename then
|
||||||
if not isHost then
|
if not isHost then
|
||||||
player = msg.player
|
if type(msg.player) == "table" then
|
||||||
for i = 1, #msg.trail do
|
player = msg.player
|
||||||
putTrailXY(unpack(msg.trail[i]))
|
for i = 1, #msg.trail do
|
||||||
|
putTrailXY(unpack(msg.trail[i]))
|
||||||
|
end
|
||||||
|
deadGuys = msg.deadGuys
|
||||||
|
os.queueEvent("move_tick")
|
||||||
end
|
end
|
||||||
deadGuys = msg.deadGuys
|
|
||||||
os.queueEvent("move_tick")
|
|
||||||
elseif type(msg.keysDown) == "table" then
|
elseif type(msg.keysDown) == "table" then
|
||||||
netKeysDown = msg.keysDown
|
netKeysDown = msg.keysDown
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user