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

ace_interact_menu_consolidateSingleChild Setting prevents insertion of USB Drives #414

Closed
mrschick opened this issue Feb 19, 2024 · 7 comments

Comments

@mrschick
Copy link

When the "ACE Interaction Menu" setting called "Consolidate single child actions" (ace_interact_menu_consolidateSingleChild) is enabled, the following error occurs when trying to plug in a USB Drive.
20240219142407_1
As a result, the USB Drive can not be plugged in unless the setting is disabled.
The ACE Interaction interface also somewhat bugs itself and remains in view despite releasing ⊞ Win, requiring going back to a previous node to unstick it, though that is probably just the way Ace reacts to an interaction's exception.

@mrschick
Copy link
Author

mrschick commented Feb 19, 2024

Maybe #406 could fix this, I'll check it out if I find the time.

@y0014984
Copy link
Owner

Interesting. I will have a look into it.

@mrschick
Copy link
Author

Issue is also present in #406. It occurs at addons\flashdrive\functions\fnc_initInterface.sqf:57

private _condition = 
{
	params ["_target", "_player", "_params"];
	(_params select 0) params ["_index", "_name", "_rel_pos", "_rot_yaw", "_rot_pitch", "_rot_roll"];
	private _occupiedList = _target getVariable "AE3_USB_Interfaces_occupied";

	isNull (_occupiedList select _index);
};

Apparently when consolidateSingleChild is enabled, _index is filled with the USB Drive's full Config name, i.e: Item_FlashDisk_AE3_ID_1, instead of the index corresponding to the selected (unoccupied) interface.

@mrschick
Copy link
Author

mrschick commented Apr 12, 2024

Got it.

Basically, when consolidateSingleChild is disabled, the condition is called with the _params parameter just containing data on the respective interface, like so:

[[1,"USB1",[-0.19,-0.028,-0.145],90,0,180]]

However, when consolidateSingleChild is enabled, the Drive's classname is prepended to the parameter, resulting in the following format:

["Item_FlashDisk_AE3_ID_1",[1,"USB1",[-0.19,-0.028,-0.145],90,0,180]]

I guess that's just an ACE quirk, will investigate further.

Because of this, (_params select 0) params in the condition's code will then parse _index = "Item_FlashDisk_AE3_ID_1", leading to the error in _occupiedList select _index.

params ["_target", "_player", "_params"];
(_params select 0) params ["_index", "_name", "_rel_pos", "_rot_yaw", "_rot_pitch", "_rot_roll"];
private _occupiedList = _target getVariable "AE3_USB_Interfaces_occupied";

isNull (_occupiedList select _index);

I found a fix, basically checking if the first element of _params is an Array and parsing either index 0 or 1 as interface data depending on that (detailed here in #406).
It should always work, as when carrying more than 1 USB Drive, the action would not be consolidated.

@Dystopian
Copy link

I guess that's just an ACE quirk, will investigate further.

Indeed, child params are used with parent condition code. Please check if it's fixed with acemod/ACE3#9946.

@mrschick
Copy link
Author

Can confirm that your PR fixes this issue, many thanks 👍🏻

@mrschick
Copy link
Author

This has now been fixed publicly by ACE v3.17.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants