Comments (5)
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";
};
from cba_a3.
After some testing:
-
When 'Use PIP optics' option is disabled - 2D -> 3D switch works fine.
-
When PIP optics enabled - direct call of actual switch code works perfectly fine:
CBA_A3/addons/accessory/fnc_switchAttachment.sqf
Lines 73 to 77 in 8bb83aa
-
But direct call of
[2, "next"] call CBA_accessory_fnc_switchAttachment;
is buggy for some reason. However if exec call twice - in current and next frame - it works:
[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 :)
from cba_a3.
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:
- On first step it finds target class successfully, but as _testItem is not "" - iteration continues
Test item: CUP_optic_ElcanM145_PIP.
Configs found: [bin\config.bin/CfgWeapons/CUP_optic_ElcanM145_PIP/MRT_SwitchItemNextClass].
Configs not empty, test item class: CUP_optic_ElcanM145_3D,
Test against UsageArray passed.
_switchItem = CUP_optic_ElcanM145_3D.
- Tests found 3D item and successfully finds 'next' class for it. But again - _testItem is not empty and loop continues
Test item: CUP_optic_ElcanM145_3D.
Configs: [bin\config.bin/CfgWeapons/CUP_optic_ElcanM145_3D/MRT_SwitchItemNextClass].
Configs not empty, test item class: CUP_optic_ElcanM145.
Test against UsageArray passed.,
_switchItem = CUP_optic_ElcanM145.
Due to cyclic scheme of MRT Switch used for CUP scopes - loop continues until reaches execution limit (10000 iterations)
- Loop is terminated. Resulting in _switchItem to be "CUP_optic_ElcanM145". After switching,
optics
handlers replaces 2d scope to PIP variant. From player's perspective nothing was changed at all - the very same scope reamined.
When user is spamming switch button, i guess, sometimes script starts when 2D variant is added, but not yet replaced with PIP variant by optics
. So in this case on loop termination - 3D variant is the last one and switch works.
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)?
from cba_a3.
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.
from cba_a3.
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.
from cba_a3.
Related Issues (20)
- [Feature Request]: Add an extra parameter to CBA_fnc_execNextFrame for settable frame delay
- cba
- PerFrameHandler Framework Issue: Stuck Handler Prevents Execution of Subsequent Handlers HOT 8
- CBA_fnc_compatibleItems Error HOT 6
- Frame related functions dont work in Eden Editor
- Latest CBA version does not honor white space in the CBA settings Configuration File for Task Force Arrowhead Radio (BETA) HOT 2
- Some CBA Settings fail to import HOT 5
- Old armaholic link HOT 1
- Camera not working in Keyframe animation HOT 5
- Third Person View HOT 1
- Vehicle Parameter in GetIn Extended Eventhandler has wrong value HOT 2
- 3.16.1.231025 Bugs in /settings/fnc_parse.sqf and /common/fnc_addPlayerAction.sqf HOT 2
- Zeus not working. Zeus Game Master and Spawn AI modules, when placed in Eden Editor, don't work in Single Player HOT 1
- Problem when running arma with cba Addon "cba_ jam _spe" requires addon "WW2_spe_core_c_zzz_lastloaded_c" HOT 6
- My friend cannot connect to a server because Arma 3 says CBA is not detected even though it is installed HOT 8
- the addon config not working HOT 3
- Server doesn't read cba_settings.sqf file in userconfig HOT 4
- CBA_fnc_compatibleItems throws undefined variable errors when called with a single parameter HOT 1
- Модуль HC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cba_a3.