Replace execRemoteFnc with global/targetEvent in refuel

This commit is contained in:
jonpas 2016-03-05 17:41:47 +01:00
parent fc54b1180c
commit 401d457a46
6 changed files with 23 additions and 6 deletions

View File

@ -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);

View File

@ -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];

View File

@ -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;
};

View File

@ -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;

View File

@ -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]];
};

View File

@ -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];
};