1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-02-04 02:38:16 +00:00

Fix an issue where control binds would be duplicated and quickly multiply.

This commit is contained in:
EliteMasterEric 2024-05-09 00:46:21 -04:00
parent 1e359030c3
commit 4d5c0444c8

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);
}