2019-03-30 20:44:58 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
2023-06-24 05:11:56 +00:00
|
|
|
* Author: kymckay
|
2019-03-30 20:44:58 +00:00
|
|
|
* Prevents bandage actions from showing if selected body part isn't bleeding.
|
|
|
|
* Toggles between showing all or only basic bandage action for advanced setting.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2019-06-03 15:31:46 +00:00
|
|
|
* 0: Medic <OBJECT>
|
|
|
|
* 1: Patient <OBJECT>
|
|
|
|
* 2: Body Part <STRING>
|
|
|
|
* 3: Treatment <STRING>
|
2019-03-30 20:44:58 +00:00
|
|
|
*
|
2019-06-03 15:31:46 +00:00
|
|
|
* Return Value:
|
2019-03-30 20:44:58 +00:00
|
|
|
* Can Bandage <BOOL>
|
|
|
|
*
|
2019-04-03 11:36:37 +00:00
|
|
|
* Example:
|
|
|
|
* [player, cursorTarget, "Head", "FieldDressing"] call ace_medical_treatment_fnc_canBandage
|
|
|
|
*
|
2019-03-30 20:44:58 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
params ["_medic", "_patient", "_bodyPart", "_bandage"];
|
2023-06-24 05:11:56 +00:00
|
|
|
_bodyPart = toLower _bodyPart;
|
2019-03-30 20:44:58 +00:00
|
|
|
|
2023-05-16 05:47:00 +00:00
|
|
|
// If patient is swimming, don't allow bandage actions.
|
|
|
|
if (_patient call EFUNC(common,isSwimming)) exitWith {false};
|
|
|
|
|
2019-03-30 20:44:58 +00:00
|
|
|
// Bandage type and bandage setting XNOR to show only active actions
|
2020-01-04 20:43:51 +00:00
|
|
|
if ((_bandage == "BasicBandage") isEqualTo (GVAR(advancedBandages) != 0)) exitWith {false};
|
2019-03-30 20:44:58 +00:00
|
|
|
|
|
|
|
private _canBandage = false;
|
|
|
|
|
|
|
|
{
|
2023-06-24 05:11:56 +00:00
|
|
|
_x params ["", "_amountOf", "_bleeding"];
|
2019-03-30 20:44:58 +00:00
|
|
|
|
|
|
|
// If any single wound on the bodypart is bleeding bandaging can go ahead
|
2023-06-24 05:11:56 +00:00
|
|
|
if (_amountOf * _bleeding > 0) exitWith {
|
2019-03-30 20:44:58 +00:00
|
|
|
_canBandage = true;
|
|
|
|
};
|
2023-06-24 05:11:56 +00:00
|
|
|
} forEach ((GET_OPEN_WOUNDS(_patient)) getOrDefault [_bodyPart, []]);
|
2019-03-30 20:44:58 +00:00
|
|
|
|
|
|
|
_canBandage
|