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

Nightvision - Move to new engine events #9407

Open
LinkIsGrim opened this issue Sep 19, 2023 · 1 comment
Open

Nightvision - Move to new engine events #9407

LinkIsGrim opened this issue Sep 19, 2023 · 1 comment
Assignees
Milestone

Comments

@LinkIsGrim
Copy link
Contributor

LinkIsGrim commented Sep 19, 2023

Since 2.10 we've gotten OpticsModeChanged, OpticsSwitch, and VisionModeChanged in 2.08. We can use above to handle everything on the same frame instead of the next via CBA player event.

Relevant section:
https://github.com/acemod/ACE3/blob/master/addons/nightvision/XEH_postInit.sqf#L29-L34

Functions will need some touching up.

Will properly address #8249

@PabstMirror
Copy link
Contributor

also possible to detect if weapon/scope is giving nvg - followup after #9421
but needed events like these


private _currentWeapon = currentWeapon ACE_player;
if ((cameraView == "GUNNER") && {_currentWeapon != ""} && {
    (_vehicle currentVisionMode _currentWeapon) params ["_weaponVisionMode"];
    _weaponVisionMode == 1 // weapon/scope is giving nvg
}) then {
    _config = configFile >> "CfgWeapons" >> _currentWeapon;
    private _weaponIndex = [ACE_player, _currentWeapon] call EFUNC(common,getWeaponIndex);
    private _scope = (switch _weaponIndex do {
        case 0: {primaryWeaponItems _unit};
        case 1: {secondaryWeaponItems _unit};
        case 2: {handgunItems _unit};
        default {[]};
    }) param [2, ""];
    private _scopeConfig = configFile >> "CfgWeapons" >> _scope;
    private _opticsModes = ("true" configClasses (_scopeConfig >> "ItemInfo" >> "OpticsModes"));
    {
        systemChat format ["%1 = %2", _x, getArray (_x >> "visionMode")];
        if (((getArray (_x >> "visionMode")) findIf {"nvg" == _x}) != -1) exitWith {
            _config = _scopeConfig;
        };
    } forEach _opticsModes;
};

@PabstMirror PabstMirror self-assigned this Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants