several more fixes #2

Open
Ocawesome101 wants to merge 19 commits from Ocawesome101/LuPPC:master into master
Showing only changes of commit b16fa6aeb7 - Show all commits

View File

@ -110,15 +110,17 @@ function computer.signalTransformers.key_down(s, a, ascii, key, user)
return s, a, ascii, key, user return s, a, ascii, key, user
end end
if ascii == 27 then if ascii == 27 then
inesc_down = true inesc_down = native.uptime() / 1000
return nil return nil
elseif inesc_down then elseif inesc_down then
if (ascii < 48 or ascii > 57) and ascii ~= 59 and ascii ~= 91 then if (ascii < 48 or ascii > 57) and ascii ~= 59 and ascii ~= 91 then
inesc_down = false inesc_down = false
key = escmap[ascii] or 0 key = escmap[ascii] or 0
ascii = 0 ascii = 0
else elseif native.uptime() - inesc_down > 100 then -- 100ms timeout after {ESC}
return nil return nil
else
inesc_down = false
end end
end end
return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user
@ -130,15 +132,17 @@ function computer.signalTransformers.key_up(s, a, ascii, key, user)
return s, a, ascii, key, user return s, a, ascii, key, user
end end
if ascii == 27 then if ascii == 27 then
inesc_up = true inesc_up = native.uptime() / 1000
return nil return nil
elseif inesc_up then elseif inesc_up then
if (ascii < 48 or ascii > 57) and ascii ~= 59 and ascii ~= 91 then if (ascii < 48 or ascii > 57) and ascii ~= 59 and ascii ~= 91 then
inesc_up = false inesc_up = false
key = escmap[ascii] or 0 key = escmap[ascii] or 0
ascii = 0 ascii = 0
else elseif native.uptime() - inesc_up > 100 then -- 100ms timeout after {ESC}
return nil return nil
else
inesc_up = false
end end
end end
return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user