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;
|
2015-04-01 18:43:18 +00:00
|
|
|
EXPLODE_2_PVT(_this,_unit,_class);
|
2015-01-12 09:48:26 +00:00
|
|
|
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-03-31 17:26:38 +00:00
|
|
|
GVAR(Setup) setVariable [QGVAR(class), _class, true];
|
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", {
|
2015-04-06 20:20:11 +00:00
|
|
|
private "_player";
|
|
|
|
_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);
|
|
|
|
};
|
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-04-06 20:20:11 +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-04-06 20:20:11 +00:00
|
|
|
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Approve);}] call EFUNC(common,AddActionEventHandler)];
|
2015-04-01 18:43:18 +00:00
|
|
|
_unit setVariable [QGVAR(Cancel), [_unit, "zoomtemp",
|
2015-04-06 20:20:11 +00:00
|
|
|
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Cancel);}] call EFUNC(common,AddActionEventHandler)];
|