Merge pull request #912 from acemod/explosiveFixAttachDeleteVehicleFix

Explosive fix attach delete vehicle fix
This commit is contained in:
ulteq 2015-04-29 21:32:28 +02:00
commit 4eec4da37c
23 changed files with 68 additions and 28 deletions

View File

@ -37,7 +37,7 @@ player addEventHandler ["Killed", {
} count _deadman; } count _deadman;
}]; }];
player addEventHandler ["Take", { player addEventHandler ["Take", {
private ["_item", "_getter", "_giver", "_config"]; private ["_item", "_getter", "_giver", "_config", "_detonators"];
_item = _this select 2; _item = _this select 2;
_getter = _this select 0; _getter = _this select 0;
_giver = _this select 1; _giver = _this select 1;

View File

@ -17,7 +17,11 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra); EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra);
private["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];
// Config is the last item in the list of passed in items. // Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1); _config = (_this select 3) select (count (_this select 3) - 1);
@ -29,7 +33,7 @@ _detonators = [_unit] call FUNC(getDetonators);
_hasRequired = false; _hasRequired = false;
}; };
} count _requiredItems; } count _requiredItems;
private ["_code", "_count", "_codeSet"];
_codeSet = false; _codeSet = false;
while {!_codeSet} do { while {!_codeSet} do {
_code = str(round (random 9999)); _code = str(round (random 9999));

View File

@ -17,7 +17,7 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_clacker", "_config", "_requiredItems", "_hasRequired"]; private ["_clacker", "_config", "_requiredItems", "_hasRequired", "_detonators"];
EXPLODE_3_PVT(_this,_unit,_explosive,_magazineClass); EXPLODE_3_PVT(_this,_unit,_explosive,_magazineClass);
// Config is the last item in the list of passed in items. // Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1); _config = (_this select 3) select (count (_this select 3) - 1);

View File

@ -15,7 +15,7 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_result", "_item", "_children"]; private ["_result", "_item", "_children", "_range", "_required"];
EXPLODE_2_PVT(_this,_unit,_detonator); EXPLODE_2_PVT(_this,_unit,_detonator);
_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range"); _range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");

View File

@ -11,7 +11,7 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_mags", "_item", "_index", "_children"]; private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
EXPLODE_1_PVT(_this,_unit); EXPLODE_1_PVT(_this,_unit);

View File

@ -14,7 +14,7 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_items", "_unit", "_children", "_config"]; private ["_unit", "_children", "_config", "_detonators"];
_unit = _this select 0; _unit = _this select 0;
_detonators = [_unit] call FUNC(getDetonators); _detonators = [_unit] call FUNC(getDetonators);
_children = []; _children = [];

View File

@ -15,8 +15,7 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_hasRequiredItems","_triggerTypes", "_children", private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers"];
"_detonators", "_required", "_magTriggers"];
EXPLODE_2_PVT(_this,_magazine,_explosive); EXPLODE_2_PVT(_this,_magazine,_explosive);
_detonators = [ACE_player] call FUNC(getDetonators); _detonators = [ACE_player] call FUNC(getDetonators);

View File

@ -14,7 +14,7 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_specialist"]; private ["_isSpecialist"];
EXPLODE_2_PVT(_this,_unit,_target); EXPLODE_2_PVT(_this,_unit,_target);
if (isNull(_target getVariable [QGVAR(Explosive),objNull])) exitWith { if (isNull(_target getVariable [QGVAR(Explosive),objNull])) exitWith {
deleteVehicle _target; deleteVehicle _target;

View File

@ -19,18 +19,18 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_result", "_ignoreRange", "_helper"]; private ["_result", "_ignoreRange", "_helpers", "_pos"];
EXPLODE_3_PVT(_this,_unit,_range,_item); EXPLODE_3_PVT(_this,_unit,_range,_item);
_ignoreRange = (_range == -1); _ignoreRange = (_range == -1);
_result = true; _result = true;
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false}; if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false};
_helper = (attachedTo (_item select 0)); _helpers = attachedObjects (_item select 0);
if (!isNull(_helper)) then { {
detach (_item select 0); detach _x;
deleteVehicle _helper; deleteVehicle _x;
}; } forEach _helpers;
if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then { if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
private ["_exp", "_previousExp"]; private ["_exp", "_previousExp"];
@ -46,10 +46,11 @@ if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhe
}; };
}; };
[{ [{
_explosive = _this; private ["_explosive"];
if (!isNull _explosive) then { _explosive = _this;
_explosive setDamage 1; if (!isNull _explosive) then {
}; _explosive setDamage 1;
};
}, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute); }, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute);
_result _result

