mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
59af3e1f6d
* medical_treatment * advanced_throwing * common, csw * Update fnc_replaceRegisteredItems.sqf * Sanitised numerous components * Update XEH_postInit.sqf * Update XEH_postInit.sqf * FUNC -> LINKFUNC * Changed tagging hashmap * Reverted some changes * Reverted some changes * Update XEH_clientInit.sqf * Tweaks and fixes * Fix number replacements * Minor cleanup * Update fnc_getMagazineName.sqf * Update fnc_getMagazineName.sqf * Minor improvement * Made factions case-sensitive and added `toLowerANSI` to be safe * Update fnc_getDetectedObject.sqf * Update addons/common/functions/fnc_actionKeysNamesConverted.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Throw error if item doesn't exist --------- Co-authored-by: Salluci <69561145+Salluci@users.noreply.github.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
51 lines
1.7 KiB
Plaintext
51 lines
1.7 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: Garth 'L-H' de Wet
|
|
* Adds an explosive as a clacker item to the passed unit if the unit has the required item.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
* 1: Explosive <OBJECT>
|
|
* 2: Magazine classname <STRING>
|
|
* 3: Extra variables <ARRAY>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, _explosive, "SatchelCharge_Remote_Mag", [ConfigFile >> "ACE_Triggers" >> "Command"]] call ACE_Explosives_fnc_addClacker;
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params ["_unit", "_explosive", "_magazineClass"];
|
|
TRACE_3("params",_unit,_explosive,_magazineClass);
|
|
|
|
// Config is the last item in the list of passed in items.
|
|
private _config = (_this select 3) select (count (_this select 3) - 1);
|
|
|
|
private _requiredItems = getArray(_config >> "requires");
|
|
private _hasRequired = true;
|
|
private _detonators = [_unit] call FUNC(getDetonators);
|
|
{
|
|
if !(_x in _detonators) exitWith{
|
|
_hasRequired = false;
|
|
};
|
|
} forEach _requiredItems;
|
|
|
|
if !(_hasRequired) exitWith {};
|
|
private _config = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> configName _config;
|
|
|
|
private _clacker = _unit getVariable [QGVAR(Clackers), []];
|
|
GVAR(PlacedCount) = GVAR(PlacedCount) + 1;
|
|
|
|
_clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localize LSTRING(DetonateCode),
|
|
GVAR(PlacedCount)], _magazineClass, configName ((_this select 3) select (count (_this select 3) - 1))];
|
|
|
|
_unit setVariable [QGVAR(Clackers), _clacker, true];
|
|
|
|
//display clacker code message:
|
|
[format [localize LSTRING(DetonateCode), GVAR(PlacedCount)]] call EFUNC(common,displayTextStructured);
|
|
|
|
[QGVAR(clackerAdded), [_unit, _explosive, GVAR(PlacedCount)]] call CBA_fnc_localEvent;
|