mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added tourniquet treatment functions
This commit is contained in:
parent
308e165cb6
commit
909a87fdd3
@ -24,6 +24,7 @@ PREP(setUnconscious);
|
||||
PREP(getUnconsciousCondition);
|
||||
PREP(addUnconsciousCondition);
|
||||
PREP(setDead);
|
||||
PREP(parseConfigForInjuries);
|
||||
PREP(playInjuredSound);
|
||||
PREP(treatment);
|
||||
PREP(canTreat);
|
||||
@ -33,7 +34,8 @@ PREP(treatmentAdvanced_medication);
|
||||
PREP(treatmentAdvanced_medicationLocal);
|
||||
PREP(teatmentIV);
|
||||
PREP(treatmentIVLocal);
|
||||
PREP(parseConfigForInjuries);
|
||||
PREP(treatmentTourniquet);
|
||||
PREP(treatmentTourniquetLocal);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
call FUNC(parseConfigForInjuries);
|
||||
|
46
addons/medical/functions/fnc_treatmentTourniquet.sqf
Normal file
46
addons/medical/functions/fnc_treatmentTourniquet.sqf
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Apply a tourniquet to the patient
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
* 2: SelectionName <STRING>
|
||||
* 3: Treatment classname <STRING>
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller","_target","_part","_selectionName","_removeItem", "_tourniquets", "_items"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
|
||||
_part = [_selectionName] call FUNC(selectionNameToNumber);
|
||||
if (_part == 0 || _part == 1) exitwith {
|
||||
// [_caller,"You cannot apply a CAT on this body part!"] call EFUNC(common,sendHintTo);
|
||||
false;
|
||||
};
|
||||
|
||||
_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
||||
if ((_tourniquets select _part) > 0) exitwith {
|
||||
// [_caller,"There is already a tourniquet on this body part!"] call EFUNC(common,sendHintTo); // display message
|
||||
false;
|
||||
};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _removeItem], QUOTE(FUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
|
||||
true;
|
54
addons/medical/functions/fnc_treatmentTourniquetLocal.sqf
Normal file
54
addons/medical/functions/fnc_treatmentTourniquetLocal.sqf
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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;
|
Loading…
Reference in New Issue
Block a user