Merge pull request #1902 from acemod/virtualExplosivesPlace

Virtual explosives place
This commit is contained in:
PabstMirror 2015-08-23 16:57:24 -05:00
commit 05925ad7c2
44 changed files with 519 additions and 285 deletions

View File

@ -1,5 +1,5 @@
class ACE_Triggers {
/* onPlace parameters:
/* onPlace parameters:
0: OBJECT - unit placing
1: OBJECT - Placed explosive
2: STRING - Magazine classname
@ -7,46 +7,54 @@ class ACE_Triggers {
Last Index: ACE_Triggers config of trigger type.
onSetup parameters:
0: STRING - Magazine Classname
*/
*/
class Command {
isAttachable = 1;
displayName = CSTRING(clacker_displayName);
picture = PATHTOF(Data\UI\Clacker.paa);
onPlace = QUOTE(_this call FUNC(AddClacker);false);
requires[] = {"ACE_Clacker"};
};
class MK16_Transmitter:Command {
isAttachable = 1;
displayName = CSTRING(MK16_displayName);
picture = PATHTOF(Data\UI\MK16_Reciever_ca.paa);
requires[] = {"ACE_M26_Clacker"};
};
class DeadManSwitch:Command {
isAttachable = 1;
displayName = CSTRING(DeadManSwitch_displayName);
picture = PATHTOF(Data\UI\DeadmanSwitch.paa);
requires[] = {"ACE_DeadManSwitch"};
};
class Cellphone:Command {
isAttachable = 1;
displayName = CSTRING(cellphone_displayName);
picture = PATHTOF(Data\UI\Cellphone_UI.paa);
onPlace = QUOTE(_this call FUNC(addCellphoneIED);false);
requires[] = {"ACE_Cellphone"};
};
class PressurePlate {
isAttachable = 0;
displayName = CSTRING(PressurePlate);
picture = PATHTOF(Data\UI\PressurePlate.paa);
onPlace = "_dist=GetNumber(ConfigFile >> 'CfgMagazines' >> (_this select 2) >> 'ACE_Triggers' >> 'PressurePlate' >> 'digDistance');_ex=_this select 1;_ex setPosATL ((getPosATL _ex) vectorDiff ((VectorUp _ex) vectorCrossProduct [0,0,_dist]));false";
onPlace = QUOTE(false);
};
class IRSensor {
isAttachable = 0;
displayName = CSTRING(IRSensor);
picture = PATHTOF(Data\UI\PressurePlate.paa);
onPlace = "false";
};
class Timer {
isAttachable = 1;
displayName = CSTRING(timerName);
picture = PATHTOF(data\UI\Timer.paa);
onPlace = QUOTE([ARR_2(_this select 1,(_this select 3) select 0)] call FUNC(startTimer);false);
onSetup = QUOTE(_this call FUNC(openTimerSetUI);true);
};
class Tripwire {
isAttachable = 0;
displayName = CSTRING(TripWire);
picture = PATHTOF(Data\UI\Tripwire.paa);
onPlace = "false";

View File

@ -11,7 +11,7 @@ class Extended_PostInit_EventHandlers {
class Extended_Killed_EventHandlers {
class CAManBase {
GVAR(killedHandler) = QUOTE(_this call FUNC(onKilled));
GVAR(killedHandler) = QUOTE(_this call FUNC(onIncapacitated));
};
};

View File

@ -8,7 +8,7 @@ class CfgMagazines {
class ACE_Triggers {
SupportedTriggers[] = {"PressurePlate"};
class PressurePlate {
digDistance = 0.1;
digDistance = 0.06;
};
};
};
@ -17,7 +17,7 @@ class CfgMagazines {
class ACE_Triggers {
SupportedTriggers[] = {"PressurePlate"};
class PressurePlate {
digDistance = 0.075;
digDistance = 0.08;
};
};
};
@ -26,7 +26,7 @@ class CfgMagazines {
class ACE_Triggers {
SupportedTriggers[] = {"PressurePlate"};
class PressurePlate {
digDistance = 0.05;
digDistance = 0.02;
};
};
};
@ -96,7 +96,7 @@ class CfgMagazines {
};
};
};
class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag {
ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig";
class ACE_Triggers {
@ -113,9 +113,9 @@ class CfgMagazines {
ammo = "IEDUrbanBig_Range_Ammo";
pitch = 0;
};
};
};
};
class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag {
ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig";
class ACE_Triggers: ACE_Triggers {

View File

@ -0,0 +1,30 @@
class RscTitles {
class GVAR(virtualAmmo) {
idd = -1;
movingEnable = 1;
duration = 9999999;
fadein = 0;
fadeout = 0;
onLoad = "uiNamespace setVariable ['ACE_explosives_virtualAmmoDisplay', (_this select 0)];";
class controls {};
class objects {
class TheObject {
idc = 800851;
type = 82;
model = "\a3\weapons_f\Ammo\Handgrenade.p3d"; //dummy value, cannot be "" !!!
scale = 1;
direction[] = {0, 0, 1};
up[] = {0, 1, 0};
x = 0.5;
y = 0.5;
z = 1;
xBack = 0.5;
yBack = 0.5;
zBack = 0.5;
inBack = 0;
enableZoom = 0;
zoomDuration = 1;
};
};
};
};

View File

@ -15,20 +15,37 @@
*/
#include "script_component.hpp"
if !(hasInterface) exitWith {};
//Event for setting explosive placement angle/pitch:
[QGVAR(place), {_this call FUNC(setPosition)}] call EFUNC(common,addEventHandler);
["interactMenuOpened", {_this call FUNC(interactEH)}] call EFUNC(common,addEventHandler);
//When getting knocked out in medical, trigger deadman explosives:
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
if (isServer) then {
["medical_onUnconscious", {
params ["_unit", "_isUnconscious"];
if (!_isUnconscious) exitWith {};
TRACE_1("Knocked Out, Doing Deadman", _unit);
[_unit] call FUNC(onIncapacitated);
}] call EFUNC(common,addEventHandler);
};
if !(hasInterface) exitWith {};
GVAR(PlacedCount) = 0;
GVAR(Setup) = objNull;
GVAR(pfeh_running) = false;
GVAR(CurrentSpeedDial) = 0;
//Cancel placement if interact menu opened
["interactMenuOpened", {
if (GVAR(pfeh_running) && {!isNull (GVAR(Setup))}) then {
call FUNC(place_Cancel)
//Cancel placement if interact menu opened
if (GVAR(pfeh_running)) then {
GVAR(placeAction) = PLACE_CANCEL;
};
//Show defuse actions on cfgAmmos (allMines):
_this call FUNC(interactEH);
}] call EFUNC(common,addEventHandler);
[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler);
[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(common,addScrollWheelEventHandler);

View File

@ -44,15 +44,11 @@ PREP(getSpeedDialExplosive);
PREP(module);
PREP(onIncapacitated);
PREP(onInventoryChanged);
PREP(onKilled);
PREP(onLanded);
PREP(openTimerSetUI);
PREP(place_Approve);
PREP(place_Cancel);
PREP(placeExplosive);
PREP(removeFromSpeedDial);

View File

@ -12,6 +12,8 @@ class CfgPatches {
};
};
#include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgAmmo.hpp"
@ -21,6 +23,7 @@ class CfgPatches {
#include "ACE_Triggers.hpp"
#include "ExplosivesUI.hpp"
#include "GUI_VirtualAmmo.hpp"
class CfgActions {
class None;
@ -39,5 +42,3 @@ class CfgMineTriggers {
mineTriggerRange = 1;
};
};
#include "ACE_Settings.hpp"

View File

@ -18,7 +18,8 @@
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra);
params ["_unit", "_explosive", "_magazineClass", "_extra"];
TRACE_4("params",_unit,_explosive,_magazineClass,_extra);
private["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];
@ -50,6 +51,9 @@ if (isNil QGVAR(CellphoneIEDs)) then {
_count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")];
_count = _count + 1;
publicVariable QGVAR(CellphoneIEDs);
_unit sideChat format ["IED %1 code: %2", _count,_code];
//display IED number message:
[format ["IED %1 code: %2", _count,_code]] call EFUNC(common,displayTextStructured);
if !(_hasRequired) exitWith {};
[format ["IED %1", _count],_code] call FUNC(addToSpeedDial);

View File

@ -17,8 +17,12 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_explosive", "_magazineClass"];
TRACE_3("params",_unit,_explosive,_magazineClass);
private ["_clacker", "_config", "_requiredItems", "_hasRequired", "_detonators"];
EXPLODE_3_PVT(_this,_unit,_explosive,_magazineClass);
// Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1);
@ -41,4 +45,6 @@ _clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localiz
GVAR(PlacedCount)], _magazineClass, configName ((_this select 3) select (count (_this select 3) - 1))];
_unit setVariable [QGVAR(Clackers), _clacker, true];
_unit sideChat format [localize LSTRING(DetonateCode), GVAR(PlacedCount)];
//display clacker code message:
[format [localize LSTRING(DetonateCode), GVAR(PlacedCount)]] call EFUNC(common,displayTextStructured);

View File

@ -15,10 +15,13 @@
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detonator"];
TRACE_2("params",_unit,_detonator);
private ["_result", "_item", "_children", "_range", "_required"];
EXPLODE_2_PVT(_this,_unit,_detonator);
_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");
_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");
_result = [_unit] call FUNC(getPlacedExplosives);
_children = [];
@ -44,6 +47,6 @@ _children = [];
];
};
};
} foreach _result;
} forEach _result;
_children

