Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe Mode - Fix disabled laser on safety switch #6639

Merged
merged 3 commits into from
Mar 12, 2019

Conversation

Dystopian
Copy link
Contributor

When merged this pull request will:

  • title.

@Dystopian
Copy link
Contributor Author

It works when you switch safety with hotkey. It doesn't work when safety is turned off with weapon mode key (related to #210).

@commy2
Copy link
Contributor

commy2 commented Oct 14, 2018

Pretty sure this breaks something else. UGL muzzles?

@Dystopian
Copy link
Contributor Author

Dystopian commented Oct 14, 2018

On my PC safety doen't correctly work with UGL before patch too. I don't know about anything else.

@alganthe
Copy link
Contributor

Bare my comments above, this has a core issue, GunLightOn and IRLaserOn switches you to your primary, there is currently no way to toggle flashlights and IR lasers for players that doesn't have an issue.

@commy2
Copy link
Contributor

commy2 commented Oct 16, 2018

Finally someone gets it.

@Dystopian
Copy link
Contributor Author

I already met this bug in

|| {_weaponIndex > 0 && {"" != primaryWeapon _player}} // Arma switches to primary weapon if exists
should add workaround here too.

@jonpas jonpas added kind/bug-fix Release Notes: **FIXED:** status/review-pending labels Nov 3, 2018
|| {"" == primaryWeapon _unit} // Arma switches to primary weapon if exists
}
) then {
{_unit action [_x, _unit]} forEach ["GunLightOn", "IRLaserOn"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be bellow the action [SwitchWeapon

@PabstMirror
Copy link
Contributor

MX-GL with modes [single, auto, gl]

Single:
Safe on -> Safe off with keybind: laser on, in semi
Safe on -> Safe off with F (next weapon): laser on, in auto
Auto:
Safe on -> Safe off with keybind: laser on, in semi
Safe on -> Safe off with F (next weapon): laser disabled, in auto
GL:
Safe on: laser disabled
restart laser
Safe off with keybind: laser disabled, in GL
Safe off with F (next weapon): laser disabled, in auto

This PR is an improvement over current, so I'd say we merge and fix it later.

Notes for me:
I think the problem is in the addActionEventHandler and the weapon swap happens before we think it should. So the currentMuzzle changes first and then the eh runs when we check inputAction.
Also, I can't see any reason why we are doing selectWeapon in fnc_lockSaftey

private _modes = [];
private _weaponCfg = configFile >> "CfgWeapons" >> _weapon;
{
    private _muzzle = _x;
    private _muzzleCfg = _weaponCfg;
    if (_x == "this") then {
        _muzzle = _weapon;
    } else {
        _muzzleCfg = _muzzleCfg >> _x;
    };
    {
        if (getNumber (configFile >> "CfgWeapons" >> _weapon >> _x >> "showToPlayer") == 1) then {
            _modes pushBack [_muzzle, _x];
        };
        if (_x == "this") then {
            _modes pushBack [_muzzle, _weapon];;
        };
    } forEach getArray (_muzzleCfg >> "modes");
} forEach getArray (_weaponCfg >> "muzzles");


// _previousModeIndex = (_modes find [currentMuzzle, currentMode]) - 1
// (_modes select _targetModeIndex) params [["_targetMuzzle", "#"], ["_targetMode", "#"]];

Copy link
Contributor

@PabstMirror PabstMirror left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging for 3.12.6
We can continue to improve later

@PabstMirror PabstMirror dismissed alganthe’s stale review March 12, 2019 16:26

"the sidearm issue is fixed"

@PabstMirror PabstMirror merged commit 2ff614c into acemod:master Mar 12, 2019
@Dystopian Dystopian deleted the fix_laser_on_safety branch March 12, 2019 17:37
BaerMitUmlaut pushed a commit that referenced this pull request Aug 5, 2019
* Fix disabled laser on safety switch

* Add workaround for switching to primary weapon

* Add UGL check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix Release Notes: **FIXED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants