1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-06-25 22:53:18 +00:00

Tried to counter weird turning for P2

This commit is contained in:
LDDestroier 2018-11-15 00:03:37 -05:00 committed by GitHub
parent 30bf688423
commit fa9bbaabfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
tron
View File

@ -683,6 +683,9 @@ local setDirection = function(keylist, p)
end end
end end
-- to counter P2's ability to turn twice in one tick
local inMidTurn = false
local game = function() local game = function()
local outcome local outcome
local p, np local p, np
@ -690,9 +693,13 @@ local game = function()
p = player[you] p = player[you]
np = player[nou] np = player[nou]
setDirection(keysDown, p)
if isHost then if isHost then
setDirection(keysDown, p)
setDirection(netKeysDown, np) setDirection(netKeysDown, np)
elseif not inMidTurn then
setDirection(keysDown, p)
inMidTurn = true
end end
if keysDown[control.lookLeft] then if keysDown[control.lookLeft] then
@ -764,6 +771,7 @@ local networking = function()
player = msg.player player = msg.player
trail = msg.trail trail = msg.trail
deadGuys = msg.deadGuys deadGuys = msg.deadGuys
inMidTurn = false
elseif type(msg.keysDown) == "table" then elseif type(msg.keysDown) == "table" then
netKeysDown = msg.keysDown netKeysDown = msg.keysDown
end end