CombinedArmsGaming / CAFE3

F3_CA but bouncier.
2 stars 3 forks source link

[Refactor] Change to an event-driven radio system. #162

Closed Bubbus closed 1 year ago

Bubbus commented 1 year ago

Pull Request Description

When merged this pull request will:

Release Notes

A new radio system has been added which should make it easier and quicker to set up radios for missions. For more information, check the new acre_radio_configuration.sqf file in the configuration folder.

In addition, squad leaders can now manage the radio channels for the whole group and automatically push the radio channels onto their squad members - this should allow SLs to solve radio issues without having to ask everyone what net they're on.

Finally, a new radio list has been added which should make it easier to see radio information, and hide it away when not needed.

IMPORTANT

Resolves #133

Cre8or commented 1 year ago

As discussed, I'd modify the ACRE override to use two distinct functions: your override, and the original function (compiled in the traditional way in CfgFunctions. but using a soft-dependency). The functions config would then become

#if __has_include("\idi\acre\addons\main\stringtable.xml")
    class acre_ace_interact
    {
        class overrides
        {
            file = "components\radio\acre";
            class radioListChildrenActions{};
            class radioListChildrenActions_original
            {
                file = "idi\acre\addons\ace_interact\fnc_radioListChildrenActions.sqf";
            };
        }
    }
#endif

Then we can omit lines 5-12 of your override:

if (isNil "f_var_originalFunction_addRadioActionsToClass") then
{
    // Why isn't this easier to do in SQF?  Why does it have to be so brittle?  thanks lads
    f_var_originalFunction_addRadioActionsToClass = compile preprocessFileLineNumbers "idi\acre\addons\ace_interact\fnc_radioListChildrenActions.sqf";
};

private _children = _this call f_var_originalFunction_addRadioActionsToClass;

and just do:

private _children = _this call acre_ace_interact_fnc_radioListChildrenActions_original;