View File

@ -1,6 +1,6 @@
/*
* Author: Garth 'L-H' de Wet and CAA-Picard
*
* Adds sub actions for all explosive magazines (from insertChildren)
*
* Arguments:
* 0: Unit <OBJECT>
@ -11,9 +11,11 @@
* Public: No
*/
#include "script_component.hpp"
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
EXPLODE_1_PVT(_this,_unit);
params ["_unit"];
TRACE_1("params",_unit);
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
_mags = magazines _unit;
_list = [];
@ -41,16 +43,16 @@ _children = [];
[
[
format ["Explosive_%1", _forEachIndex],
format [_name + " (%1)", _itemCount select _foreachIndex],
format [_name + " (%1)", _itemCount select _forEachIndex],
getText(_x >> "picture"),
{(_this select 2) call FUNC(setupExplosive);},
{_this call FUNC(setupExplosive);},
{true},
{},
[_unit, configName _x]
(configName _x)
] call EFUNC(interact_menu,createAction),
[],
_unit
];
} foreach _list;
} forEach _list;
_children

View File

@ -15,13 +15,16 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_name", "_code"];
TRACE_2("params",_name,_code);
private ["_speedDial", "_found"];
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
_found = false;
EXPLODE_2_PVT(_this,_name,_code);
if ((_code) == "") ExitWith {
if ((_code) == "") exitWith {
[_name] call FUNC(removeFromSpeedDial);
};
{
@ -29,7 +32,7 @@ if ((_code) == "") ExitWith {
_speedDial set [_foreachindex, _this];
_found = true;
};
} foreach _speedDial;
} forEach _speedDial;
if (!_found) then {
_speedDial pushBack _this;
};

