Fixed crashing when not passing negative key
This commit is contained in:
@@ -27,7 +27,13 @@ function Input:noKeysHolding(axle)
|
||||
end
|
||||
|
||||
function Input:getAxleValue(axle)
|
||||
return (input.isKeyDown(axle.Positive) and 1 or 0) - (input.isKeyDown(axle.Negative) and 1 or 0)
|
||||
local positiveValue = axle.Positive ~= nil and input.isKeyDown(axle.Positive)
|
||||
local negativeValue = axle.Negative ~= nil and input.isKeyDown(axle.Negative)
|
||||
|
||||
print(positiveValue)
|
||||
print(negativeValue)
|
||||
|
||||
return (positiveValue and 1 or 0) - (negativeValue and 1 or 0) -- (input.isKeyDown(axle.Positive) and 1 or 0) - (input.isKeyDown(axle.Negative) and 1 or 0)
|
||||
end
|
||||
|
||||
function Input:_trySetTargetValue(key)
|
||||
@@ -52,13 +58,18 @@ end
|
||||
|
||||
function Input:_mapKeys(axles)
|
||||
for k, v in pairs(axles) do
|
||||
self.keys[v.Negative] = {
|
||||
Axle = k
|
||||
}
|
||||
if v.Negative ~= nil then
|
||||
self.keys[v.Negative] = {
|
||||
Axle = k
|
||||
}
|
||||
end
|
||||
|
||||
if v.Positive ~= nil then
|
||||
self.keys[v.Positive] = {
|
||||
Axle = k
|
||||
}
|
||||
end
|
||||
|
||||
self.keys[v.Positive] = {
|
||||
Axle = k
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user