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:
|
2015-08-22 17:47:23 +00:00
|
|
|
* None
|
2015-02-21 20:26:39 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-03 13:49:49 +00:00
|
|
|
private ["_tourniquets", "_part", "_applyingTo"];
|
|
|
|
params ["_target", "_tourniquetItem", "_selectionName"];
|
2015-02-21 20:26:39 +00:00
|
|
|
|
|
|
|
[_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];
|
|
|
|
|
|
|
|
[{
|
2015-08-22 17:47:23 +00:00
|
|
|
params ["_args", "_idPFH"];
|
|
|
|
_args params ["_target", "_applyingTo", "_part", "_time"];
|
|
|
|
|
2015-02-21 20:26:39 +00:00
|
|
|
if (!alive _target) exitwith {
|
2015-08-22 17:47:23 +00:00
|
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
2015-02-21 20:26:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
|
|
|
if !((_tourniquets select _part) == _applyingTo) exitwith {
|
|
|
|
// Tourniquet has been removed
|
2015-08-22 17:47:23 +00:00
|
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
2015-02-21 20:26:39 +00:00
|
|
|
};
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_time - _time > 120) then {
|
2015-02-21 20:26:39 +00:00
|
|
|
_target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005];
|
|
|
|
};
|
2015-05-21 16:42:44 +00:00
|
|
|
}, 5, [_target, _applyingTo, _part, ACE_time] ] call CBA_fnc_addPerFrameHandler;
|
2015-02-21 20:26:39 +00:00
|
|
|
|
2015-08-22 17:47:23 +00:00
|
|
|
true
|