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

consolidateSingleChild breaks interactions #9876

Closed
ilbinek opened this issue Mar 25, 2024 · 3 comments
Closed

consolidateSingleChild breaks interactions #9876

ilbinek opened this issue Mar 25, 2024 · 3 comments
Labels

Comments

@ilbinek
Copy link
Contributor

ilbinek commented Mar 25, 2024

Mods (complete and add to the following information):

  • Arma 3: 2.14
  • CBA: 3.16.1
  • ACE3: 3.16.3

Description:
When consolidateSingleChild is enabled, interactions that were consolidated never get called. This is issue for mods using ACE interactions, not for ACE itself - that works

Steps to reproduce:

  1. Set consolidateSingleChild to true
  2. Get an addon that allows for this to happen (shameless plug for vasilek)
  3. Try to execute consolidated interaction

Expected behaviour:
The interaction should happen

Where did the issue occur?

  • Dedicated / Self-Hosted Multiplayer / Singleplayer / Editor (Singleplayer) / Editor (Multiplayer)

Additional context:
Discord thread

@Dystopian
Copy link
Contributor

All action conditions (including parent action conditions) are checked before statement is called. If any condition fails statement is not called.
vasilek has this config:

    class TBD_2B9_VASILEK_MAGAZINE : NATO_Box_Base {
        class ACE_Actions {
            class ACE_Round_1_Load {
                displayName = CSTRING(LOAD);
                condition = QUOTE([ARR_2(_target,1)] call FUNC(canBeLoaded));
                class ACE_Round_1_Load_HE {
                    displayName = CSTRING(HE_STRING);
                    condition = QUOTE([ARR_3(_target,1,QUOTE(QUOTE(HE)))] call FUNC(canLoadShell));
                    statement = QUOTE([ARR_3(_target,1,QUOTE(QUOTE(HE)))] call FUNC(loadShell));
                };
...

And FUNC(canBeLoaded) is:

#include "..\script_component.hpp"

params ["_mag", "_nbr"];

// Check if current slot is empty
private _text = format ["round_%1", _nbr];
if ((_mag getVariable [_text, ""]) != "") exitWith { false };

// Check if prev is empty
if (_nbr > 1) exitWith {
    _text = format ["round_%1", (_nbr - 1)];
    (_mag getVariable [_text, ""]) != ""
};

It returns nil if _nbr == 1. For condition it must return boolean.

When menu consolidation is disabled, ACE "forgives" nil return value and it works.
When menu consolidation is enabled, conditions are stacked and return value becomes important. Condition fails and statement is not called.

You can check it for TBD_2B9_VASILEK_MAGAZINE slots 2-4: they work with consolidation.

I didn't check if menu works with fixed function but I'm sure it will work.

@ilbinek
Copy link
Contributor Author

ilbinek commented Mar 26, 2024

Thanks for the investigation, you're correct and this was indeed the issue.

@mrschick
Copy link
Contributor

I recently encountered a similar issue in the Advanced Equipment mod, caused by the argument passed to an action's condition being different depending on the consolidateSingleChild setting.
More specifically, it would add an additional value to the passed argument that the code didn't expect, causing an error. More details here.
Looking over the afflicted function, I couldn't find a mistake or reason for why the passed params would be different, but I could have missed it 🤷🏻‍♂️

Is this intended behaviour by the ACE Interact Framework or an error in ACE/Advanced Equipment?

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

No branches or pull requests

3 participants