2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Places an explosive at the requested position
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Position to place explosive <POSITION>
|
|
|
|
* 2: Rotation <NUMBER>
|
|
|
|
* 3: Magazine class <STRING>
|
2015-02-20 01:28:16 +00:00
|
|
|
* 4: Config of trigger <STRING>
|
2015-02-02 08:35:17 +00:00
|
|
|
* 5: Variables required for the trigger type <ARRAY>
|
2015-02-20 01:28:16 +00:00
|
|
|
* 6: Explosive placeholder <OBJECT> <OPTIONAL>
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Placed explosive <OBJECT>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-04-03 22:26:27 +00:00
|
|
|
* _explosive = [player, player modelToWorldVisual [0,0.5, 0.1], 134,
|
2015-04-06 20:20:11 +00:00
|
|
|
* "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_placeExplosive;
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-29 04:57:11 +00:00
|
|
|
private ["_ammo", "_explosive", "_attachedTo", "_expPos", "_magazineTrigger"];
|
2015-04-01 18:43:18 +00:00
|
|
|
EXPLODE_6_PVT(_this,_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars);
|
2015-04-29 04:57:11 +00:00
|
|
|
DEFAULT_PARAM(6,_setupPlaceholderObject,objNull);
|
|
|
|
|
2015-05-19 18:29:23 +00:00
|
|
|
_unit playActionNow "PutDown";
|
|
|
|
|
2015-04-29 04:57:11 +00:00
|
|
|
_attachedTo = objNull;
|
|
|
|
if (!isNull _setupPlaceholderObject) then {
|
|
|
|
_attachedTo = attachedTo _setupPlaceholderObject;
|
|
|
|
deleteVehicle _setupPlaceholderObject;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (isNil "_triggerConfig") exitWith {
|
2015-04-06 20:20:11 +00:00
|
|
|
diag_log format ["ACE_Explosives: Error config not passed to PlaceExplosive: %1", _this];
|
|
|
|
objNull
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-12 09:48:26 +00:00
|
|
|
_magazineTrigger = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> _triggerConfig;
|
2015-04-10 03:56:19 +00:00
|
|
|
_triggerConfig = ConfigFile >> "ACE_Triggers" >> _triggerConfig;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (isNil "_triggerConfig") exitWith {
|
2015-04-06 20:20:11 +00:00
|
|
|
diag_log format ["ACE_Explosives: Error config not found in PlaceExplosive: %1", _this];
|
|
|
|
objNull
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_ammo = getText(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ammo");
|
|
|
|
if (isText(_magazineTrigger >> "ammo")) then {
|
2015-04-06 20:20:11 +00:00
|
|
|
_ammo = getText (_magazineTrigger >> "ammo");
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
_triggerSpecificVars pushBack _triggerConfig;
|
2015-03-31 21:20:32 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
_explosive = createVehicle [_ammo, _pos, [], 0, "NONE"];
|
2015-03-31 21:20:32 +00:00
|
|
|
_explosive setPosATL _pos;
|
2015-02-20 01:28:16 +00:00
|
|
|
|
2015-05-27 04:15:50 +00:00
|
|
|
["explosive_placed", [_explosive]] call EFUNC(common,globalEvent);
|
|
|
|
|
2015-04-29 04:57:11 +00:00
|
|
|
if (!isNull _attachedTo) then {
|
|
|
|
TRACE_1("Attaching Live Explosive",_attachedTo);
|
|
|
|
_explosive attachTo [_attachedTo];
|
|
|
|
};
|
|
|
|
|
2015-01-12 09:48:26 +00:00
|
|
|
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars]
|
2015-04-06 20:20:11 +00:00
|
|
|
call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive};
|
2015-02-20 01:28:16 +00:00
|
|
|
[[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc);
|
2015-01-11 16:42:31 +00:00
|
|
|
_explosive
|