intercept icon indicating copy to clipboard operation
intercept copied to clipboard

Remove XEH eventhandlers

Open dedmen opened this issue 8 years ago • 3 comments

If we remove the XEH eventhandlers: https://github.com/intercept/intercept/blob/master/rv/addons/core/config.cpp#L904-L939 https://github.com/intercept/intercept/blob/master/src/client/headers/intercept.hpp#L28-L71 We can move pre/postInit/preStart (https://github.com/intercept/intercept/blob/master/rv/addons/core/config.cpp#L961-L978) to cfgFunctions.

That way we can get rid of the CBA dependency. The only problem is https://github.com/intercept/intercept/blob/master/rv/addons/core/config.cpp#L980-L984 I don't see a alternative to that without CBA.

The problem is that you can't use Intercept only on the Server backend. Because you require CBA. Which enforces itself to be installed on all clients.

This would also remove most of the global event functions in Intercept. Which is a good thing because right now we are hooking every event even though no-one wants it and create a potential perf problem. You can use the new eventhandler system and dynamically add the eventhandlers at preInit. Which is also easier to use because you can add eventhandlers to a specific object instead of using the XEH on all objects and then filtering on the right object.

Ofcause XEH is nice to have in some situations. We can also make a optional addon that adds the XEH eh's and leave the functions in Intercept. But that might confuse people why these functions never fire...

for the versioning check I can just disable the postInitServer with a config patch. That removes the warnings. https://github.com/CBATeam/CBA_A3/blob/master/addons/versioning/CfgEventHandlers.hpp#L16

Commy: The setting thing uses create simple object, and that class would be unknown to the clients. That might be a problem. We could overwrite createNamespace to always create local thingies

If we can just make CBA server-side only we wouldn't have any problem.. and could keep the XEH's. The real problem is only that clients are forced to have CBA if the server runs it.

dedmen avatar Dec 01 '17 08:12 dedmen

We can push this back till we have a official Intercept CBA plugin. Then we can just move the XEH's into the Plugin. But we need some solution for the mission_ended EH. We are waiting for unload of the mission display. We can't modify it's displayUnload because that could cause problems. Can we just add a invisible UI element to the mission display and use it's onUnload?

Commy says that should work. Add a control with onUnload and have it be invisible. That will replace our mission_ended so the last hurdle is solved.

dedmen avatar Dec 01 '17 09:12 dedmen

// reqAdd: "A3_Ui_F"
class RscText;

class RscDisplayEmpty {
    class controls;
};

class RscDisplayMission: RscDisplayEmpty {
    class controls: controls {
        class Intercept_MissionEnded: RscText {
            onUnload = "['mission_ended', []] call (uiNamespace getVariable 'intercept_fnc_event');";
        };
    };
};

commy2 avatar Dec 02 '17 21:12 commy2

The real problem is only that clients are forced to have CBA if the server runs it.

https://github.com/CBATeam/CBA_A3/pull/866

dedmen avatar Dec 31 '17 18:12 dedmen