Skip to content

Commit

Permalink
Common - Clean up ace_common_fnc_hasItem & `ace_common_fnc_hasMagaz…
Browse files Browse the repository at this point in the history
…ine` functions (#10108)

* Clean up hasItem & hasMagazine functions

* Replace EFUNC

* Update fnc_hasItem.sqf
  • Loading branch information
johnb432 committed Jul 3, 2024
1 parent 7b0e5b6 commit dae2c5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 5 additions & 5 deletions addons/common/functions/fnc_hasItem.sqf
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal
* Check if unit has item. Note: case-sensitive.
* Check if given unit has an item of given classname. Note: Case sensitive.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Item Classname <STRING>
* 1: Item classname <STRING>
*
* Return Value:
* Unit has Item <BOOL>
* Unit has item <BOOL>
*
* Example:
* [bob, "item"] call ace_common_fnc_hasItem
* [player, "ACE_Banana"] call ace_common_fnc_hasItem
*
* Public: Yes
*/

params [["_unit", objNull, [objNull]], ["_item", "", [""]]];

_item in (_unit call EFUNC(common,uniqueItems))
_item in (_unit call FUNC(uniqueItems)) // return
12 changes: 5 additions & 7 deletions addons/common/functions/fnc_hasMagazine.sqf
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal
* Check if given unit has a magazine of given classname
* Check if given unit has a magazine of given classname. Note: Case sensitive.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Magazine Classname <STRING>
* 1: Magazine classname <STRING>
*
* Return Value:
* has Magazine <BOOL>
* Unit has magazine <BOOL>
*
* Example:
* [bob, "magazine"] call ace_common_fnc_hasMagazine
* [player, "30Rnd_65x39_caseless_mag"] call ace_common_fnc_hasMagazine
*
* Public: yes
*
* Note: Case sensitive
*/

params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]];

_magazine in magazines _unit // return
_magazine in ([_unit, 2] call FUNC(uniqueItems)) // return

0 comments on commit dae2c5b

Please sign in to comment.