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>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-02-20 01:28:16 +00:00
|
|
|
* [player, "SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_SetupExplosive;
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-02-20 01:28:16 +00:00
|
|
|
closeDialog 0;
|
|
|
|
private ["_unit", "_class"];
|
2015-01-12 09:48:26 +00:00
|
|
|
_unit = _this select 0;
|
|
|
|
_class = _this select 1;
|
|
|
|
GVAR(placer) = _unit;
|
2015-02-20 01:28:16 +00:00
|
|
|
// TODO: check MP performance and MP compatible.
|
|
|
|
GVAR(Setup) = createVehicle [getText(ConfigFile >> "CfgMagazines" >> _class >> "ACE_SetupObject"),[0,0,-10000],[], 0, "NONE"];
|
2015-01-12 09:48:26 +00:00
|
|
|
|
|
|
|
GVAR(Setup) enableSimulationGlobal false;
|
2015-02-20 01:28:16 +00:00
|
|
|
GVAR(Setup) setVariable [QGVAR(class), _class];
|
|
|
|
private "_container";
|
|
|
|
_container = [GVAR(Setup),"",QUOTE(PATHTOF(UI\Explosives_Menu_ca.paa)),"",{}, {true}, 4] call EFUNC(interact_menu,addAction);
|
|
|
|
[_container,"Set Trigger", QUOTE(PATHTOF(UI\Explosives_Menu_ca.paa)),"",
|
|
|
|
{[_target getVariable QGVAR(class),_target] call FUNC(openTriggerSelectionUI)}, {true}, 4] call EFUNC(interact_menu,addAction);
|
|
|
|
[_container,"Pick up", QUOTE(PATHTOF(UI\Explosives_Menu_ca.paa)),"",
|
|
|
|
{ACE_Player addMagazine (_target getVariable QGVAR(class));deleteVehicle _target;}, {true}, 4] call EFUNC(interact_menu,addAction);
|
2015-01-12 09:48:26 +00:00
|
|
|
|
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;
|
2015-02-20 01:28:16 +00:00
|
|
|
|
2015-01-12 09:48:26 +00:00
|
|
|
[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]);
|
|
|
|
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-02-20 01:28:16 +00:00
|
|
|
|
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)];
|