Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uniqueUnitItems typo and add assignedItems switch #922

Merged
merged 1 commit into from
May 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions addons/common/fnc_uniqueUnitItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Parameters:
_backpack - Include items in backpack (Default: true)
_vest - Include items in vest (Default: true)
_uniform - Include items in uniform (Default: true)
_assignedItems - Include assigned items (Default: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to alignment here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dedmen just copy pasted a entry from above and changed the names. Dunno why I didn't see that
(╯°□°)╯︵ ┻━┻


Example:
(begin example)
Expand All @@ -25,12 +26,12 @@ Author:
#include "script_component.hpp"
SCRIPT(uniqueUnitItems);

params [["_unit", objNull, [objNull]], ["_weaponItems", true, [true]], ["_backpack", true, [true]], ["_vest", true, [true]], ["_uniform", true, [true]]];
params [["_unit", objNull, [objNull]], ["_weaponItems", false, [true]], ["_backpack", true, [true]], ["_vest", true, [true]], ["_uniform", true, [true]], ["_assignedItems", true, [true]]];

private _allItems = (assignedItems _unit);
if (_uniform) then {_allItems append ((getItemCargo (uniformContainer _unit)) select 0);};
if (_vest) then {_allItems append ((getItemCargo (vestContainer _unit)) select 0);};
if (_backpack) then {_allItems append ((getItemCargo (backpackContainer _unit)) select 0);};
private _allItems = if (_assignedItems) then {assignedItems _unit} else {[]};
if (_uniform) then {_allItems append ((getItemCargo (uniformContainer _unit)) select 0)};
if (_vest) then {_allItems append ((getItemCargo (vestContainer _unit)) select 0)};
if (_backpack) then {_allItems append ((getItemCargo (backpackContainer _unit)) select 0)};

if (_weaponItems) then {
_allItems append (primaryWeaponItems _unit);
Expand Down