Merge pull request #3943 from acemod/rearmRemoteFncEvents

Replace execRemoteFnc with CBA events in rearm
This commit is contained in:
Glowbal 2016-06-18 11:56:49 +02:00 committed by GitHub
commit 2b4dfb4b54
4 changed files with 11 additions and 9 deletions

View File

@ -6,3 +6,7 @@
if (isServer) then { if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}]; 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;

View File

@ -25,7 +25,7 @@ if !(isNull _dummy) exitWith {};
//_target attachTo [_unit, [0,0.7,0], "pelvis"]; //_target attachTo [_unit, [0,0.7,0], "pelvis"];
_target attachTo [_unit, [0,1,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]); } count (position _unit nearObjects ["CAManBase", 100]);
_unit setVariable [QGVAR(dummy), _target]; _unit setVariable [QGVAR(dummy), _target];
//_unit setVariable [QEGVAR(dragging,isCarrying), true, true]; // breaks things, since it hides interact menu on _target //_unit setVariable [QEGVAR(dragging,isCarrying), true, true]; // breaks things, since it hides interact menu on _target

View File

@ -22,12 +22,11 @@ if (isServer) then {
{ {
_turretOwnerID = _vehicle turretOwner _x; _turretOwnerID = _vehicle turretOwner _x;
if (_turretOwnerID == 0) then { if (_turretOwnerID == 0) then {
[[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), _target] call EFUNC(common,execRemoteFnc); [QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _truck] call CBA_fnc_targetEvent;
} else { } else {
EGVAR(common,remoteFnc) = [[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), 0]; [QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _turretOwnerID] call CBA_fnc_targetEvent;
_turretOwnerID publicVariableClient QEGVAR(common,remoteFnc);
}; };
} count REARM_TURRET_PATHS; } count REARM_TURRET_PATHS;
} else { } else {
[_this, QFUNC(rearmEntireVehicleSuccess), 1] call EFUNC(common,execRemoteFnc); [QGVAR(rearmEntireVehicleSuccessLocalEH), _this] call CBA_fnc_serverEvent;
}; };

View File

@ -34,11 +34,10 @@ if (local _unit) then {
if (isServer) then { if (isServer) then {
_turretOwnerID = _target turretOwner _turretPath; _turretOwnerID = _target turretOwner _turretPath;
if (_turretOwnerID == 0) then { if (_turretOwnerID == 0) then {
[_this, QFUNC(rearmSuccessLocal), _target] call EFUNC(common,execRemoteFnc); [QGVAR(rearmSuccessLocalEH), _this, _vehicle] call CBA_fnc_targetEvent;
} else { } else {
EGVAR(common,remoteFnc) = [_this, QFUNC(rearmSuccessLocal), 0]; [QGVAR(rearmSuccessLocalEH), _this, _turretOwnerID] call CBA_fnc_targetEvent;
_turretOwnerID publicVariableClient QEGVAR(common,remoteFnc);
}; };
} else { } else {
[_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc); [QGVAR(rearmSuccessLocalEH), _this] call CBA_fnc_serverEvent;
}; };