ACE3/addons/sandbag/functions/fnc_deployConfirm.sqf

60 lines
1.5 KiB
Plaintext
Raw Normal View History

2015-06-02 17:30:50 +00:00
/*
* Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support
2015-06-02 17:30:50 +00:00
* Confirms sandbag deployment
*
* Arguments:
* 0: unit <OBJECT>
2015-06-02 17:30:50 +00:00
*
* Return Value:
* None
*
* Example:
* [ACE_player] call ace_sandbag_fnc_deployConfirm
2015-06-02 17:30:50 +00:00
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
2015-06-02 17:30:50 +00:00
// enable running again
[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus);
2015-06-02 17:30:50 +00:00
// remove sandbag from inventory
_unit removeItem "ACE_Sandbag_empty";
2015-06-02 17:30:50 +00:00
// delete placement dummy and create real sandbag
[{
if (isNull GVAR(sandBag)) exitWith {};
2015-06-02 17:30:50 +00:00
params ["_unit"];
2015-06-02 17:30:50 +00:00
private ["_position", "_direction", "_sandBag"];
2015-06-02 17:30:50 +00:00
_position = getPosASL GVAR(sandBag);
_direction = getDir GVAR(sandBag);
2015-08-08 00:00:00 +00:00
deleteVehicle GVAR(sandBag);
2015-08-08 00:00:00 +00:00
_sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"];
_sandBag setPosASL _position;
_sandBag setDir _direction;
2015-08-08 00:00:00 +00:00
2015-06-02 17:30:50 +00:00
GVAR(sandBag) = objNull;
}, [_unit], 1] call EFUNC(common,waitAndExecute);
// remove deployment pfh
[GVAR(deployPFH)] call CBA_fnc_removePerFrameHandler;
GVAR(deployPFH) = -1;
// remove mouse button actions
call EFUNC(interaction,hideMouseHint);
[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler);
[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler);
// play animation
_unit playActionNow "PutDown";
_unit setVariable [QGVAR(isDeploying), false, true];