-
Notifications
You must be signed in to change notification settings - Fork 149
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
Toggling 2D and 3D on optics doesn't consistently work unless you hit both applicable keybinds at once. #1626
Comments
I can reproduce, but don't know why this happens. CUP Weapons didn't update from Dec 2021. For optics that supports both 2d and 3d MRT Switch scheme is the same bi-directional 2D <-> 3D and one-directional PIP -> 3D (2D switches to PIP variant by CBA logic). Configs related to M145 scopes (2d (default), PIP and 3D variant): // 2D variant (default)
class CUP_optic_ElcanM145: ItemCore
{
scope = 2;
weaponInfoType = "CBA_ScriptedOptic";
class CBA_ScriptedOptic
{
reticleTexture = "\CUP\Weapons\CUP_Weapons_West_Attachments\Elcan_M145\data\elcan_m145w_reticle_ca.paa";
reticleTextureNight = "\CUP\Weapons\CUP_Weapons_West_Attachments\Elcan_M145\data\elcan_m145w_reticle_n_ca.paa";
reticleTextureSize = 1;
manualReticleNightSwitch = 1;
bodyTexture = "\CUP\Weapons\CUP_Weapons_West_Attachments\Elcan_M145\data\body\elcan_m145w_body_ca.paa";
bodyTextureNight = "\CUP\Weapons\CUP_Weapons_West_Attachments\Elcan_M145\data\body\elcan_m145w_body_night_ca.paa";
bodyTextureSize = 1.95;
};
MRT_SwitchItemNextClass = "CUP_optic_ElcanM145_3D";
MRT_SwitchItemPrevClass = "CUP_optic_ElcanM145_3D";
MRT_switchItemHintText = "$STR_CUP_dn_OpticsMode_2D";
};
// PIP variant
class CUP_optic_ElcanM145_PIP: CUP_optic_ElcanM145
{
author = "$STR_CUP_AUTHOR_STRING";
scope = 1;
class ItemInfo: ItemInfo
{
modelOptics = "\x\cba\addons\optics\cba_optic_big_pip.p3d";
};
MRT_SwitchItemNextClass = "CUP_optic_ElcanM145_3D";
MRT_SwitchItemPrevClass = "CUP_optic_ElcanM145_3D";
MRT_switchItemHintText = "$STR_CUP_dn_OpticsMode_2D";
};
// 3D variant
class CUP_optic_ElcanM145_3D: ItemCore
{
author = "$STR_CUP_AUTHOR_STRING";
dlc = "CUP_Weapons";
scope = 1;
inertia = 0.1;
MRT_SwitchItemNextClass = "CUP_optic_ElcanM145";
MRT_SwitchItemPrevClass = "CUP_optic_ElcanM145";
MRT_switchItemHintText = "$STR_CUP_dn_OpticsMode_3D";
}; |
After some testing:
[2, "next"] call CBA_accessory_fnc_switchAttachment;
[{ [2, "next"] call CBA_accessory_fnc_switchAttachment; }] call CBA_fnc_execNextFrame; Looks like there was a change in accessory functions in #1595. Tried older version of the CBA_accessory_fnc_switchAttachment - https://raw.githubusercontent.com/CBATeam/CBA_A3/953cdfe1ff97c17c6e2fbcfa4a98dfaf81fdbf8e/addons/accessory/fnc_switchAttachment.sqf - and it works good, but i can't tell why :) |
Something is wrong with this part: CBA_A3/addons/accessory/fnc_switchAttachment.sqf Lines 55 to 65 in 8bb83aa
TBH I don't quite understand what is the purpose of entire loop, but in this specific case the next happens:
Due to cyclic scheme of MRT Switch used for CUP scopes - loop continues until reaches execution limit (10000 iterations)
When user is spamming switch button, i guess, sometimes script starts when 2D variant is added, but not yet replaced with PIP variant by When PIP optics is disabled, the loop is only 2 step -- on step 1 in 2D class config reference to 3D is found, on step 2 in 3D class config reference to 2D is found, and as reference is equal to original 2d variant class - loop breaks. Previously no while loop was used, so _switchItem was picked from MRT_SwitchItemNextClass property and no additional checks were made. @PabstMirror Could you, please, tell - is it possible to fix on CBA side or should CUP use diffrent MRT-switch scheme (and what scheme should be used)? |
This is something I think I fixed. Caused in CUP by having only a next cycle being Regular > 3D > PIP. Would be nice to have some people confirm this is no longer an issue before closing. |
Works fine for me. |
Mods (complete and add to the following information):
2.14.150957
[e.g. 1.00 stable, rc, dev]v3.16.1.231025
(Public Workshop Release)Description:
When attempting to toggle optics state on a CUP optic that supports toggling of 2D and 3D modes, hitting the relevant keybinds will not actually change your optics' state unless you hit both the "Next optics state" and "Prev optics state" keybinds at the same time. Strangely, attempting to toggle 2D scopes normally will keep them 2D but attempting to toggle 3D scopes normally will turn them 2D.
Notably, other optics with different kinds of toggleable states (such as the flippable sight on the M68 CCO + AimM, adjustable reticle on the EKP-8-02 and Kobra, or filter on the 1P63) work completely fine.
Steps to reproduce:
Expected behavior:
I expected the various CUP optics to be properly able to switch 2D and 3D modes without hitting both applicable keybinds at once, and for other kinds of adjustable optics to be broken as well.
Where did the issue occur?
Log Files:
Additional context:
I should note that I haven't tested other mods with adjustable optics courtesy of CBA. This is simply because I do not know of any other mods with relevant adjustable optics.
Screenshots:
Below I demonstrate the inconsistency of toggling 2D and 3D.
2023-11-15.23-56-26.1.mp4
The text was updated successfully, but these errors were encountered: