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

playerEH - Optional call function if player defined #490

Merged
merged 2 commits into from
Aug 31, 2016
Merged

Conversation

PabstMirror
Copy link
Contributor

  • Adds optional param to call event handler function if player is already defined.

This makes it simpler to use addPlayerEventHandler by adding an option to guarantee the function will be run even if the changed xxxEvent has already happened.

Example use:

[] spawn {
    // Dummy playerEH - represents some other mod has already installed the player EH system
    ["unit", {}] call CBA_fnc_addPlayerEventHandler;
    sleep 0.1;

    // This will not print out anything as the unitEvent has already happened:
    ["unit", {systemChat format ["unit eh (False) - %1",_this]}] call CBA_fnc_addPlayerEventHandler;

    // This will print right away
    ["unit", {systemChat format ["unit eh (True) - %1",_this]}, true] call CBA_fnc_addPlayerEventHandler;
};

Ref acemod/ACE3#4289

Adds optional param to call event handler function if player is already
defined
@PabstMirror PabstMirror added this to the 3.0.1 milestone Aug 30, 2016
@commy2
Copy link
Contributor

commy2 commented Aug 31, 2016

Rename _autoCall to _applyRetroactively for consistency with CBA_fnc_addClassEventHandler ?

@PabstMirror
Copy link
Contributor Author

I like that var name better, switched.

@commy2 commy2 merged commit fbce7f9 into master Aug 31, 2016
@commy2 commy2 deleted the playerEH-autocall branch August 31, 2016 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants