fix merge

This commit is contained in:
PabstMirror 2024-06-09 18:24:16 -05:00
parent a735ec5803
commit 6c98b98c5b

View File

@ -59,47 +59,3 @@ if (_ignoreVirtual && {(unitIsUAV ACE_player) || {getNumber (configOf ACE_player
// Add event now // Add event now
private _newEH = ACE_player addEventHandler [_type, _code]; private _newEH = ACE_player addEventHandler [_type, _code];
ACE_player setVariable [_key, _newEH]; ACE_player setVariable [_key, _newEH];
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Adds event handler just to ace_player
*
* Arguments:
* 0: Key <STRING>
* 1: Event Type <STRING>
* 2: Event Code <CODE>
*
* Return Value:
* None
*
* Example:
* ["example", "FiredNear", {systemChat str _this}] call ace_common_fnc_addPlayerEH
*
* Public: Yes
*/
params [["_key", "", [""]], ["_type", "", [""]], ["_code", {}, [{}]]];
if (isNil QGVAR(playerEventsHash)) then { // init
GVAR(playerEventsHash) = createHashMap;
["unit", {
params ["_newPlayer", "_oldPlayer"];
TRACE_3("",_newPlayer,_oldPlayer,count GVAR(playerEventsHash));
{
private _var = format [QGVAR(playerEvents_%1), _x];
private _oldEH = _oldPlayer getVariable [_var, -1];
_oldPlayer removeEventHandler [_y#0, _oldEH];
_oldPlayer setVariable [_var, nil];
private _newEH = _newPlayer addEventHandler _y;
_newPlayer setVariable [_var, _newEH];
} forEach GVAR(playerEventsHash);
}, false] call CBA_fnc_addPlayerEventHandler;
};
private _event = [_type, _code];
GVAR(playerEventsHash) set [_key, _event];
if (isNull ACE_player) exitWith {};
private _var = format [QGVAR(playerEvents_%1), _key];
private _newEH = ACE_player addEventHandler _event;
ACE_player setVariable [_var, _newEH];