mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 17:29:03 -06:00
(Hopefully) Fixed an obscure bug with SOCD and joystick hats
This commit is contained in:
parent
6ecea7edb1
commit
36f2672e06
14
main.lua
14
main.lua
@ -258,13 +258,27 @@ function love.joystickhat(joystick, hat, direction)
|
|||||||
has_hat = true
|
has_hat = true
|
||||||
end
|
end
|
||||||
if input_pressed then
|
if input_pressed then
|
||||||
|
dir = direction
|
||||||
|
for i, direction in ipairs{"d", "l", "u", "r"} do
|
||||||
|
if dir:sub(1, 1) == direction or dir:sub(2) == direction then
|
||||||
scene:onInputPress({input=input_pressed, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
scene:onInputPress({input=input_pressed, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
||||||
|
else
|
||||||
|
scene:onInputRelease({input=input_pressed, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
||||||
|
end
|
||||||
|
end
|
||||||
elseif has_hat then
|
elseif has_hat then
|
||||||
for i, direction in ipairs{"d", "l", "ld", "lu", "r", "rd", "ru", "u"} do
|
for i, direction in ipairs{"d", "l", "ld", "lu", "r", "rd", "ru", "u"} do
|
||||||
scene:onInputRelease({input=config.input.joysticks[joystick:getName()].hats[hat][direction], type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
scene:onInputRelease({input=config.input.joysticks[joystick:getName()].hats[hat][direction], type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
||||||
end
|
end
|
||||||
elseif direction ~= "c" then
|
elseif direction ~= "c" then
|
||||||
|
dir = direction
|
||||||
|
for i, direction in ipairs{"d", "l", "u", "r"} do
|
||||||
|
if dir:sub(1, 1) == direction or dir:sub(2) == direction then
|
||||||
scene:onInputPress({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
scene:onInputPress({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
||||||
|
else
|
||||||
|
scene:onInputRelease({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
for i, direction in ipairs{"d", "l", "ld", "lu", "r", "rd", "ru", "u"} do
|
for i, direction in ipairs{"d", "l", "ld", "lu", "r", "rd", "ru", "u"} do
|
||||||
scene:onInputRelease({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
scene:onInputRelease({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})
|
||||||
|
Loading…
Reference in New Issue
Block a user