ACE3/addons/dragon/functions/fnc_sightAttach.sqf
PabstMirror 8763184b6a
CSW/Dragon cleanup and rearm compat (#7068)
* Dragon work

cleanup
remove unused p3ds
add pos_gunner_dir/pos_gunner to static
add [csw] prefix to arsenal version
add sight interaction icons

* Update fnc_staticWeaponInit_unloadExtraMags.sqf

* ace_rearm compat

allows pulling carry mags out of rearm trucks

* Update fnc_ai_handleFired.sqf

* Re-add 3den attributes

* cleanup and move A2 staticweapon strings to ace_csw
2019-07-05 17:57:22 -05:00

34 lines
1.1 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Brandon (TCVM)
* Attaches the sighting unit to the Dragon missile.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Unit Performing Action <OBJECT>
* 2: Is event (function recursives globaly to set weapon where turret is local) <BOOL> (default: false)
*
* 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);
if (_event isEqualTo true) then { // this is actually needed as 3rd arg may not be bool
if (!(_target turretLocal [0])) exitWith {};
_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;
};