View File

@ -14,8 +14,12 @@
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_children", "_config", "_detonators"];
_unit = _this select 0;
params ["_unit"];
TRACE_1("params",_unit);
private ["_children", "_config", "_detonators"];
_detonators = [_unit] call FUNC(getDetonators);
_children = [];
{
@ -34,6 +38,6 @@ _children = [];
[],
ACE_Player
];
} foreach _detonators;
} forEach _detonators;
_children

View File

@ -15,10 +15,14 @@
* Public: No
*/
#include "script_component.hpp"
private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers"];
EXPLODE_2_PVT(_this,_magazine,_explosive);
_detonators = [ACE_player] call FUNC(getDetonators);
params ["_magazine", "_explosive"];
TRACE_2("params",_magazine,_explosive);
private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers", "_isAttached"];
_isAttached = !isNull (attachedTo _explosive);
_detonators = [ACE_player] call FUNC(getDetonators);
_triggerTypes = [_magazine] call FUNC(triggerType);
_magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers";
_children = [];
@ -30,7 +34,7 @@ _children = [];
_hasRequiredItems = false;
};
} count _required;
if (_hasRequiredItems) then {
if (_hasRequiredItems && {(!_isAttached) || {(getNumber (_x >> "isAttachable")) == 1}}) then {
_children pushBack
[
[
@ -50,6 +54,6 @@ _children = [];
ACE_Player
];
};
} foreach _triggerTypes;
} forEach _triggerTypes;
_children

View File

@ -4,6 +4,7 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 0: Target <OBJECT>
*
* Return Value:
* Able to defuse <BOOL>
@ -14,8 +15,12 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
private ["_isSpecialist"];
EXPLODE_2_PVT(_this,_unit,_target);
if (isNull(_target getVariable [QGVAR(Explosive),objNull])) exitWith {
deleteVehicle _target;
false

View File

@ -14,7 +14,7 @@
* Public: Yes
*/
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
[_unit] call FUNC(hasPlacedExplosives) and {count ([_unit] call FUNC(getDetonators)) > 0}
params ["_unit"];
([_unit] call FUNC(hasPlacedExplosives)) && {(count ([_unit] call FUNC(getDetonators))) > 0}

View File

@ -15,9 +15,12 @@
* Public: Yes
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_explosive);
if (GVAR(ExplodeOnDefuse) && (random 1.0) < getNumber(ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse")) exitWith {
params ["_unit", "_explosive"];
TRACE_2("params",_unit,_explosive);
if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse"))}) exitWith {
TRACE_1("exploding on defuse",_explosive);
[_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive);
};

View File

@ -19,12 +19,16 @@
* Public: Yes
*/
#include "script_component.hpp"
private ["_result", "_ignoreRange", "_helpers", "_pos"];
EXPLODE_3_PVT(_this,_unit,_range,_item);
params ["_unit", "_range", "_item"];
TRACE_3("params",_unit,_range,_item);
private ["_result", "_ignoreRange", "_pos"];
_ignoreRange = (_range == -1);
_result = true;
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false};
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false};
if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
private ["_exp", "_previousExp"];
@ -40,11 +44,11 @@ if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhe
};
};
[{
private ["_explosive"];
_explosive = _this;
params ["_explosive"];
TRACE_1("exploding",_explosive);
if (!isNull _explosive) then {
_explosive setDamage 1;
};
}, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute);
}, [_item select 0], (_item select 1)] call EFUNC(common,waitAndExecute);
_result

View File

@ -15,8 +15,12 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_code"];
TRACE_2("params",_unit,_code);
private ["_arr", "_ran", "_i"];
EXPLODE_2_PVT(_this,_unit,_code);
if (_unit getVariable [QGVAR(Dialing),false]) exitWith {};
if !(alive _unit) exitWith {};
_unit setVariable [QGVAR(Dialing), true, true];
@ -36,7 +40,7 @@ if (_unit == ace_player) then {
[{
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75];
(_this select 0) setVariable [QGVAR(Dialing), false, true];
}, [_unit,_explosive select 0], 0.25 * (count _arr - 4), 0] call EFUNC(common,waitAndExecute);
}, [_unit,_explosive select 0], 0.25 * (count _arr - 4)] call EFUNC(common,waitAndExecute);
[_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer);
};
};

