Prevent mapping the same key to two controls (fixes #20)

This commit is contained in:
Ishaan Bhardwaj
2021-07-11 13:53:27 -04:00
parent 2cb0416548
commit 61d5410f22
2 changed files with 8 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ function KeyConfigScene:onInputPress(e)
elseif e.scancode == "tab" then
self.set_inputs[configurable_inputs[self.input_state]] = "skipped"
self.input_state = self.input_state + 1
elseif e.scancode ~= "escape" then
elseif e.scancode ~= "escape" and not self.new_input[e.scancode] then
-- all other keys can be configured
self.set_inputs[configurable_inputs[self.input_state]] = "key " .. love.keyboard.getKeyFromScancode(e.scancode) .. " (" .. e.scancode .. ")"
self.new_input[e.scancode] = configurable_inputs[self.input_state]