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>
|
|
|
|
* 4: Config of trigger <CONFIG>
|
|
|
|
* 5: Variables required for the trigger type <ARRAY>
|
|
|
|
* 6: Should direction be set <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Placed explosive <OBJECT>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* _explosive = [player, player modelToWorld [0,0.5, 0.1], 134,
|
|
|
|
* "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_placeExplosive;
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
private ["_pos", "_dir", "_magazineClass", "_ammo", "_triggerSpecificVars", "_unit", "_triggerConfig", "_explosive"];
|
|
|
|
_unit = _this select 0;
|
|
|
|
_pos = _this select 1;
|
|
|
|
_dir = _this select 2;
|
|
|
|
_magazineClass = _this select 3;
|
|
|
|
_triggerConfig = _this select 4;
|
|
|
|
_triggerSpecificVars = _this select 5;
|
|
|
|
_setDir = true;
|
|
|
|
if (count _this > 6) then {
|
|
|
|
_setDir = _this select 6;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (isNil "_triggerConfig") exitWith {
|
2015-01-12 09:48:26 +00:00
|
|
|
diag_log format ["ACE_Explosives: Error config not passed to PlaceExplosive: %1", _this];
|
2015-01-11 16:42:31 +00:00
|
|
|
objNull
|
|
|
|
};
|
|
|
|
|
2015-01-12 09:48:26 +00:00
|
|
|
_magazineTrigger = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> _triggerConfig;
|
|
|
|
_triggerConfig = ConfigFile >> "CfgACE_Triggers" >> _triggerConfig;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (isNil "_triggerConfig") exitWith {
|
2015-01-12 09:48:26 +00:00
|
|
|
diag_log format ["ACE_Explosives: Error config not found in PlaceExplosive: %1", _this];
|
2015-01-11 16:42:31 +00:00
|
|
|
objNull
|
|
|
|
};
|
|
|
|
|
|
|
|
_ammo = getText(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ammo");
|
|
|
|
if (isText(_magazineTrigger >> "ammo")) then {
|
|
|
|
_ammo = getText (_magazineTrigger >> "ammo");
|
|
|
|
};
|
|
|
|
_triggerSpecificVars pushBack _triggerConfig;
|
|
|
|
_explosive = createVehicle [_ammo, _pos, [], 0, "NONE"];
|
2015-01-12 09:48:26 +00:00
|
|
|
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars]
|
|
|
|
call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive};
|
2015-01-11 16:42:31 +00:00
|
|
|
if (_setDir) then {
|
2015-01-14 13:13:04 +00:00
|
|
|
[[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)]
|
|
|
|
call EFUNC(common,execRemoteFnc);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
_explosive
|