From 401d457a46d916c63f9d4a22de72b9765e1bfb6e Mon Sep 17 00:00:00 2001
From: jonpas <jonpas33@gmail.com>
Date: Sat, 5 Mar 2016 17:41:47 +0100
Subject: [PATCH 1/7] Replace execRemoteFnc with global/targetEvent in refuel

---
 addons/refuel/XEH_postInit.sqf                  | 17 +++++++++++++++++
 .../functions/fnc_connectNozzleAction.sqf       |  2 +-
 addons/refuel/functions/fnc_refuel.sqf          |  2 +-
 addons/refuel/functions/fnc_reset.sqf           |  4 ++--
 addons/refuel/functions/fnc_returnNozzle.sqf    |  2 +-
 addons/refuel/functions/fnc_takeNozzle.sqf      |  2 +-
 6 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/addons/refuel/XEH_postInit.sqf b/addons/refuel/XEH_postInit.sqf
index 16c4232457..151f08d80b 100644
--- a/addons/refuel/XEH_postInit.sqf
+++ b/addons/refuel/XEH_postInit.sqf
@@ -5,3 +5,20 @@
 if (isServer) then {
     addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}];
 };
+
+// @todo move to common?
+[QGVAR(setVectorDirAndUp), {
+    params ["_vehicle", "_vectorDirAndUp"];
+
+    if (local _vehicle) then {
+        (_this select 0) setVectorDirAndUp (_this select 1)
+    };
+}] call EFUNC(common,addEventHandler);
+
+[QGVAR(setVehicleHitPointDamage), {
+    (_this select 0) setHitPointDamage (_this select 1);
+}] call EFUNC(common,addEventHandler);
+
+[QGVAR(resetLocal), {
+    _this call FUNC(resetLocal);
+}] call EFUNC(common,addEventHandler);
diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf
index bf9b6b8092..ec99f51fa4 100644
--- a/addons/refuel/functions/fnc_connectNozzleAction.sqf
+++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf
@@ -119,7 +119,7 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
                 };
             };
         };
-        [[_nozzle, _dirAndUp], "{(_this select 0) setVectorDirAndUp (_this select 1)}", 2] call EFUNC(common,execRemoteFnc);
+        [QGVAR(setVectorDirAndUp), [_nozzle, _dirAndUp]] call EFUNC(common,globalEvent);
         _nozzle setVariable [QGVAR(sink), _target, true];
         _nozzle setVariable [QGVAR(isConnected), true, true];
         _target setVariable [QGVAR(nozzle), _nozzle, true];
diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf
index 117cf5ea1e..d4c5e111f6 100644
--- a/addons/refuel/functions/fnc_refuel.sqf
+++ b/addons/refuel/functions/fnc_refuel.sqf
@@ -77,7 +77,7 @@ private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >>
         _unit setVariable [QGVAR(tempFuel), _fuelInSink];
 
         if !(local _sink) then {
-            [[_sink, _fuelInSink], "{(_this select 0) setFuel (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc);
+            ["setFuel", _sink [_sink, _fuelInSink]] call EFUNC(common,targetEvent);
         } else {
             _sink setFuel _fuelInSink;
         };
diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf
index 8c9b2aaf6b..f0955b609a 100644
--- a/addons/refuel/functions/fnc_reset.sqf
+++ b/addons/refuel/functions/fnc_reset.sqf
@@ -20,7 +20,7 @@ params [["_target", objNull, [objNull]]];
 if (local _target) then {
     _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
 } else {
-    [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _target] call EFUNC(common,execRemoteFnc);
+    [QGVAR(setVehicleHitPointDamage), _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
 };
 _target setVariable [QGVAR(engineHit), nil, true];
 _target setVariable [QGVAR(isConnected), false, true];
@@ -41,7 +41,7 @@ if !(isNil "_nozzle") then {
         if (local _x) then {
             [_x, _nozzle] call FUNC(resetLocal);
         } else {
-            [[_x, _nozzle], "{_this call FUNC(resetLocal)}", _x] call EFUNC(common,execRemoteFnc);
+            [QGVAR(resetLocal), _x, [_x, _nozzle]] call EFUNC(common,targetEvent);
         };
     } count allPlayers;
     deleteVehicle _nozzle;
diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf
index 852a3d8c38..f3f00429da 100644
--- a/addons/refuel/functions/fnc_returnNozzle.sqf
+++ b/addons/refuel/functions/fnc_returnNozzle.sqf
@@ -49,7 +49,7 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
         deleteVehicle _nozzle;
 
         if !(local _target) then {
-            [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc);
+            [QGVAR(setVehicleHitPointDamage), _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
         } else {
             _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
         };
diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf
index 3bccce15e2..02eefe27fe 100644
--- a/addons/refuel/functions/fnc_takeNozzle.sqf
+++ b/addons/refuel/functions/fnc_takeNozzle.sqf
@@ -28,7 +28,7 @@ private _endPosOffset = [0, 0, 0];
 if (isNull _nozzle) then { // func is called on fuel truck
     _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true];
     if !(local _target) then {
-        [[_target, ["HitEngine", 1]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc);
+        [QGVAR(setVehicleHitPointDamage), _target, ["HitEngine", 1]] call EFUNC(common,targetEvent);
     } else {
         _target setHitPointDamage ["HitEngine", 1];
     };

From 015a60e6c4c3e2aaa0ca21e702cb1a1797a1515d Mon Sep 17 00:00:00 2001
From: jonpas <jonpas33@gmail.com>
Date: Sat, 5 Mar 2016 17:44:03 +0100
Subject: [PATCH 2/7] Increase fuel update to 1s

---
 addons/refuel/functions/fnc_refuel.sqf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf
index d4c5e111f6..69e76f9ae9 100644
--- a/addons/refuel/functions/fnc_refuel.sqf
+++ b/addons/refuel/functions/fnc_refuel.sqf
@@ -16,7 +16,7 @@
 
 #include "script_component.hpp"
 
-#define PFH_STEPSIZE 0.1
+#define PFH_STEPSIZE 1
 
 params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_connectToPoint", [0,0,0], [[]], 3]];
 

From 589ca27b600f21b84380600af9d27252d3c89a29 Mon Sep 17 00:00:00 2001
From: jonpas <jonpas33@gmail.com>
Date: Sat, 5 Mar 2016 18:02:21 +0100
Subject: [PATCH 3/7] Fix missing comma

---
 addons/refuel/functions/fnc_refuel.sqf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf
index 69e76f9ae9..9db305526c 100644
--- a/addons/refuel/functions/fnc_refuel.sqf
+++ b/addons/refuel/functions/fnc_refuel.sqf
@@ -77,7 +77,7 @@ private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >>
         _unit setVariable [QGVAR(tempFuel), _fuelInSink];
 
         if !(local _sink) then {
-            ["setFuel", _sink [_sink, _fuelInSink]] call EFUNC(common,targetEvent);
+            ["setFuel", _sink, [_sink, _fuelInSink]] call EFUNC(common,targetEvent);
         } else {
             _sink setFuel _fuelInSink;
         };

From 881eaf951aeb9f64a2e4cbb9e5180e67e690655a Mon Sep 17 00:00:00 2001
From: jonpas <jonpas33@gmail.com>
Date: Sat, 5 Mar 2016 18:07:07 +0100
Subject: [PATCH 4/7] Move setVectorDirAndUp and setHitPointDamage events to
 common, Make refuel set nozzle position execute only on target where local

---
 addons/common/XEH_postInit.sqf                      |  3 +++
 addons/refuel/XEH_postInit.sqf                      | 13 -------------
 addons/refuel/functions/fnc_connectNozzleAction.sqf |  2 +-
 addons/refuel/functions/fnc_reset.sqf               |  2 +-
 addons/refuel/functions/fnc_returnNozzle.sqf        |  2 +-
 addons/refuel/functions/fnc_takeNozzle.sqf          |  2 +-
 6 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf
index 58e674dd8d..f188025d7b 100644
--- a/addons/common/XEH_postInit.sqf
+++ b/addons/common/XEH_postInit.sqf
@@ -158,6 +158,9 @@ if (isServer) then {
     ["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler);
 };
 
+["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler);
+["setHitPointDamage", {(_this select 0) setHitPointDamage (_this select 1)}] call FUNC(addEventHandler);
+
 
 //////////////////////////////////////////////////
 // Set up remote execution
diff --git a/addons/refuel/XEH_postInit.sqf b/addons/refuel/XEH_postInit.sqf
index 151f08d80b..5078d808a2 100644
--- a/addons/refuel/XEH_postInit.sqf
+++ b/addons/refuel/XEH_postInit.sqf
@@ -6,19 +6,6 @@ if (isServer) then {
     addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}];
 };
 
-// @todo move to common?
-[QGVAR(setVectorDirAndUp), {
-    params ["_vehicle", "_vectorDirAndUp"];
-
-    if (local _vehicle) then {
-        (_this select 0) setVectorDirAndUp (_this select 1)
-    };
-}] call EFUNC(common,addEventHandler);
-
-[QGVAR(setVehicleHitPointDamage), {
-    (_this select 0) setHitPointDamage (_this select 1);
-}] call EFUNC(common,addEventHandler);
-
 [QGVAR(resetLocal), {
     _this call FUNC(resetLocal);
 }] call EFUNC(common,addEventHandler);
diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf
index ec99f51fa4..ae707a5718 100644
--- a/addons/refuel/functions/fnc_connectNozzleAction.sqf
+++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf
@@ -119,7 +119,7 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
                 };
             };
         };
-        [QGVAR(setVectorDirAndUp), [_nozzle, _dirAndUp]] call EFUNC(common,globalEvent);
+        ["setVectorDirAndUp", _nozzle, [_nozzle, _dirAndUp]] call EFUNC(common,targetEvent);
         _nozzle setVariable [QGVAR(sink), _target, true];
         _nozzle setVariable [QGVAR(isConnected), true, true];
         _target setVariable [QGVAR(nozzle), _nozzle, true];
diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf
index f0955b609a..da983e6492 100644
--- a/addons/refuel/functions/fnc_reset.sqf
+++ b/addons/refuel/functions/fnc_reset.sqf
@@ -20,7 +20,7 @@ params [["_target", objNull, [objNull]]];
 if (local _target) then {
     _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
 } else {
-    [QGVAR(setVehicleHitPointDamage), _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
+    ["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
 };
 _target setVariable [QGVAR(engineHit), nil, true];
 _target setVariable [QGVAR(isConnected), false, true];
diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf
index f3f00429da..179785f863 100644
--- a/addons/refuel/functions/fnc_returnNozzle.sqf
+++ b/addons/refuel/functions/fnc_returnNozzle.sqf
@@ -49,7 +49,7 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
         deleteVehicle _nozzle;
 
         if !(local _target) then {
-            [QGVAR(setVehicleHitPointDamage), _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
+            ["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
         } else {
             _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
         };
diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf
index 02eefe27fe..08f9e152c0 100644
--- a/addons/refuel/functions/fnc_takeNozzle.sqf
+++ b/addons/refuel/functions/fnc_takeNozzle.sqf
@@ -28,7 +28,7 @@ private _endPosOffset = [0, 0, 0];
 if (isNull _nozzle) then { // func is called on fuel truck
     _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true];
     if !(local _target) then {
-        [QGVAR(setVehicleHitPointDamage), _target, ["HitEngine", 1]] call EFUNC(common,targetEvent);
+        ["setHitPointDamage", _target, ["HitEngine", 1]] call EFUNC(common,targetEvent);
     } else {
         _target setHitPointDamage ["HitEngine", 1];
     };

From 9463b052184261ad3769d92652c4b36785ea1252 Mon Sep 17 00:00:00 2001
From: jonpas <jonpas33@gmail.com>
Date: Sat, 5 Mar 2016 18:16:09 +0100
Subject: [PATCH 5/7] targetEvent -> objectEvent

---
 addons/refuel/functions/fnc_checkFuel.sqf           |  4 ++--
 addons/refuel/functions/fnc_connectNozzleAction.sqf |  2 +-
 addons/refuel/functions/fnc_refuel.sqf              |  6 +-----
 addons/refuel/functions/fnc_reset.sqf               | 13 +++----------
 addons/refuel/functions/fnc_returnNozzle.sqf        |  6 +-----
 addons/refuel/functions/fnc_takeNozzle.sqf          |  6 +-----
 6 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf
index 6ba7a4928e..140021419d 100644
--- a/addons/refuel/functions/fnc_checkFuel.sqf
+++ b/addons/refuel/functions/fnc_checkFuel.sqf
@@ -27,9 +27,9 @@ private _fuel = [_target] call FUNC(getFuel);
         params ["_args"];
         _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_fuel", 0, [0]]];
         if (_fuel > 0 ) then {
-            ["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent);
+            ["displayTextStructured", _unit, [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,objectEvent);
         } else {
-            ["displayTextStructured", [_unit], [LSTRING(Hint_Empty), 2, _unit]] call EFUNC(common,targetEvent);
+            ["displayTextStructured", _unit, [LSTRING(Hint_Empty), 2, _unit]] call EFUNC(common,objectEvent);
         };
         true
     },
diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf
index ae707a5718..1df5f1e208 100644
--- a/addons/refuel/functions/fnc_connectNozzleAction.sqf
+++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf
@@ -119,7 +119,7 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
                 };
             };
         };
-        ["setVectorDirAndUp", _nozzle, [_nozzle, _dirAndUp]] call EFUNC(common,targetEvent);
+        ["setVectorDirAndUp", _nozzle, [_nozzle, _dirAndUp]] call EFUNC(common,objectEvent);
         _nozzle setVariable [QGVAR(sink), _target, true];
         _nozzle setVariable [QGVAR(isConnected), true, true];
         _target setVariable [QGVAR(nozzle), _nozzle, true];
diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf
index 9db305526c..5ee3bf3794 100644
--- a/addons/refuel/functions/fnc_refuel.sqf
+++ b/addons/refuel/functions/fnc_refuel.sqf
@@ -76,11 +76,7 @@ private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >>
         };
         _unit setVariable [QGVAR(tempFuel), _fuelInSink];
 
-        if !(local _sink) then {
-            ["setFuel", _sink, [_sink, _fuelInSink]] call EFUNC(common,targetEvent);
-        } else {
-            _sink setFuel _fuelInSink;
-        };
+        ["setFuel", _sink, [_sink, _fuelInSink]] call EFUNC(common,objectEvent);
         [_source, _fuelInSource] call FUNC(setFuel);
     } else {
         _unit setVariable [QGVAR(tempFuel), fuel _sink];
diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf
index da983e6492..ff04ed13e3 100644
--- a/addons/refuel/functions/fnc_reset.sqf
+++ b/addons/refuel/functions/fnc_reset.sqf
@@ -17,11 +17,8 @@
 
 params [["_target", objNull, [objNull]]];
 
-if (local _target) then {
-    _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
-} else {
-    ["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
-};
+["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,objectEvent);
+
 _target setVariable [QGVAR(engineHit), nil, true];
 _target setVariable [QGVAR(isConnected), false, true];
 
@@ -38,11 +35,7 @@ if !(isNil "_nozzle") then {
     };
 
     {
-        if (local _x) then {
-            [_x, _nozzle] call FUNC(resetLocal);
-        } else {
-            [QGVAR(resetLocal), _x, [_x, _nozzle]] call EFUNC(common,targetEvent);
-        };
+        [QGVAR(resetLocal), _x, [_x, _nozzle]] call EFUNC(common,objectEvent);
     } count allPlayers;
     deleteVehicle _nozzle;
 };
diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf
index 179785f863..af3e8c6d4e 100644
--- a/addons/refuel/functions/fnc_returnNozzle.sqf
+++ b/addons/refuel/functions/fnc_returnNozzle.sqf
@@ -48,11 +48,7 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
         };
         deleteVehicle _nozzle;
 
-        if !(local _target) then {
-            ["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,targetEvent);
-        } else {
-            _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
-        };
+        ["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,objectEvent);
         _target setVariable [QGVAR(engineHit), nil, true];
     },
     "",
diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf
index 08f9e152c0..d862aa16b5 100644
--- a/addons/refuel/functions/fnc_takeNozzle.sqf
+++ b/addons/refuel/functions/fnc_takeNozzle.sqf
@@ -27,11 +27,7 @@ REFUEL_HOLSTER_WEAPON
 private _endPosOffset = [0, 0, 0];
 if (isNull _nozzle) then { // func is called on fuel truck
     _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true];
-    if !(local _target) then {
-        ["setHitPointDamage", _target, ["HitEngine", 1]] call EFUNC(common,targetEvent);
-    } else {
-        _target setHitPointDamage ["HitEngine", 1];
-    };
+    ["setHitPointDamage", _target, ["HitEngine", 1]] call EFUNC(common,objectEvent);
 
     _target setVariable [QGVAR(isConnected), true, true];
     _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hooks));

From ae3a41e6d8fff04684b88f1930a57d7ffd8f31a9 Mon Sep 17 00:00:00 2001
From: jonpas <jonpas33@gmail.com>
Date: Sun, 6 Mar 2016 02:38:05 +0100
Subject: [PATCH 6/7] Move common event handlers closer to their counterparts

---
 addons/common/XEH_postInit.sqf | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf
index f188025d7b..6ea32c3534 100644
--- a/addons/common/XEH_postInit.sqf
+++ b/addons/common/XEH_postInit.sqf
@@ -152,15 +152,14 @@ if (isServer) then {
 ["playMove", {(_this select 0) playMove (_this select 1)}] call FUNC(addEventHandler);
 ["playMoveNow", {(_this select 0) playMoveNow (_this select 1)}] call FUNC(addEventHandler);
 ["switchMove", {(_this select 0) switchMove (_this select 1)}] call FUNC(addEventHandler);
+["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler);
+["setHitPointDamage", {(_this select 0) setHitPointDamage (_this select 1)}] call FUNC(addEventHandler);
 
 if (isServer) then {
     ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
     ["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler);
 };
 
-["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler);
-["setHitPointDamage", {(_this select 0) setHitPointDamage (_this select 1)}] call FUNC(addEventHandler);
-
 
 //////////////////////////////////////////////////
 // Set up remote execution

From b47b887a219ab6a7da4be7e0c44157d695ea1484 Mon Sep 17 00:00:00 2001
From: jonpas <jonpas33@gmail.com>
Date: Sun, 6 Mar 2016 16:20:16 +0100
Subject: [PATCH 7/7] Fix event name already being used

---
 addons/common/XEH_postInit.sqf               | 2 +-
 addons/refuel/functions/fnc_reset.sqf        | 2 +-
 addons/refuel/functions/fnc_returnNozzle.sqf | 2 +-
 addons/refuel/functions/fnc_takeNozzle.sqf   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf
index 6ea32c3534..b17ff292a4 100644
--- a/addons/common/XEH_postInit.sqf
+++ b/addons/common/XEH_postInit.sqf
@@ -153,7 +153,7 @@ if (isServer) then {
 ["playMoveNow", {(_this select 0) playMoveNow (_this select 1)}] call FUNC(addEventHandler);
 ["switchMove", {(_this select 0) switchMove (_this select 1)}] call FUNC(addEventHandler);
 ["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler);
-["setHitPointDamage", {(_this select 0) setHitPointDamage (_this select 1)}] call FUNC(addEventHandler);
+["setVanillaHitPointDamage", {(_this select 0) setHitPointDamage (_this select 1)}] call FUNC(addEventHandler);
 
 if (isServer) then {
     ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf
index ff04ed13e3..6e3bdbe774 100644
--- a/addons/refuel/functions/fnc_reset.sqf
+++ b/addons/refuel/functions/fnc_reset.sqf
@@ -17,7 +17,7 @@
 
 params [["_target", objNull, [objNull]]];
 
-["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,objectEvent);
+["setVanillaHitPointDamage", _target, [_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]] ] ] call EFUNC(common,objectEvent);
 
 _target setVariable [QGVAR(engineHit), nil, true];
 _target setVariable [QGVAR(isConnected), false, true];
diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf
index af3e8c6d4e..bd4da5569b 100644
--- a/addons/refuel/functions/fnc_returnNozzle.sqf
+++ b/addons/refuel/functions/fnc_returnNozzle.sqf
@@ -48,7 +48,7 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
         };
         deleteVehicle _nozzle;
 
-        ["setHitPointDamage", _target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]] call EFUNC(common,objectEvent);
+        ["setVanillaHitPointDamage", _target, [_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]] ] ] call EFUNC(common,objectEvent);
         _target setVariable [QGVAR(engineHit), nil, true];
     },
     "",
diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf
index d862aa16b5..3d557f9a2e 100644
--- a/addons/refuel/functions/fnc_takeNozzle.sqf
+++ b/addons/refuel/functions/fnc_takeNozzle.sqf
@@ -27,7 +27,7 @@ REFUEL_HOLSTER_WEAPON
 private _endPosOffset = [0, 0, 0];
 if (isNull _nozzle) then { // func is called on fuel truck
     _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true];
-    ["setHitPointDamage", _target, ["HitEngine", 1]] call EFUNC(common,objectEvent);
+    ["setVanillaHitPointDamage", _target, [_target, ["HitEngine", 1]] ] call EFUNC(common,objectEvent);
 
     _target setVariable [QGVAR(isConnected), true, true];
     _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hooks));