2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2019-06-08 04:48:37 +00:00
|
|
|
/*
|
2023-08-16 23:18:01 +00:00
|
|
|
* Author: tcvm
|
2019-06-08 04:48:37 +00:00
|
|
|
* Attaches the sighting unit to the Dragon missile.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Target <OBJECT>
|
|
|
|
* 1: Unit Performing Action <OBJECT>
|
2019-07-05 22:57:22 +00:00
|
|
|
* 2: Is event (function recursives globaly to set weapon where turret is local) <BOOL> (default: false)
|
2019-06-08 04:48:37 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can Attach Sighting Unit <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [cursorObject, player] call ace_dragon_fnc_sightAttach
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_target", "_unit", ["_event", false]];
|
|
|
|
TRACE_3("sightAttach",_target,_unit,_event);
|
|
|
|
|
2019-07-05 22:57:22 +00:00
|
|
|
if (_event isEqualTo true) then { // this is actually needed as 3rd arg may not be bool
|
2024-06-18 14:08:03 +00:00
|
|
|
if !(_target turretLocal [0]) exitWith {};
|
2019-06-08 04:48:37 +00:00
|
|
|
_target setVariable [QGVAR(sightAttached), true, true];
|
|
|
|
_target animate ["optic_hide", 0];
|
|
|
|
_target addWeapon QGVAR(superStatic);
|
|
|
|
_target removeWeapon QGVAR(dummyStatic);
|
|
|
|
TRACE_2("added sight",_target weaponsTurret [0],_target animationPhase "optic_hide");
|
|
|
|
} else {
|
|
|
|
_unit removeWeapon QGVAR(sight);
|
|
|
|
[QGVAR(attachSight), [_target, _unit, true]] call CBA_fnc_globalEvent;
|
|
|
|
};
|