Fix IV Bags work on limbs with a tourniquet applied

This commit is contained in:
ulteq 2016-12-14 12:36:51 +01:00
parent 6b611ffbbd
commit 5d3f97ace7
4 changed files with 23 additions and 15 deletions

View File

@ -19,20 +19,24 @@ params ["_unit", "_deltaT", "_syncValues"];
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
private _bloodVolumeChange = -_deltaT * (_unit call FUNC(getBloodLoss));
private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
if (!isNil {_unit getVariable QGVAR(ivBags)}) then {
private _bloodBags = _unit getVariable [QGVAR(ivBags), []];
_bloodBags = _bloodBags apply {
_x params ["_bagVolumeRemaining"];
_x params ["_bagVolumeRemaining", "_type", "_bodyPart"];
if (_tourniquets select _bodyPart == 0) then {
private _bagChange = (_deltaT * GVAR(ivFlowRate) * IV_CHANGE_PER_SECOND) min _bagVolumeRemaining; // absolute value of the change in miliLiters
_bagVolumeRemaining = _bagVolumeRemaining - _bagChange;
_bloodVolumeChange = _bloodVolumeChange + (_bagChange / 1000);
};
if (_bagVolumeRemaining < 0.01) then {
[]
} else {
[_bagVolumeRemaining]
[_bagVolumeRemaining, _type, _bodyPart]
};
};

View File

@ -1,6 +1,6 @@
/*
* Author: Glowbal
* IV Treatment callback
* Bandage treatment callback
*
* Arguments:
* 0: The medic <OBJECT>

View File

@ -5,8 +5,9 @@
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
* 2: Body part <STRING>
* 3: Treatment class name <STRING>
* 4: Item <STRING>
*
* Return Value:
* Succesful treatment started <BOOL>
@ -16,13 +17,13 @@
#include "script_component.hpp"
params ["_caller", "_target", "_selectionName", "_className", "_items"];
params ["_caller", "_target", "_bodyPart", "_className", "_items"];
if (_items isEqualTo []) exitWith {false};
_items params ["_removeItem"];
[QGVAR(treatmentIVLocal), [_target, _className], _target] call CBA_fnc_targetEvent;
[QGVAR(treatmentIVLocal), [_target, _className, _bodyPart], _target] call CBA_fnc_targetEvent;
[_target, _removeItem] call FUNC(addToTriageCard);
[_target, "activity", ELSTRING(medical,Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);

View File

@ -3,9 +3,9 @@
* IV Treatment local callback
*
* Arguments:
* 0: The medic <OBJECT>
* 1: Treatment classname <STRING>
*
* 0: The patient <OBJECT>
* 1: Treatment class name <STRING>
* 2: Body part <STRING>
*
* Return Value:
* None
@ -15,7 +15,10 @@
#include "script_component.hpp"
params ["_target", "_treatmentClassname"];
params ["_target", "_treatmentClassname", "_bodyPart"];
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
if (_partIndex < 0) exitWith { false };
private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME];
@ -41,6 +44,6 @@ if (isClass (_config >> _treatmentClassname)) then {
};
private _bloodBags = _target getVariable [QEGVAR(medical,ivBags), []];
_bloodBags pushBack [_volumeAdded]; // Future BagType: [_volumeAdded, _type]
_bloodBags pushBack [_volumeAdded, _type, _partIndex];
_target setVariable [QEGVAR(medical,ivBags), _bloodBags, true];