ACE3/addons/malyutka/functions/fnc_unattachPlug.sqf
Brandon Danyluk fc7b310529 Add realistic 9m14 behaviour
the 9m14 control joystick can attach 4 9m14 launchers at a time. Replicate that here
2021-05-08 02:48:40 -06:00

36 lines
964 B
Plaintext

#include "script_component.hpp"
/*
* Author: Brandon (TCVM)
* Unattaches plug from control box
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [cursorObject, player] call ace_malyutka_fnc_unattachPlug
*
* Public: No
*/
params ["_unit", "_plug"];
private _suitcase = _plug getVariable QGVAR(origin);
private _controlBox = _plug getVariable QGVAR(attachedControlBox);
private _suitcaseIndex = _suitcase getVariable QGVAR(attachedToPlugNumber);
if (_suitcaseIndex < 0) exitWith {
WARNING_1("Somehow unattached plug when not first attached",_suitcaseIndex);
};
_suitcase setVariable [QGVAR(attachedToPlugNumber), -1, true];
private _statuses = _controlBox getVariable QGVAR(plugStatus);
_statuses set [_suitcaseIndex, objNull];
_controlBox setVariable [QGVAR(plugStatus), _statuses, true];
_plug setVariable [QGVAR(attachedControlBox), objNull, true];
[_unit, _plug] call FUNC(pickupPlug);