Move setVectorDirAndUp and setHitPointDamage events to common, Make refuel set nozzle position execute only on target where local

This commit is contained in:
jonpas 2016-03-05 18:07:07 +01:00
parent 589ca27b60
commit 881eaf951a
6 changed files with 7 additions and 17 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

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 {
[QGVAR(setVehicleHitPointDamage), _target, ["HitEngine", 1]] call EFUNC(common,targetEvent);
["setHitPointDamage", _target, ["HitEngine", 1]] call EFUNC(common,targetEvent);
} else {
_target setHitPointDamage ["HitEngine", 1];
};