ACE3/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf

55 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-02-21 20:26:39 +00:00
/*
* Author: Glowbal
* Apply a tourniquet to the patient, local callback.
*
* Arguments:
* 0: The patient <OBJECT>
* 1: Item used classname <STRING>
*
* Return Value:
* nil
*
* Public: No
*/
#include "script_component.hpp"
private ["_target", "_tourniquetItem", "_part", "_tourniquets", "_applyingTo"];
_target = _this select 0;
_tourniquetItem = _this select 1;
//[_target,"treatment",format["%1 applied a tourniquet on %2",[_caller] call EFUNC(common,getName),_selectionName]] call FUNC(addActivityToLog);
//[_target,_removeItem] call FUNC(addToTriageList);
[_target] call FUNC(addToInjuredCollection);
_part = [_selectionName] call FUNC(selectionNameToNumber);
// Place a tourniquet on the bodypart
_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
_applyingTo = (_tourniquets select _part) + 1 + round(random(100));
_tourniquets set[_part, _applyingTo];
_target setvariable [QGVAR(tourniquets), _tourniquets, true];
[{
private ["_args","_target","_applyingTo","_part", "_tourniquets"];
_args = _this select 0;
_target = _args select 0;
_applyingTo = _args select 1;
_part = _args select 2;
_time = _args select 3;
if (!alive _target) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};
_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
if !((_tourniquets select _part) == _applyingTo) exitwith {
// Tourniquet has been removed
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};
if (time - _time > 120) then {
_target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005];
};
}, 5, [_target, _applyingTo, _part, time] ] call CBA_fnc_addPerFrameHandler;
true;