ACE3/addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf
SilentSpike 9e5c4a7ed9
Move medical settings into their respective components (#6493)
* Transfer medical AI to CBA setting
* Neuter the old settings module

I've left the entry in CfgVehicles so that it doesn't cause errors on
older missions, but it's just a dumb logic now and does nothing.

* Remove medic setting
* Move increaseTraining setting
* Move fnc_adjustPainlevel to medical_status
* Move pain and bleed coefficients to medical_status
* Move advanced bandages to medical_treatment
* Move advanced medication to medical_treatment
* Move advanced diagnose to medical_treatment
* Move wound reopening and screams settings
* Move damage threshold settings
* Move showPain setting
* Move statemachine settings
* Move pain visualisation setting
* Move all treatment usage settings
* Move self IV setting
* Move remaining settings
* Sort treatment setting string categories
2018-08-06 17:08:43 +01:00

47 lines
1.4 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal
* Handles the bandage of a patient.
*
* Arguments:
* 0: The patient <OBJECT>
* 1: Treatment class name <STRING>
* 2: Body part <STRING>
*
* Return Value:
* Succesful treatment started <BOOL>
*
* Public: No
*/
params ["_target", "_bandage", "_bodyPart"];
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
if (_partIndex < 0) exitWith { false };
private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
if (_openWounds isEqualTo []) exitWith { false };
// Figure out which injury for this bodypart is the best choice to bandage
// TODO also use up the remainder on left over injuries
private _targetWound = [_target, _bandage, _partIndex] call FUNC(findMostEffectiveWound);
_targetWound params ["_wound", "_woundIndex", "_effectiveness"];
// Everything is patched up on this body part already
if (_effectiveness == -1) exitWith {};
// Find the impact this bandage has and reduce the amount this injury is present
private _amountOf = _wound select 3;
private _impact = _effectiveness min _amountOf;
_wound set [3, _amountOf - _impact];
_openWounds set [_woundIndex, _wound];
_target setVariable [QEGVAR(medical,openWounds), _openWounds, true];
// Handle the reopening of bandaged wounds
if (_impact > 0 && {GVAR(advancedBandages) && {EGVAR(medical,woundReopening)}}) then {
[_target, _impact, _partIndex, _woundIndex, _wound, _bandage] call FUNC(handleBandageOpening);
};
true