ACE3/addons/spottingscope/functions/fnc_place.sqf

42 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-06-05 07:34:27 +00:00
/*
* Author: Rocko, Ruthberg
* Place down spotting scope
*
* Arguments:
* 0: unit <OBJECT>
* 1: scope class <STRING>
*
* Return value:
* None
2015-08-07 09:47:23 +00:00
*
* Example:
* [player, "ACE_SpottingScope"] call ace_spottingscope_fnc_place
*
* Public: No
2015-06-05 07:34:27 +00:00
*/
#include "script_component.hpp"
2015-08-07 09:47:23 +00:00
params ["_unit", "_scopeClass"];
2015-06-05 07:34:27 +00:00
_unit removeItem _scopeClass;
if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then {
_unit playMove "AmovPercMstpSrasWrflDnon_diary";
};
[{
2015-08-07 09:47:23 +00:00
params ["_unit"];
2015-06-05 07:34:27 +00:00
private ["_direction", "_position", "_spottingScope"];
_direction = getDir _unit;
_position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0.02];
2015-08-07 09:47:23 +00:00
2015-06-05 07:34:27 +00:00
_spottingScope = "ACE_SpottingScopeObject" createVehicle [0, 0, 0];
_spottingScope setDir _direction;
_spottingScope setPosASL _position;
if ((getPosATL _spottingScope select 2) - (getPos _spottingScope select 2) < 1E-5) then {
2015-08-07 09:47:23 +00:00
_spottingScope setVectorUp (surfaceNormal (position _spottingScope));
2015-06-05 07:34:27 +00:00
};
_unit reveal _spottingScope;
}, [_unit], 1, 0] call EFUNC(common,waitAndExecute);