View File

@ -17,7 +17,10 @@
* Public: No
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code);
params ["_args", "_pfID"];
_args params ["_unit", "_i", "_arr", "_code"];
if ((_i mod 4) == 0) then {
playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit modelToWorldVisual [0,0.2,2]), 15,1,2.5];
};
@ -27,7 +30,7 @@ private "_explosive";
_explosive = [_code] call FUNC(getSpeedDialExplosive);
if (_i >= (count _arr + 2)) then {
[_this select 1] call CALLSTACK(cba_fnc_removePerFrameHandler);
[_pfID] call CALLSTACK(cba_fnc_removePerFrameHandler);
if ((count _explosive) > 0) then {
[_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive);
};
@ -41,4 +44,4 @@ if (_i == (count _arr)) then {
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75];
};
};
(_this select 0) set [1, _i + 1];
_args set [1, _i + 1];

View File

@ -16,8 +16,11 @@
#include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_detonators);
private ["_unit", "_items", "_result", "_config"];
_unit = _this select 0;
params ["_unit"];
TRACE_1("params",_unit);
private ["_items", "_result", "_config"];
_items = (items _unit);
_result = [];

View File

@ -18,8 +18,11 @@
#include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_allExplosives,_deadmanExplosives);
private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"];
_unit = _this select 0;
params ["_unit"];
TRACE_1("params",_unit);
private ["_clackerList", "_adjustedList", "_list", "_filter"];
_filter = nil;
if (count _this > 1) then {
_filter = ConfigFile >> "ACE_Triggers" >> (_this select 1);
@ -30,14 +33,14 @@ _clackerList = _unit getVariable [QGVAR(Clackers), []];
_list = [];
{
if (isNull (_x select 0)) then {
_clackerList set [_foreachIndex, "X"];
_clackerList set [_forEachIndex, "X"];
_adjustedList = true;
} else {
if (isNil "_filter" || {(ConfigFile >> "ACE_Triggers" >> (_x select 4)) == _filter}) then {
_list pushBack _x;
};
};
} foreach _clackerList;
} forEach _clackerList;
if (_adjustedList) then {
_clackerList = _clackerList - ["X"];
if (count _clackerList == 0) then {

View File

@ -14,8 +14,12 @@
* Public: Yes
*/
#include "script_component.hpp"
EXPLODE_1_PVT(_this,_code);
params ["_code"];
TRACE_1("params",_code);
private ["_explosive"];
if (isNil QGVAR(CellphoneIEDs)) exitWith {[]};
_explosive = [];
{
@ -24,4 +28,5 @@ _explosive = [];
};
false
} count GVAR(CellphoneIEDs);
_explosive

View File

@ -14,9 +14,9 @@
* Public: No
*/
#include "script_component.hpp"
if (isNull(GVAR(Setup)) || {ACE_Modifier == 0} || !GVAR(pfeh_running)) exitWith {false};
_this = _this * 5;
GVAR(Setup) setDir ((getDir GVAR(Setup)) + _this);
GVAR(TweakedAngle) = GVAR(TweakedAngle) + _this;
if ((!GVAR(pfeh_running)) || {ACE_Modifier == 0}) exitWith {false};
GVAR(TweakedAngle) = ((GVAR(TweakedAngle) + 7.2 * _this) + 360) % 360;
true

View File

@ -9,16 +9,18 @@
* The unit has explosives <BOOL>
*
* Example:
* _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives;
* hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives;
*
* Public: Yes
*/
#include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_hasExplosives);
private ["_unit", "_result", "_magazines"];
params ["_unit"];
TRACE_1("params",_unit);
private ["_result", "_magazines"];
_result = false;
_unit = _this select 0;
_magazines = magazines _unit;
{
if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "ACE_Placeable") == 1) exitWith {

View File

@ -16,7 +16,8 @@
*/
#include "script_component.hpp"
PARAMS_1(_interactionType);
params ["_interactionType"];
TRACE_1("params",_interactionType);
//Ignore self-interaction menu
if (_interactionType != 0) exitWith {};
@ -26,8 +27,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {};
[{
PARAMS_2(_args,_pfID);
EXPLODE_3_PVT(_args,_setPosition,_addedDefuseHelpers,_minesHelped);
params ["_args", "_pfID"];
_args params ["_setPosition", "_addedDefuseHelpers", "_minesHelped"];
if (!EGVAR(interact_menu,keyDown)) then {
TRACE_1("Cleaning Defuse Helpers",(count _addedDefuseHelpers));

View File

@ -14,20 +14,13 @@
* Public: No
*/
#include "script_component.hpp"
if !(isServer) exitWith {};
private["_activated", "_logic"];
params ["_logic"];
_logic = _this select 0;
_activated = _this select 2;
if !(_activated) exitWith {};
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"]
call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"]
call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"]
call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"] call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"] call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"] call EFUNC(Common,readSettingFromModule);
diag_log text "[ACE]: Explosive Module Initialized.";

View File

@ -14,13 +14,14 @@
* Public: No
*/
#include "script_component.hpp"
//NOTE: Extended_Killed_EventHandlers runs only where _unit is local
params ["_unit"];
TRACE_1("params",_unit);
private ["_deadman"];
_unit = _this select 0;
if (_unit == ACE_player) then {
call FUNC(place_Cancel);
};
if (!isServer) exitWith{};
_deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives);
{
[_unit, -1, _x, true] call FUNC(detonateExplosive);
} foreach _deadman;
} forEach _deadman;

View File

@ -17,8 +17,11 @@
* Public: No
*/
#include "script_component.hpp"
params ["_receiver", "_giver", "_item"];
TRACE_3("params",_receiver,_giver,_item);
private ["_config", "_detonators"];
PARAMS_3(_receiver,_giver,_item);
if (_receiver != ace_player) exitWith {};

View File

@ -1,45 +0,0 @@
/*
* 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
*
* Example:
* object addEventHandler ["EpeContactStart", ACE_explosive_fnc_onLanded];
*
* Public: No
*/
#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 = _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;
}else{
_pos = getPosATL _explosive;
_explosive setPosATL _pos;
};
}, [ACE_player, _explosive], 0.5, 0.1] call EFUNC(common,waitAndExecute);
};

View File

@ -15,7 +15,10 @@
* Public: No
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_explosive,_mag);
params ["_explosive", "_mag"];
TRACE_2("params",_explosive,_mag);
createDialog "RscACE_SelectTimeUI";
sliderSetRange [8845, 5, 900]; // 5seconds - 15minutes
sliderSetPosition [8845, 30];

View File

@ -21,9 +21,11 @@
* Public: Yes
*/
#include "script_component.hpp"
private ["_ammo", "_explosive", "_attachedTo", "_expPos", "_magazineTrigger"];
EXPLODE_6_PVT(_this,_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars);
DEFAULT_PARAM(6,_setupPlaceholderObject,objNull);
params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]];
TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject);
private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger", "_pitch", "_digDistance", "_canDigDown", "_soundEnviron", "_surfaceType"];
_unit playActionNow "PutDown";
@ -52,6 +54,28 @@ if (isText(_magazineTrigger >> "ammo")) then {
};
_triggerSpecificVars pushBack _triggerConfig;
//Dig the explosive down into the ground (usually on "pressurePlate")
if (isNumber (_magazineTrigger >> "digDistance")) then {
_digDistance = getNumber (_magazineTrigger >> "digDistance");
//Get Surface Type:
_canDigDown = true;
_surfaceType = surfaceType _pos;
if ((_surfaceType select [0,1]) == "#") then {_surfaceType = _surfaceType select [1, 99];};
if ((_surfaceType != "") || {isClass (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then {
_soundEnviron = getText (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron");
TRACE_2("Dig Down Surface",_surfaceType,_soundEnviron);
_canDigDown = !(_soundEnviron in ["road", "tarmac", "concrete", "concrete_int", "int_concrete", "concrete_ext"]);
};
//Don't dig down if pos ATL is high (in a building or A2 road)
if (_canDigDown && {(_pos select 2) < 0.1}) then {
TRACE_2("Can Dig Down",_digDistance,_pos);
_pos = _pos vectorAdd [0,0, (-1 * _digDistance)];
} else {
TRACE_2("Can NOT Dig Down",_digDistance,_pos);
};
};
_explosive = createVehicle [_ammo, _pos, [], 0, "NONE"];
_explosive setPosATL _pos;
@ -60,7 +84,17 @@ if (!isNull _attachedTo) then {
_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);
//If trigger has "onPlace" and it returns true, just exitWith the explosive
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {
TRACE_1("onPlace returns true",_explosive);
_explosive
};
//TODO: placing explosives on hills looks funny
_pitch = getNumber (_magazineTrigger >> "pitch");
//Globaly set the position angle:
[QGVAR(place), [_explosive, _dir, _pitch]] call EFUNC(common,globalEvent);
_explosive

View File

@ -1,46 +0,0 @@
/*
* Author: Garth 'L-H' de Wet
* Approves placement of the explosive, releases the placement object for it
* to settle in a location suitable for the explosive to be created.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ACE_Explosives_fnc_place_Approve;
*
* Public: No
*/
#include "script_component.hpp"
if (GVAR(pfeh_running)) then {
[QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler);
GVAR(pfeh_running) = false;
};
private ["_setup", "_player", "_dir"];
_setup = GVAR(Setup);
GVAR(Setup) = objNull;
[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler);
[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler);
GVAR(placer) = objNull;
_player = ACE_player;
call EFUNC(interaction,hideMouseHint);
if ((_setup getVariable [QGVAR(Class), ""]) == "") exitWith {
deleteVehicle _setup;
};
_dir = (getDir _setup);
if (_dir > 180) then {
_dir = _dir - 180;
} else {
_dir = 180 + _dir;
};
_setup setVariable [QGVAR(Direction), _dir, true];
_player setVariable [QGVAR(PlantingExplosive), true];
[{_this setVariable [QGVAR(PlantingExplosive), false]}, _player, 1.5, 0.5] call EFUNC(common,waitAndExecute);
_setup addEventHandler ["EpeContactStart", FUNC(onLanded)];
_setup enableSimulationGlobal true;
_player playActionNow "PutDown";
_player removeMagazine (_setup getVariable [QGVAR(Class), ""]);

View File

@ -1,32 +0,0 @@
/*
* Author: Garth 'L-H' de Wet
* Cancels placement of the explosive
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ACE_Explosives_fnc_place_Cancel;
*
* Public: Yes
*/
#include "script_component.hpp"
if (GVAR(pfeh_running)) then {
[QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler);
GVAR(pfeh_running) = false;
};
if (!isNull (GVAR(Setup))) then {
deleteVehicle GVAR(Setup);
};
GVAR(Setup) = objNull;
if (isNil {GVAR(placer)}) then {
GVAR(placer) = objNull;
};
[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
GVAR(placer) = objNull;
call EFUNC(interaction,hideMouseHint);
[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler);
[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler);

View File

@ -14,13 +14,15 @@
* Public: Yes
*/
#include "script_component.hpp"
private "_speedDial";
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
{
if ((_x select 0) == (_this select 0)) exitWith {
_speedDial set [_foreachIndex, "x"];
_speedDial set [_forEachIndex, "x"];
_speedDial = _speedDial - ["x"];
ace_player setVariable [QGVAR(SpeedDial),_speedDial];
};
} foreach _speedDial;
} forEach _speedDial;

View File

@ -16,12 +16,17 @@
* Public: No
*/
#include "script_component.hpp"
params ["_explosive", "_magazine", "_trigger"];
TRACE_3("params",_explosive,_magazine,_trigger);
private ["_config"];
EXPLODE_3_PVT(_this,_explosive,_magazine,_trigger);
_config = ConfigFile >> "ACE_Triggers" >> _trigger;
// If the onSetup function returns true, it is handled elsewhere
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {};
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {
TRACE_2("onSetup returned true",_explosive,_trigger);
};
[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call ACE_Explosives_fnc_placeExplosive;
[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call FUNC(placeExplosive);

View File

@ -11,13 +11,21 @@
* None
*
* Example:
* [_explosive, 150, 90] call ACE_Explosives_fnc_SetPos;
* [_explosive, 150, 90] call ACE_Explosives_fnc_setPosition;
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_explosive,_direction,_pitch);
_explosive setDir _direction;
if (_pitch != 0) then {
[_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank);
params ["_explosive", "_direction", "_pitch"];
TRACE_3("params",_explosive,_direction,_pitch);
if (isNull (attachedTo _explosive)) then {
_explosive setDir _direction;
if (_pitch != 0) then {
[_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank);
};
} else {
//Attaching to a vehicle (dirAndUp based on vehicle)
_explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]];
};

View File

@ -15,7 +15,9 @@
* Public: No
*/
#include "script_component.hpp"
private ["_speedDial", "_amount"];
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
_amount = if((_this select 0))then{1}else{-1};

View File

@ -3,8 +3,9 @@
* Starts the setup process for the passed explosive. Player only.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Classname of explosive to place. (CfgMagazine class) <STRING>
* 0: Vehicle <OBJECT>
* 1: Player Unit <OBJECT>
* 2: Classname of explosive to place. (CfgMagazine class) <STRING>
*
* Return Value:
* None
@ -14,36 +15,203 @@
*
* Public: Yes
*/
// #define ENABLE_PERFORMANCE_COUNTERS
#include "script_component.hpp"
closeDialog 0;
EXPLODE_2_PVT(_this,_unit,_class);
GVAR(placer) = _unit;
// TODO: check MP performance and MP compatible.
GVAR(Setup) = createVehicle [getText(ConfigFile >> "CfgMagazines" >> _class >> "ACE_SetupObject"),[0,0,-10000],[], 0, "NONE"];
GVAR(Setup) enableSimulationGlobal false;
GVAR(Setup) setVariable [QGVAR(class), _class, true];
#define PLACE_RANGE_MAX 1
#define PLACE_RANGE_MIN 0.025
params ["_vehicle", "_unit", "_magClassname"];
TRACE_3("params",_vehicle,_unit,_magClassname);
private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"];
//Get setup object vehicle and model:
_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject");
if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");};
_p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model");
if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game!
[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus);
GVAR(TweakedAngle) = 180;
[QGVAR(Placement),"OnEachFrame", {
private ["_player", "_pos"];
_player = ACE_player;
if (GVAR(placer) != _player) exitWith {
call FUNC(place_Cancel);
};
GVAR(pfeh_running) = true;
_pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]);
GVAR(Setup) setPosATL _pos;
if (ACE_Modifier == 0) then {
GVAR(Setup) setDir (GVAR(TweakedAngle) + getDir _player);
};
}] call CALLSTACK(BIS_fnc_addStackedEventHandler);
//Show mouse buttons:
[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
_unit setVariable [QGVAR(cancelActionEH), [_unit, "zoomtemp", {true}, {GVAR(placeAction) = PLACE_CANCEL;}] call EFUNC(common,AddActionEventHandler)];
[localize LSTRING(PlaceAction), localize LSTRING(CancelAction),
localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
_unit setVariable [QGVAR(Place), [_unit, "DefaultAction",
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Approve);}] call EFUNC(common,AddActionEventHandler)];
_unit setVariable [QGVAR(Cancel), [_unit, "zoomtemp",
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Cancel);}] call EFUNC(common,AddActionEventHandler)];
//Display to show virtual object:
(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutRsc [QGVAR(virtualAmmo), "PLAIN", 0, false];
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel;
//Make sure it has a trigger that works when attached (eg, no tripwires that only do pressurePlate)
_isAttachable = false;
_supportedTriggers = getArray (configFile >> "CfgMagazines" >> _magClassname >> "ACE_Triggers" >> "SupportedTriggers");
{
if ((getNumber (configFile >> "ACE_Triggers" >> _x >> "isAttachable")) == 1) exitWith {_isAttachable = true;};
} forEach _supportedTriggers;
GVAR(pfeh_running) = true;
GVAR(placeAction) = PLACE_WAITING;
GVAR(TweakedAngle) = 0;
[{
BEGIN_COUNTER(pfeh);
params ["_args", "_pfID"];
_args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"];
private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"];
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL));
_basePosASL = (eyePos _unit);
if (cameraView == "EXTERNAL") then { //If external, show explosive over the right shoulder
_basePosASL = _basePosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0]));
};
if ((stance _unit) == "PRONE") then {
//If prone, lower base and increase up angle of look - Makes it much easier to attach to underside of vehicles
_basePosASL set [2, ((_basePosASL select 2) - 0.3)];
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,3,10]) call EFUNC(common,positionToASL));
};
_cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1);
_testPositionIsValid = {
_testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply (_this select 0));
_return = true;
{
_testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)];
#ifdef DEBUG_MODE_FULL
drawLine3d [(eyePos _unit) call EFUNC(common,ASLToPosition), (_testPos) call EFUNC(common,ASLToPosition), [1,0,0,1]];
#endif
if (lineIntersects [eyePos _unit, _testPos, _unit]) exitWith {_return = false;};
} forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]];
_return
};
_distanceFromBase = PLACE_RANGE_MAX;
_badPosition = !([_distanceFromBase] call _testPositionIsValid);
_attachVehicle = objNull;
if (_isAttachable && _badPosition) then {
_attachVehicle = objNull;
_testBase = _basePosASL vectorAdd _lookDirVector;
{
_testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)];
_intersectsWith = lineIntersectsWith [eyePos _unit, _testPos, _unit];
if (count _intersectsWith == 1) exitWith {_attachVehicle = (_intersectsWith select 0);};
} forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]];
if ((!isNull _attachVehicle) && {[PLACE_RANGE_MIN] call _testPositionIsValid} &&
{(_attachVehicle isKindOf "Car") || {_attachVehicle isKindOf "Tank"} || {_attachVehicle isKindOf "Air"} || {_attachVehicle isKindOf "Ship"}}) then {
_min = PLACE_RANGE_MIN;
_max = PLACE_RANGE_MAX;
for "_index" from 0 to 6 do {
_distanceFromBase = (_min + _max) / 2;
if ([_distanceFromBase] call _testPositionIsValid) then {
_min = _distanceFromBase;
} else {
_max = _distanceFromBase;
};
};
_badPosition = false;
_distanceFromBase = ((_min + _max) / 2 + 0.075) min 1;
} else {
_attachVehicle = objNull;
};
};
_virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase);
//Update mouse hint:
if (_badPosition) then {
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(BlockedAction);
} else {
if (isNull _attachVehicle) then {
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(PlaceAction);
} else {
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(AttachAction);
};
};
//Don't allow Placing bellow terrain
if ((getTerrainHeightASL _virtualPosASL) > (_virtualPosASL select 2)) then {
_virtualPosASL set [2, (getTerrainHeightASL _virtualPosASL)];
};
//Don't allow placing in a bad position:
if (_badPosition && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;};
if (((inputAction "zoomTemp") > 0) || //Cancel on RMB, For some reason this works (when held) but AddActionEventHandler doesn't
{_unit != ACE_player} ||
{!([_unit, objNull, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} ||
{!(_magClassname in (magazines _unit))}) then {
GVAR(placeAction) = PLACE_CANCEL;
};
if (GVAR(placeAction) != PLACE_WAITING) then {
[_pfID] call CBA_fnc_removePerFrameHandler;
GVAR(pfeh_running) = false;
[_unit, "ACE_Explosives", false] call EFUNC(common,setForceWalkStatus);
[] call EFUNC(interaction,hideMouseHint);
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
[_unit, "zoomtemp", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler);
(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
if (GVAR(placeAction) == PLACE_APPROVE) then {
_placeAngle = 0;
_expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition));
TRACE_1("Planting Mass", (getMass _expSetupVehicle));
//If the object is too heavy, it can kill a player if it colides
if ((getMass _expSetupVehicle) > 5) then {_expSetupVehicle setMass 5;};
if (isNull _attachVehicle) then {
_placeAngle = _cameraAngle - GVAR(TweakedAngle) + 180;
_expSetupVehicle setPosAsl _virtualPosASL;
_expSetupVehicle setDir _placeAngle;
_placeAngle = _placeAngle + 180; //CfgAmmos seem to be 180 for some reason
} else {
_modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition));
_placeAngle = _cameraAngle - (getDir _attachVehicle) + 180;
_expSetupVehicle attachTo [_attachVehicle, _modelOffset];
_expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]];
};
TRACE_1("Place angel",_placeAngle);
_expSetupVehicle setVariable [QGVAR(class), _magClassname, true];
_expSetupVehicle setVariable [QGVAR(Direction), _placeAngle, true];
_unit removeMagazine _magClassname;
_unit playActionNow "PutDown";
_unit setVariable [QGVAR(PlantingExplosive), true];
[{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call EFUNC(common,waitAndExecute);
};
} else {
_screenPos = worldToScreen (_virtualPosASL call EFUNC(common,ASLToPosition));
if (_badPosition || {_screenPos isEqualTo []}) then {
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false;
} else {
//Show the model on the hud in aprox the same size/location as it will be placed:
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true;
_realDistance = ((_virtualPosASL call EFUNC(common,ASLToPosition)) distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1);
_screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)];
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos;
_modelDir = [0,0,-1];
_modelUp = [0,-1,0];
if (isNull _attachVehicle) then {
_angle = acos (_lookDirVector select 2);
_modelUp = [0, (cos _angle), (sin _angle)];
_modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp;
};
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [_modelDir, _modelUp];
};
};
END_COUNTER(pfeh);
}, 0, [_unit, _magClassname, _setupObjectClass, _isAttachable]] call CBA_fnc_addPerFrameHandler;

View File

@ -15,14 +15,17 @@
* Public: Yes
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_target);
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
private["_actionToPlay", "_defuseTime", "_isEOD"];
_target = attachedTo (_target);
_fnc_DefuseTime = {
EXPLODE_2_PVT(_this,_specialist,_target);
params ["_specialist", "_target"];
TRACE_2("defuseTime",_specialist,_target);
private ["_defuseTime"];
_defuseTime = 5;
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then {
@ -48,11 +51,12 @@ if (ACE_player != _unit) then {
_unit disableAI "TARGET";
_defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime;
[{
PARAMS_2(_unit,_target);
params ["_unit", "_target"];
TRACE_2("defuse finished",_unit,_target);
[_unit, _target] call FUNC(defuseExplosive);
_unit enableAI "MOVE";
_unit enableAI "TARGET";
}, [_unit, _target], _defuseTime, 0] call EFUNC(common,waitAndExecute);
}, [_unit, _target], _defuseTime] call EFUNC(common,waitAndExecute);
};
} else {
_unit playActionNow _actionToPlay;

View File

@ -16,12 +16,13 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_explosive,_delay);
params ["_explosive", "_delay"];
TRACE_2("params",_explosive,_delay);
[{
private ["_explosive"];
_explosive = _this;
params ["_explosive"];
TRACE_1("Explosive Going Boom",_explosive);
if (!isNull _explosive) then {
[_explosive, -1, [_explosive, 0]] call FUNC(detonateExplosive);
};
}, _explosive, _delay, 0] call EFUNC(common,waitAndExecute);
}, [_explosive], _delay] call EFUNC(common,waitAndExecute);

