ACE3/addons/medical_gui/functions/fnc_formatItemCounts.sqf
amsteadrayle 1e3d9cc22a
Medical GUI - Show number of available treatment items in medical menu (#9474)
* Initial implementation of item count display

* Put everything inside function, add padding

* Extract and explain null string

* Fix tab in config file

* Add function header

* Use ACE item counting function

* Extract column width to variable

* Move constants declaration closer to usage

* Add special case for sutures

* Add setting to enable/disable

* Expand to allow showing in tooltip

* Split into counting and formatting function

* Fix incorrect check for case with no items

* Remove ineffective padding from tooltip

* Check for surgical kit item instead of display name

* Update return description in header

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Add `private` keyword for inline functions

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* capitalization/vars

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

* nil checks, localize macro

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

* Remove button text mode and setting

* possessive

* Update addons/medical_gui/functions/fnc_formatItemCounts.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2023-10-12 22:39:23 -04:00

33 lines
902 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: AmsteadRayle
* Format item counts to be shown in the tooltip.
*
* Arguments:
* 0: Medic count <NUMBER>
* 1: Patient count <NUMBER>
* 2: Vehicle count <NUMBER>
*
* Return Value:
* Item count string <STRING>
*
* Example:
* [medicCount, patientCount, vehicleCount] call ace_medical_gui_fnc_formatItemCounts
*
* Public: No
*/
params ["_medicCount", "_patientCount", "_vehicleCount"];
private _countStrings = [format ["%1 %2", _medicCount, LLSTRING(TreatmentItemCount_Medic)]];
if ((EGVAR(medical_treatment,allowSharedEquipment) != 2) && {!isNil "_patientCount"}) then {
_countStrings pushBack format ["%1 %2", _patientCount, LLSTRING(TreatmentItemCount_Patient)];
};
if (!isNil "_vehicleCount") then {
_countStrings pushBack format ["%1 %2", _vehicleCount, LLSTRING(TreatmentItemCount_Vehicle)];
};
_countStrings joinString "\n"