Skip to content

Activation KEYPRESS events not restoring previously global assigned key handlers #91

@swordmaster2k

Description

@swordmaster2k

It is possible to overwrite a global key handler such as the swordslash in the action battle system using a KEYPRESS based event. Once the event has finished running the key handler is not being restored.

The bug occurs in the character.js code:

    events.forEach(function (event) {
        if (event.program) {
            if (event.type.toUpperCase() === "OVERLAP") {
                rpgwizard.runProgram(PATH_PROGRAM.concat(event.program), object);
            } else if (event.type.toUpperCase() === "KEYPRESS") {
                if (event.key) {
                    entity.previousKeyHandler = {
                        key: event.key,
                        callback: rpgwizard.keyboardHandler.downHandlers[event.key]
                    };
                    var callback = function () {
                        rpgcode.unregisterKeyDown(event.key, true);
                        rpgwizard.runProgram(PATH_PROGRAM.concat(event.program), object);
                    };
                    rpgcode.registerKeyDown(event.key, callback, true);
                }
            }
        }
    });

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions