1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-25 22:47:52 +00:00

Merge remote-tracking branch 'public/bugfix/duplicate-controls-binds' into bugfix/public-fixes

This commit is contained in:
EliteMasterEric 2024-05-09 16:41:42 -04:00
commit 99bd3a370f

View file

@ -527,6 +527,14 @@ class Controls extends FlxActionSet
action.inputs[i].inputID = toAdd;
}
hasReplaced = true;
} else if (input.device == KEYBOARD && input.inputID == toAdd) {
// This key is already bound!
if (hasReplaced) {
// Remove the duplicate keybind, don't replace.
action.inputs.remove(input);
} else {
hasReplaced = true;
}
}
}
@ -989,6 +997,7 @@ class Controls extends FlxActionSet
for (control in Control.createAll())
{
var inputs:Array<Int> = Reflect.field(data, control.getName());
inputs = inputs.unique();
if (inputs != null)
{
if (inputs.length == 0) {
@ -1038,7 +1047,11 @@ class Controls extends FlxActionSet
var inputs = getInputsFor(control, device);
isEmpty = isEmpty && inputs.length == 0;
if (inputs.length == 0) inputs = [FlxKey.NONE];
if (inputs.length == 0) {
inputs = [FlxKey.NONE];
} else {
inputs = inputs.unique();
}
Reflect.setField(data, control.getName(), inputs);
}