mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
1e3d9cc22a
* 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>
54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: AmsteadRayle
|
|
* Counts how many of the given items are present between the medic and patient.
|
|
* If medic or patient are in a vehicle then vehicle's inventory will also be checked.
|
|
*
|
|
* Arguments:
|
|
* 0: Items <ARRAY>
|
|
*
|
|
* Return Value:
|
|
* Counts (can be nil) <ARRAY>
|
|
*
|
|
* Example:
|
|
* [items] call ace_medical_gui_fnc_countTreatmentItems
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_items"];
|
|
|
|
private _medicCount = 0;
|
|
private _patientCount = nil;
|
|
private _vehicleCount = nil;
|
|
|
|
// Medic
|
|
{
|
|
_medicCount = _medicCount + ([ACE_player, _x] call EFUNC(common,getCountOfItem));
|
|
} forEach _items;
|
|
|
|
// Patient
|
|
if (ACE_player != GVAR(target)) then {
|
|
_patientCount = 0;
|
|
{
|
|
_patientCount = _patientCount + ([GVAR(target), _x] call EFUNC(common,getCountOfItem));
|
|
} forEach _items;
|
|
};
|
|
|
|
// Vehicle
|
|
private _medicVehicle = objectParent ACE_player;
|
|
private _patientVehicle = objectParent GVAR(target);
|
|
private _vehicle = if (!isNull _medicVehicle) then {_medicVehicle} else {_patientVehicle};
|
|
|
|
if (!isNull _vehicle) then {
|
|
_vehicleCount = 0;
|
|
(getItemCargo _vehicle) params ["_itemTypes", "_itemCounts"];
|
|
{
|
|
private _item = _x;
|
|
private _index = _itemTypes find _item;
|
|
_vehicleCount = _vehicleCount + (_itemCounts param [_index, 0]);
|
|
} forEach _items;
|
|
};
|
|
|
|
[_medicCount, _patientCount, _vehicleCount]
|