2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-02-23 19:35:36 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Action for removing the tourniquet on specified selection
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The medic <OBJECT>
|
|
|
|
* 1: The patient <OBJECT>
|
|
|
|
* 2: SelectionName <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-22 14:25:10 +00:00
|
|
|
* None
|
2015-02-23 19:35:36 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, kevin, "selection"] call ace_medical_fnc_actionRemoveTourniquet
|
|
|
|
*
|
2015-02-23 19:35:36 +00:00
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
params ["_caller", "_target", "_selectionName"];
|
2016-02-03 20:40:26 +00:00
|
|
|
TRACE_3("params",_caller,_target,_selectionName);
|
2015-02-23 19:35:36 +00:00
|
|
|
|
|
|
|
// grab the required data
|
2016-06-13 00:34:56 +00:00
|
|
|
private _part = [_selectionName] call FUNC(selectionNameToNumber);
|
|
|
|
private _tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
2015-02-23 19:35:36 +00:00
|
|
|
|
|
|
|
// Check if there is a tourniquet on this bodypart
|
2015-11-30 16:14:05 +00:00
|
|
|
if ((_tourniquets select _part) == 0) exitWith {
|
2016-06-13 00:34:56 +00:00
|
|
|
[QEGVAR(common,displayTextStructured), [LSTRING(noTourniquetOnBodyPart), 1.5, _caller], [_caller]] call CBA_fnc_targetEvent;
|
2015-02-23 19:35:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Removing the tourniquet
|
2016-06-13 00:34:56 +00:00
|
|
|
_tourniquets set [_part, 0];
|
2015-11-30 16:27:09 +00:00
|
|
|
_target setVariable [QGVAR(tourniquets), _tourniquets, true];
|
2015-02-23 19:35:36 +00:00
|
|
|
|
|
|
|
// Adding the tourniquet item to the caller
|
2015-03-21 21:22:28 +00:00
|
|
|
_caller addItem "ACE_tourniquet";
|
2016-02-03 20:40:26 +00:00
|
|
|
|
|
|
|
//Handle all injected medications now that blood is flowing:
|
|
|
|
private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []];
|
2016-02-04 16:00:33 +00:00
|
|
|
private _updatedArray = false;
|
2016-02-03 20:40:26 +00:00
|
|
|
TRACE_2("meds",_part,_delayedMedications);
|
|
|
|
{
|
|
|
|
_x params ["", "", "_medPartNum"];
|
|
|
|
if (_part == _medPartNum) then {
|
|
|
|
TRACE_1("delayed medication call after tourniquet removeal",_x);
|
2016-06-03 18:57:21 +00:00
|
|
|
[QGVAR(treatmentAdvanced_medicationLocal), _x, [_target]] call CBA_fnc_targetEvent;
|
2016-02-04 16:00:33 +00:00
|
|
|
_delayedMedications set [_forEachIndex, -1];
|
|
|
|
_updatedArray = true;
|
2016-02-03 20:40:26 +00:00
|
|
|
};
|
|
|
|
} forEach _delayedMedications;
|
2016-06-13 00:34:56 +00:00
|
|
|
|
2016-02-04 16:00:33 +00:00
|
|
|
if (_updatedArray) then {
|
|
|
|
_delayedMedications = _delayedMedications - [-1];
|
2016-02-03 20:40:26 +00:00
|
|
|
_target setVariable [QGVAR(occludedMedications), _delayedMedications, true];
|
|
|
|
};
|