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

Functions are not compiled in Eden #292

Closed
SzwedzikPL opened this issue Mar 4, 2016 · 8 comments
Closed

Functions are not compiled in Eden #292

SzwedzikPL opened this issue Mar 4, 2016 · 8 comments
Labels
Milestone

Comments

@SzwedzikPL
Copy link
Contributor

I have a couple of modules that are executed in eden. I've added hack like this:

class Extended_DisplayLoad_EventHandlers {
    class Display3DEN {
        ADDON = "[] call CBA_fnc_preInit;";
    };
};

to make sure that functions are compiled for those modules and that worked pretty well. Now becouse of #283 modules do not work after returning to eden -> [XEH]: 3den preview detected. Abort preInit.

Is this possible to add support of CBA preInit in Eden?

@PabstMirror
Copy link
Contributor

You should be able to use something like
(uiNamespace getVariable "CBA_fnc_hashCreate")
in 3den as the functions are compiled during game start.

But this would really only work for "static" functions.

@SzwedzikPL
Copy link
Contributor Author

You should be able to use something like
(uiNamespace getVariable "CBA_fnc_hashCreate")
in 3den as the functions are compiled during game start.

You're right but i can't use it in module config
function = QUOTE(uiNamespace getVariable QUOTE(QUOTE(DFUNC(module_function)))); do not work

@nicolasbadano
Copy link
Contributor

@SzwedzikPL, he meant:

function = QUOTE([] call (uiNamespace getVariable QUOTE(QUOTE(DFUNC(module_function)))));

@SzwedzikPL
Copy link
Contributor Author

@SzwedzikPL, he meant:
function = QUOTE([] call uiNamespace getVariable QUOTE(QUOTE(DFUNC(module_function))));

This do not work aswell

@commy2
Copy link
Contributor

commy2 commented Mar 5, 2016

The work around with uiNamespace getVariable only works when you precompile the functions on game start (via Extended_PreStart_EventHandlers), or don't use -world="Empty"

BI doesn't execute functions with preInit = 1 when entering 3den from the main menu.
They do when returning from a preview though, because is3den returns false in that moment. Pretty sure this is not fully working as intended. Or probably they never even thought about this...
Ref: https://gist.github.com/commy2/beaba9b61e8493d11932#file-initfunctions-sqf-L522-L541

Question is, should preInit be called in 3den or not?
And should postInit be called too?

These are the possible scenarios:

  • A.) execute neither preInit, nor postInit (like BI intends)

pros:
shared behaviour with BI functions

cons:
preInit functions are not available before the first unit is placed and it's init is executed
XEH init events are not executed in 3den

  • B.) execute preInit, but not postInit

pros:
functions are defined before first unit is placed
postInit are called after all mission objects are placed

cons:
postInit are only called when you preview or start the mission

  • C.) execute preInit and postInit

pros:
everything is defined before a single unit is placed

cons:
all placed units are treated as if they were createVehicle'd (they technically are), but that can lead to different behaviour when loading the progress later and when playing the finished mission
most overhead

These are the 3 possibilites I see. I don't like C at all, because it might lead to different behaviour when the mission is finished, vs when the mission is made.
My first decission was to go with A, but now I'm not sure anymore.

@SzwedzikPL
Copy link
Contributor Author

I understand. Until you decide how XEH should handle Eden i will use something like this:

class Extended_DisplayLoad_EventHandlers {
    class Display3DEN {
        ADDON = "[] call CBA_fnc_preInit;";
    };
    class RscDisplayInterrupt {
        cba_xeh_3denFix = "";
    };
};

to run preInit on eden first load and disable your 3den fix.

Option B looks perfect from my point of view :] After making preInit to run on first load by Display3DEN DisplayLoad EH XEH init events work in eden. Im using it to make something like this: https://www.youtube.com/watch?v=DPoruQUVYhc
It's using XEH init.

@nicolasbadano
Copy link
Contributor

I'd advocate for a forth alternative:

  • D.) execute preInit, postInitEden, initPostEden:

Similar to B, but launching 3den specific versions of postInit and initPost. These could be hooked by mods to perform specific actions inside the editor.

@commy2
Copy link
Contributor

commy2 commented Mar 6, 2016

I don't see the benefit. You could always simply use the is3den command.

@commy2 commy2 added the Feature label Mar 6, 2016
Killswitch00 added a commit that referenced this issue Mar 6, 2016
always execute XEH preInit in 3den, fix #292
@commy2 commy2 added this to the 2.4.0 milestone May 18, 2016
@commy2 commy2 added Bug and removed Feature labels May 18, 2016
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

4 participants