Ven0maus / SOD.Common

A common library for shadows of doubt modding.
MIT License
4 stars 4 forks source link

feat: add InteractablePreset.InteractionKey property to input detection event args #27

Closed ReveredRedHood closed 6 months ago

ReveredRedHood commented 6 months ago

Enables this functionality:

Lib.InputDetection.OnButtonStateChanged += OnButtonStateChanged;

private void OnButtonStateChanged(object sender, InputDetectionEventArgs e) {
    // added e.Key, so you don't have to use a string like "Primary"
    // only works for InteractablePreset.InteractionKey enum entries
    if (e.Key == InteractablePreset.InteractionKey.LeanLeft && e.IsDown) {
        // stuff
    }
    if (e.Key == InteractablePreset.InteractionKey.LeanRight && e.IsDown) {
        // stuff
    }
    if (e.Key == InteractablePreset.InteractionKey.flashlight) {
        // stuff
    }
}

Note: There were two of these "keyenuminputdetection" feature branches... I was confused about why my branch was 3 commits behind but I don't think it's anything I did.