Files
ACE3/addons/rearm/functions/fnc_dropAmmo.sqf
Timi007 32c7181766 General - Make type syntax in header more consistent (#10681)
* Fix spelling and casing of types

* Fix spelling and casing

* Fix syntax of multi-types and plural of types

* POSITION -> ARRAY

* Remove implicit nil

* Fix type

* Remove optional type

* Rename BOOLEAN to BOOL

* Add helper script

* Add docs

* Remove optional

* Unify optional argument syntax

* Fix spelling of public functions

* Fix for multiple types

* Update fnc_getDelayItem.sqf

* Apply review findings

* Fix more findings

* Fix type

* Move default value after TYPE

* Do not allow for | in types and allow nested types using < >

* Fix spelling

* Improve validation of argument type for documentation

* Apply suggestions from code review

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Standardize header syntax

---------

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2025-06-14 04:59:19 -07:00

47 lines
1.1 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: GitHawk
* Drops a magazine, optionally deletes it and optionally unholsters the weapon.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Delete dummy object <BOOL> (default: false)
* 2: Unholster Weapon <BOOL> (default: true)
*
* Return Value:
* None
*
* Example:
* [player, true, true] call ace_rearm_fnc_dropAmmo
*
* Public: No
*/
params [
"_unit",
["_delete", false],
["_unholster", true]
];
private _dummy = _unit getVariable [QGVAR(dummy), objNull];
if !(isNull _dummy) then {
detach _dummy;
if (_delete) then {
deleteVehicle _dummy;
} else {
_dummy setVelocity [0,0,-0.1];
};
_unit setVariable [QGVAR(dummy), objNull];
};
private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
_unit setVariable [QGVAR(ReleaseActionID), nil];
};
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
if (_unholster) then {
REARM_UNHOLSTER_WEAPON
};