Attach the real explosive

This commit is contained in:
PabstMirror 2015-04-28 23:57:11 -05:00
parent a80e11d025
commit 409851dd8c
5 changed files with 27 additions and 5 deletions

View File

@ -1,7 +1,10 @@
/*
* Author: Garth 'L-H' de Wet
* Handles the "EpeContactStart" event when placing the explosive.
*
* Arguments:
* 0: Explosive Placing Object <OBJECT>
* 1: Colliding Object <OBJECT>
*
* Return Value:
* None
@ -14,19 +17,23 @@
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_explosive,_hitTarget);
TRACE_2("Explosive EpeContactStart",_explosive,_hitTarget);
if ((_explosive getVariable [QGVAR(Handled), false])) exitWith {};
_explosive setVariable [QGVAR(Handled), true];
if (!isNull _hitTarget && {_hitTarget isKindOf "AllVehicles"}) then {
TRACE_1("Attaching to",_hitTarget);
_explosive attachTo [_hitTarget];
private "_dir";
_dir = _setup getVariable [QGVAR(Direction), 0];
_dir = _explosive getVariable [QGVAR(Direction), 0];
_dir = _dir - (getDir _hitTarget);
[[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc);
} else {
[{
EXPLODE_2_PVT(_this,_player,_explosive);
private "_pos";
_pos = getPosASL _explosive;
if (surfaceIsWater _pos) then {
_pos = getPosASL _explosive;
_explosive setPosASL _pos;

View File

@ -21,10 +21,14 @@
* Public: Yes
*/
#include "script_component.hpp"
private ["_ammo", "_explosive"];
private ["_ammo", "_explosive", "_attachedTo", "_expPos", "_magazineTrigger"];
EXPLODE_6_PVT(_this,_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars);
if (count _this > 6) then {
deleteVehicle (_this select 6);
DEFAULT_PARAM(6,_setupPlaceholderObject,objNull);
_attachedTo = objNull;
if (!isNull _setupPlaceholderObject) then {
_attachedTo = attachedTo _setupPlaceholderObject;
deleteVehicle _setupPlaceholderObject;
};
if (isNil "_triggerConfig") exitWith {
@ -57,6 +61,11 @@ _expPos = getPosATL _explosive;
_defuseHelper setPosATL (((getPosATL _defuseHelper) vectorAdd (_pos vectorDiff _expPos)));
_explosive setPosATL _pos;
if (!isNull _attachedTo) then {
TRACE_1("Attaching Live Explosive",_attachedTo);
_explosive attachTo [_attachedTo];
};
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars]
call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive};
[[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc);

View File

@ -19,6 +19,7 @@
EXPLODE_2_PVT(_this,_explosive,_delay);
[{
private ["_explosive"];
_explosive = _this;
if (!isNull _explosive) then {
[_explosive, -1, [_explosive, 0]] call FUNC(detonateExplosive);

View File

@ -14,7 +14,10 @@
* Public: Yes
*/
#include "script_component.hpp"
private "_result";
private["_result", "_config", "_count", "_index", "_supports"];
// IGNORE_PRIVATE_WARNING(_supports);
_result = [];
_config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "ACE_Triggers" >> "SupportedTriggers");
_count = count _config;

View File

@ -1,6 +1,8 @@
#define COMPONENT explosives
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
#ifdef DEBUG_ENABLED_EXPLOSIVES
#define DEBUG_MODE_FULL
#endif