Replacing execRemoteFnc with events

This commit is contained in:
Githawk 2016-03-06 11:14:34 +01:00
parent 6cce74907f
commit 8dc99a4a4e
4 changed files with 17 additions and 7 deletions

View File

@ -6,3 +6,15 @@
if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}];
};
[QGVAR(makeDummyEH), {
_this call FUNC(makeDummy);
}] call EFUNC(common,addEventHandler);
[QGVAR(rearmEntireVehicleSuccessLocalEH), {
_this call FUNC(rearmEntireVehicleSuccessLocal);
}] call EFUNC(common,addEventHandler);
[QGVAR(rearmSuccessLocalEH), {
_this call FUNC(rearmSuccessLocal);
}] call EFUNC(common,addEventHandler);

View File

@ -23,6 +23,6 @@ if !(isNull _attachedDummy) exitWith {};
_dummy attachTo [_unit, [0,1,0], "pelvis"];
{
[[_dummy, [[-1,0,0],[0,0,1]]], QFUNC(makeDummy), _x] call EFUNC(common,execRemoteFnc);
[QGVAR(makeDummyEH), _x, [_dummy, [[-1,0,0],[0,0,1]]]] call EFUNC(common,objectEvent);
} count (position _unit nearObjects ["CAManBase", 100]);
_unit setVariable [QGVAR(dummy), _dummy];

View File

@ -24,10 +24,9 @@ if (isServer) then {
{
_turretOwnerID = _vehicle turretOwner _x;
if (_turretOwnerID == 0) then {
[[_truck, _vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), _truck] call EFUNC(common,execRemoteFnc);
[QGVAR(rearmEntireVehicleSuccessLocalEH), _truck, [_truck, _vehicle, _x]] call EFUNC(common,objectEvent);
} else {
EGVAR(common,remoteFnc) = [[_truck, _vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), 0];
_turretOwnerID publicVariableClient QEGVAR(common,remoteFnc);
[QGVAR(rearmEntireVehicleSuccessLocalEH), _turretOwnerID, [_truck, _vehicle, _x]] call EFUNC(common,targetEvent);
};
} count REARM_TURRET_PATHS;
} else {

View File

@ -33,10 +33,9 @@ if (local _unit) then {
if (isServer) then {
private _turretOwnerID = _vehicle turretOwner _turretPath;
if (_turretOwnerID == 0) then {
[_this, QFUNC(rearmSuccessLocal), _vehicle] call EFUNC(common,execRemoteFnc);
[QGVAR(rearmSuccessLocalEH), _vehicle, _this] call EFUNC(common,objectEvent);
} else {
EGVAR(common,remoteFnc) = [_this, QFUNC(rearmSuccessLocal), 0];
_turretOwnerID publicVariableClient QEGVAR(common,remoteFnc);
[QGVAR(rearmSuccessLocalEH), _turretOwnerID, _this] call EFUNC(common,targetEvent);
};
} else {
[_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc);