2015-01-12 09:48:26 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Starts the setup process for the passed explosive. Player only.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Classname of explosive to place. (CfgMagazine class) <STRING>
|
|
|
|
* 2: Trigger Config <CONFIG>
|
|
|
|
* 3: Timer (optional) <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, "SatchelCharge_Remote_Mag", "Command"] call ACE_Explosives_fnc_SetupExplosive;
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-12 09:48:26 +00:00
|
|
|
private ["_unit", "_class", "_config", "_timer"];
|
|
|
|
_unit = _this select 0;
|
|
|
|
_class = _this select 1;
|
|
|
|
_config = _this select 2;
|
|
|
|
_timer = _this select 3;
|
|
|
|
GVAR(placer) = _unit;
|
|
|
|
// Commented out due to the fact there is a distinction between who can deactivate mines and who can plant them in standard configs.
|
|
|
|
// Would require custom config entries (ACE_ExplosiveSpecialist/ACE_Specialist) which excludes custom mods.
|
|
|
|
//if (ACE_Explosives_RequireSpecialist && {!([_unit] call ACE_Core_fnc_isEOD)}) exitWith {};
|
|
|
|
if (isNil "_config") then {
|
2015-01-13 21:49:27 +00:00
|
|
|
_config = getArray(ConfigFile >> "CfgMagazines" >> _class >> "ACE_Triggers" >> "SupportedTriggers") select 0;
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(Setup) = getText(ConfigFile >> "CfgMagazines" >> _class >> "ACE_SetupObject") createVehicleLocal [0,0,-10000];
|
|
|
|
|
|
|
|
GVAR(Setup) enableSimulationGlobal false;
|
|
|
|
GVAR(Setup) setVariable [QGVAR(Class), _class];
|
|
|
|
GVAR(Setup) setVariable [QGVAR(Trigger), _config];
|
|
|
|
//GVAR(Setup) setVariable [QGVAR(Offset), GetArray(ConfigFile >> "CfgVehicles" >> typeof GVAR(Setup) >> "ACE_Offset")];
|
|
|
|
if (!isNil "_timer") then {
|
|
|
|
GVAR(Setup) setVariable [QGVAR(Timer), _timer];
|
|
|
|
};
|
|
|
|
|
2015-01-14 13:11:46 +00:00
|
|
|
[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus);
|
2015-01-12 09:48:26 +00:00
|
|
|
GVAR(TweakedAngle) = 180;
|
|
|
|
[QGVAR(Placement),"OnEachFrame", {
|
|
|
|
private "_player";
|
|
|
|
_player = ACE_player;
|
|
|
|
if (GVAR(placer) != _player) exitWith {
|
2015-01-13 21:49:27 +00:00
|
|
|
call FUNC(place_Cancel);
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|
|
|
|
GVAR(pfeh_running) = true;
|
|
|
|
_pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]);
|
|
|
|
//_pos = _pos vectorAdd ((VectorDir GVAR(Setup)) vectorCrossProduct (GVAR(Setup) getVariable [QGVAR(Offset), [0,0,0]]));
|
|
|
|
GVAR(Setup) setPosATL _pos;
|
|
|
|
if (ACE_Modifier == 0) then {
|
|
|
|
GVAR(Setup) setDir (GVAR(TweakedAngle) + getDir _player);
|
|
|
|
};
|
2015-01-13 10:13:43 +00:00
|
|
|
}] call CALLSTACK(BIS_fnc_addStackedEventHandler);
|
2015-01-12 09:48:26 +00:00
|
|
|
[localize "STR_ACE_Explosives_PlaceAction", localize "STR_ACE_Explosives_CancelAction",
|
2015-01-15 19:13:12 +00:00
|
|
|
localize "STR_ACE_Explosives_ScrollAction"] call EFUNC(interaction,showMouseHint);
|
2015-01-12 09:48:26 +00:00
|
|
|
_unit setVariable [QGVAR(Place), [_unit, "DefaultAction",
|
2015-01-14 13:11:46 +00:00
|
|
|
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Approve);}] call EFUNC(common,AddActionEventHandler)];
|
2015-01-12 09:48:26 +00:00
|
|
|
_unit setVariable [QGVAR(Cancel), [_unit, "MenuBack",
|
2015-01-14 13:11:46 +00:00
|
|
|
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Cancel);}] call EFUNC(common,AddActionEventHandler)];
|