RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
991 stars 175 forks source link

:angel:Script: added `inputs.setEventSimulatedValue()` :keyboard: #3098

Closed ohlidalp closed 7 months ago

ohlidalp commented 8 months ago
    /**
    * Set a permanent (you must also clear it!) override for an input event; 
    * Value can be between -1 and 1; Don't forget to reset back to 0!
    */
    void setEventSimulatedValue(inputEvents ev, float val);

obrazek

ohlidalp commented 8 months ago
        /**
        * Tells if the game recognizes the key as pressed (not blocked by game state or obscured by GUI).
        */
        bool isKeyDownEffective(keyCodes keycode);

        /**
        * Get the safe "was key pressed?" value, optionally specifying the repeat ('bounce') interval.
        */
        bool isKeyDownValueBounce(keyCodes keycode, float time = 0.2f);  

willmKeyStates

ohlidalp commented 8 months ago

Available key codes:

    // Numpad
    KC_NUMPAD1,
    KC_NUMPAD2,
    KC_NUMPAD3,
    KC_NUMPAD4,
    KC_NUMPAD5,
    KC_NUMPAD6,
    KC_NUMPAD7,
    KC_NUMPAD8,
    KC_NUMPAD9,
    KC_NUMPAD0,

    // Number keys (not the numpad)
    KC_1,
    KC_2,
    KC_3,
    KC_4,
    KC_5,
    KC_6,
    KC_7,
    KC_8,
    KC_9,
    KC_0,

    // Function keys
    KC_F1 ,
    KC_F2 ,
    KC_F3 ,
    KC_F4 ,
    KC_F5 ,
    KC_F6 ,
    KC_F7 ,
    KC_F8 ,
    KC_F9 ,
    KC_F10,
    KC_F11,
    KC_F12,

    // Edit keys
    KC_INSERT,
    KC_DELETE,
    KC_BACKSPACE,
    KC_CAPSLOCK,
    KC_NUMLOCK,
    KC_SCROLLLOCK,
    KC_TAB,

    // Navigation keys
    KC_ESCAPE,
    KC_RETURN,
    KC_LEFT  ,
    KC_RIGHT ,
    KC_HOME  ,
    KC_UP    ,
    KC_PGUP  ,
    KC_END   ,
    KC_DOWN  ,
    KC_PGDOWN,
    KC_PAUSE ,

    // Modifiers
    KC_LCTRL ,
    KC_RCTRL ,
    KC_LSHIFT,
    KC_RSHIFT,
    KC_LALT  ,
    KC_RALT  ,
    KC_LWIN  ,
    KC_RWIN  ,

    // Special characters
    KC_MINUS     ,
    KC_EQUALS    ,
    KC_LBRACKET  ,
    KC_RBRACKET  ,
    KC_SEMICOLON ,
    KC_APOSTROPHE,
    KC_GRAVE     ,
    KC_BACKSLASH ,
    KC_COMMA     ,
    KC_PERIOD    ,
    KC_SLASH     ,
    KC_MULTIPLY  ,
    KC_SPACE     ,
    KC_SUBTRACT  ,
    KC_ADD       ,