View File

@ -15,7 +15,7 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_arr", "_ran", "_i","_speedDial"]; private ["_arr", "_ran", "_i"];
EXPLODE_2_PVT(_this,_unit,_code); EXPLODE_2_PVT(_this,_unit,_code);
if (_unit getVariable [QGVAR(Dialing),false]) exitWith {}; if (_unit getVariable [QGVAR(Dialing),false]) exitWith {};
if !(alive _unit) exitWith {}; if !(alive _unit) exitWith {};

View File

@ -14,6 +14,8 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_detonators);
private ["_unit", "_items", "_result", "_config"]; private ["_unit", "_items", "_result", "_config"];
_unit = _this select 0; _unit = _this select 0;
_items = (items _unit); _items = (items _unit);

View File

@ -16,6 +16,8 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_allExplosives,_deadmanExplosives);
private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"]; private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"];
_unit = _this select 0; _unit = _this select 0;
_filter = nil; _filter = nil;

View File

@ -14,6 +14,8 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_hasExplosives);
private ["_unit", "_result", "_magazines"]; private ["_unit", "_result", "_magazines"];
_result = false; _result = false;
_unit = _this select 0; _unit = _this select 0;

View File

@ -14,4 +14,6 @@
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_hasPlacedExplosives);
(count (_this call FUNC(getPlacedExplosives)) > 0) (count (_this call FUNC(getPlacedExplosives)) > 0)

View File

@ -15,6 +15,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if !(isServer) exitWith {}; if !(isServer) exitWith {};
private["_activated", "_logic"];
_logic = _this select 0; _logic = _this select 0;
_activated = _this select 2; _activated = _this select 2;

View File

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

View File

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

View File

@ -19,7 +19,7 @@ if (GVAR(pfeh_running)) then {
[QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler); [QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler);
GVAR(pfeh_running) = false; GVAR(pfeh_running) = false;
}; };
private ["_mag", "_setup", "_player"]; private ["_setup", "_player", "_dir"];
_setup = GVAR(Setup); _setup = GVAR(Setup);
GVAR(Setup) = objNull; GVAR(Setup) = objNull;
[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus); [GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);

View File

@ -28,7 +28,7 @@ GVAR(Setup) setVariable [QGVAR(class), _class, true];
GVAR(TweakedAngle) = 180; GVAR(TweakedAngle) = 180;
[QGVAR(Placement),"OnEachFrame", { [QGVAR(Placement),"OnEachFrame", {
private "_player"; private ["_player", "_pos"];
_player = ACE_player; _player = ACE_player;
if (GVAR(placer) != _player) exitWith { if (GVAR(placer) != _player) exitWith {
call FUNC(place_Cancel); call FUNC(place_Cancel);

View File

@ -16,11 +16,14 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_target); EXPLODE_2_PVT(_this,_unit,_target);
private["_actionToPlay"];
_target = attachedTo (_target); _target = attachedTo (_target);
_fnc_DefuseTime = { _fnc_DefuseTime = {
EXPLODE_2_PVT(_this,_specialist,_target); EXPLODE_2_PVT(_this,_specialist,_target);
private ["_defuseTime"];
_defuseTime = 5; _defuseTime = 5;
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then { if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then {
_defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime"); _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime");

View File

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

View File

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

View File

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