From 8467013c1a36fb0f60ce92fe921fee49ab1030fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Fri, 16 Jan 2015 15:24:25 -0300 Subject: [PATCH] Moved getAllGear function to common module --- addons/common/XEH_preInit.sqf | 1 + .../functions/fnc_getAllGear.sqf | 35 ++++++++----------- addons/respawn/XEH_preInit.sqf | 1 - addons/respawn/functions/fnc_handleKilled.sqf | 10 +++--- 4 files changed, 20 insertions(+), 27 deletions(-) rename addons/{respawn => common}/functions/fnc_getAllGear.sqf (65%) diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 0384d48a70..70aab8ca6a 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -38,6 +38,7 @@ PREP(execRemoteFnc); PREP(executePersistent); PREP(filter); PREP(fixLoweredRifleAnimation); +PREP(getAllGear); PREP(getCaptivityStatus); PREP(getConfigCommander); PREP(getConfigGunner); diff --git a/addons/respawn/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf similarity index 65% rename from addons/respawn/functions/fnc_getAllGear.sqf rename to addons/common/functions/fnc_getAllGear.sqf index ad9f3dbb68..efb58a0b9d 100644 --- a/addons/respawn/functions/fnc_getAllGear.sqf +++ b/addons/common/functions/fnc_getAllGear.sqf @@ -1,26 +1,21 @@ /* - Name: ACE_Respawn_fnc_getAllGear - - Author(s): - bux578 - - Description: - returns an array containing all items of a given unit - - Parameters: - 0: OBJECT - unit - - Returns: - ARRAY -*/ - + * Author: bux578 + * + * Returns an array containing all items of a given unit + * + * Argument: + * 0: Unit (Object) + * + * Return value: + * Array with all the gear + */ #include "script_component.hpp" -private ["_unit", "_allGear"]; +EXPLODE_1_PVT(_this,_unit); -_unit = _this select 0; +if (isNull _unit) exitWith {[]}; -_allGear = [ +[ (headgear _unit), (goggles _unit), (uniform _unit), @@ -40,6 +35,4 @@ _allGear = [ (handgunMagazine _unit), (assignedItems _unit), (binocular _unit) -]; - -_allGear +] \ No newline at end of file diff --git a/addons/respawn/XEH_preInit.sqf b/addons/respawn/XEH_preInit.sqf index 9ce46777dd..831aeaa423 100644 --- a/addons/respawn/XEH_preInit.sqf +++ b/addons/respawn/XEH_preInit.sqf @@ -1,7 +1,6 @@ #include "script_component.hpp" PREP(canMoveRallypoint); -PREP(getAllGear); PREP(handleKilled); PREP(handleRespawn); PREP(initRallypoint); diff --git a/addons/respawn/functions/fnc_handleKilled.sqf b/addons/respawn/functions/fnc_handleKilled.sqf index e83a1f1dec..c3ab0aebf3 100644 --- a/addons/respawn/functions/fnc_handleKilled.sqf +++ b/addons/respawn/functions/fnc_handleKilled.sqf @@ -1,16 +1,16 @@ /* Name: ACE_Respawn_fnc_handleKilled - + Author(s): bux578 - + Description: Handles the XEH Killed event - + Parameters: 0: OBJECT - Killed unit 1: OBJECT - Attacker - + Returns: VOID */ @@ -25,7 +25,7 @@ _killedUnit = _this select 0; GVAR(unitGear) = []; if (GVAR(SavePreDeathGear)) then { - GVAR(unitGear) = [_killedUnit] call FUNC(getAllGear); + GVAR(unitGear) = [_killedUnit] call EFUNC(common,getAllGear); }; if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then {