View File

@ -9,17 +9,19 @@
* Supported triggers as ACE_Triggers config entries <ARRAY>
*
* Example:
* _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType
* ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType
*
* Public: Yes
*/
#include "script_component.hpp"
private["_result", "_config", "_count", "_index", "_supports"];
// IGNORE_PRIVATE_WARNING(_supports);
params ["_magazineClassname"];
TRACE_1("params",_magazineClassname);
private["_result", "_config", "_count", "_index"];
_result = [];
_config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "ACE_Triggers" >> "SupportedTriggers");
_config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers");
_count = count _config;
for "_index" from 0 to (_count - 1) do {

View File

@ -12,3 +12,7 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define PLACE_WAITING -1
#define PLACE_CANCEL 0
#define PLACE_APPROVE 1

View File

@ -61,6 +61,22 @@
<Portuguese>Colocar</Portuguese>
<Russian>Установить</Russian>
</Key>
<Key ID="STR_ACE_Explosives_AttachAction">
<English>Attach</English>
<German>Befestigen</German>
<Spanish>Acoplar</Spanish>
<Polish>Przyczep</Polish>
<French>Attacher</French>
<Czech>Připnout</Czech>
<Portuguese>Fixar</Portuguese>
<Italian>Attacca</Italian>
<Hungarian>Hozzácsatolás</Hungarian>
<Russian>Прикрепить</Russian>
</Key>
<Key ID="STR_ACE_Explosives_BlockedAction">
<English>Blocked</English>
<Spanish>Obstruido</Spanish>
</Key>
<Key ID="STR_ACE_Explosives_CancelAction">
<English>Cancel</English>
<German>Abbrechen</German>