From 8a3c3d4e8c9f89eb34108451bd7dba9225384a86 Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 3 Apr 2017 09:42:26 +0200 Subject: [PATCH 1/2] Use setShotParents in Advanced Throwing - close #5034 --- addons/advanced_throwing/functions/fnc_exitThrowMode.sqf | 2 ++ addons/advanced_throwing/functions/fnc_prime.sqf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf b/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf index c508d0a8035..e2dcd3a5cfb 100644 --- a/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf +++ b/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf @@ -32,6 +32,8 @@ if !(_unit getVariable [QGVAR(primed), false]) then { _unit setVariable [QGVAR(lastThrownTime), CBA_missionTime]; // Fix floating for throwables without proper physics (eg. IR Grenade) _activeThrowable setVelocity [0, 0, -0.1]; + + _activeThrowable setShotParents [_unit, (getShotParents _activeThrowable) select 1]; }; // Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory) diff --git a/addons/advanced_throwing/functions/fnc_prime.sqf b/addons/advanced_throwing/functions/fnc_prime.sqf index 727ace4e23a..3db84f65279 100644 --- a/addons/advanced_throwing/functions/fnc_prime.sqf +++ b/addons/advanced_throwing/functions/fnc_prime.sqf @@ -54,6 +54,8 @@ deleteVehicle _activeThrowableOld; _activeThrowable // projectile ]] call CBA_fnc_globalEvent; +_activeThrowable setShotParents [_unit, _unit]; + if (_showHint) then { // Show primed hint private _displayNameShort = getText (configFile >> "CfgMagazines" >> _throwableMag >> "displayNameShort"); From 2197124583af099185a7a5d388fc42ecb0d88f46 Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 3 Apr 2017 15:07:48 +0200 Subject: [PATCH 2/2] Execute setShotParents on server (server-only command) --- addons/advanced_throwing/functions/fnc_exitThrowMode.sqf | 3 ++- addons/advanced_throwing/functions/fnc_prime.sqf | 3 ++- addons/common/XEH_postInit.sqf | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf b/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf index e2dcd3a5cfb..359bd946a52 100644 --- a/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf +++ b/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf @@ -33,7 +33,8 @@ if !(_unit getVariable [QGVAR(primed), false]) then { // Fix floating for throwables without proper physics (eg. IR Grenade) _activeThrowable setVelocity [0, 0, -0.1]; - _activeThrowable setShotParents [_unit, (getShotParents _activeThrowable) select 1]; + // Set thrower + [QEGVAR(common,setShotParents), [_activeThrowable, _unit, (getShotParents _activeThrowable) select 1]] call CBA_fnc_serverEvent; }; // Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory) diff --git a/addons/advanced_throwing/functions/fnc_prime.sqf b/addons/advanced_throwing/functions/fnc_prime.sqf index 3db84f65279..d52bee67f22 100644 --- a/addons/advanced_throwing/functions/fnc_prime.sqf +++ b/addons/advanced_throwing/functions/fnc_prime.sqf @@ -54,7 +54,8 @@ deleteVehicle _activeThrowableOld; _activeThrowable // projectile ]] call CBA_fnc_globalEvent; -_activeThrowable setShotParents [_unit, _unit]; +// Set prime instigator +[QEGVAR(common,setShotParents), [_activeThrowable, _unit, _unit]] call CBA_fnc_serverEvent; if (_showHint) then { // Show primed hint diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 82004938108..21c070c618a 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -133,6 +133,7 @@ if (isServer) then { if (isServer) then { [QGVAR(hideObjectGlobal), {(_this select 0) hideObjectGlobal (_this select 1)}] call CBA_fnc_addEventHandler; [QGVAR(enableSimulationGlobal), {(_this select 0) enableSimulationGlobal (_this select 1)}] call CBA_fnc_addEventHandler; + [QGVAR(setShotParents), {(_this select 0) setShotParents [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler; ["ace_setOwner", {(_this select 0) setOwner (_this select 1)}] call CBA_fnc_addEventHandler; [QGVAR(serverLog), FUNC(serverLog)] call CBA_fnc_addEventHandler; };