From 0723df7dea5c0a0edbf5dd6f8698dbc93a615e87 Mon Sep 17 00:00:00 2001 From: Githawk Date: Sun, 6 Mar 2016 11:14:34 +0100 Subject: [PATCH] Replace execRemoteFnc with CBA events in rearm --- addons/rearm/XEH_postInit.sqf | 4 ++++ addons/rearm/functions/fnc_pickUpAmmo.sqf | 2 +- addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf | 7 +++---- addons/rearm/functions/fnc_rearmSuccess.sqf | 7 +++---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/rearm/XEH_postInit.sqf b/addons/rearm/XEH_postInit.sqf index a3038494da..acf8d2156b 100644 --- a/addons/rearm/XEH_postInit.sqf +++ b/addons/rearm/XEH_postInit.sqf @@ -6,3 +6,7 @@ if (isServer) then { addMissionEventHandler ["HandleDisconnect", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}]; }; + +[QGVAR(makeDummyEH), FUNC(makeDummy)] call CBA_fnc_addEventHandler; +[QGVAR(rearmEntireVehicleSuccessLocalEH), FUNC(rearmEntireVehicleSuccessLocal)] call CBA_fnc_addEventHandler; +[QGVAR(rearmSuccessLocalEH), FUNC(rearmSuccessLocal)] call CBA_fnc_addEventHandler; diff --git a/addons/rearm/functions/fnc_pickUpAmmo.sqf b/addons/rearm/functions/fnc_pickUpAmmo.sqf index 546fc318b7..1368b4e959 100644 --- a/addons/rearm/functions/fnc_pickUpAmmo.sqf +++ b/addons/rearm/functions/fnc_pickUpAmmo.sqf @@ -25,7 +25,7 @@ if !(isNull _dummy) exitWith {}; //_target attachTo [_unit, [0,0.7,0], "pelvis"]; _target attachTo [_unit, [0,1,0], "pelvis"]; { - [[_target, [[-1,0,0],[0,0,1]]], QFUNC(makeDummy), _x] call EFUNC(common,execRemoteFnc); + [QGVAR(makeDummyEH), [_dummy, [[-1,0,0],[0,0,1]]], _x] call CBA_fnc_targetEvent; } count (position _unit nearObjects ["CAManBase", 100]); _unit setVariable [QGVAR(dummy), _target]; //_unit setVariable [QEGVAR(dragging,isCarrying), true, true]; // breaks things, since it hides interact menu on _target diff --git a/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf index c12286516c..f82936b24a 100644 --- a/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf +++ b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf @@ -22,12 +22,11 @@ if (isServer) then { { _turretOwnerID = _vehicle turretOwner _x; if (_turretOwnerID == 0) then { - [[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), _target] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _truck] call CBA_fnc_targetEvent; } else { - EGVAR(common,remoteFnc) = [[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), 0]; - _turretOwnerID publicVariableClient QEGVAR(common,remoteFnc); + [QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _turretOwnerID] call CBA_fnc_targetEvent; }; } count REARM_TURRET_PATHS; } else { - [_this, QFUNC(rearmEntireVehicleSuccess), 1] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmEntireVehicleSuccessLocalEH), _this] call CBA_fnc_serverEvent; }; diff --git a/addons/rearm/functions/fnc_rearmSuccess.sqf b/addons/rearm/functions/fnc_rearmSuccess.sqf index 81cda9f262..f8608817ea 100644 --- a/addons/rearm/functions/fnc_rearmSuccess.sqf +++ b/addons/rearm/functions/fnc_rearmSuccess.sqf @@ -34,11 +34,10 @@ if (local _unit) then { if (isServer) then { _turretOwnerID = _target turretOwner _turretPath; if (_turretOwnerID == 0) then { - [_this, QFUNC(rearmSuccessLocal), _target] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmSuccessLocalEH), _this, _vehicle] call CBA_fnc_targetEvent; } else { - EGVAR(common,remoteFnc) = [_this, QFUNC(rearmSuccessLocal), 0]; - _turretOwnerID publicVariableClient QEGVAR(common,remoteFnc); + [QGVAR(rearmSuccessLocalEH), _this, _turretOwnerID] call CBA_fnc_targetEvent; }; } else { - [_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmSuccessLocalEH), _this] call CBA_fnc_serverEvent; };