mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'medical-rewrite-blood' into medical-rewrite
This commit is contained in:
commit
be71e6fa7b
@ -30,4 +30,4 @@ private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
||||
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
|
||||
} forEach (_unit getVariable [QGVAR(internalWounds), []]);
|
||||
|
||||
_totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0);
|
||||
_totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0) * DEFAULT_BLOOD_VOLUME / 100;
|
||||
|
@ -14,16 +14,9 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
/*
|
||||
IV Change per second calculation:
|
||||
250ml should take 60 seconds to fill. 250/60 = 4.166.
|
||||
Basic medical is 10x (will take 6 seconds for 250ml)
|
||||
*/
|
||||
#define IV_CHANGE_PER_SECOND ([41.66, 4.166] select (GVAR(level) >= 2))
|
||||
|
||||
params ["_unit", "_syncValues"];
|
||||
|
||||
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100];
|
||||
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
|
||||
private _bloodVolumeChange = -([_unit] call FUNC(getBloodLoss));
|
||||
|
||||
if (!isNil {_unit getVariable QGVAR(ivBags)}) then {
|
||||
@ -33,7 +26,7 @@ if (!isNil {_unit getVariable QGVAR(ivBags)}) then {
|
||||
_x params ["_bagVolumeRemaining"];
|
||||
private _bagChange = IV_CHANGE_PER_SECOND min _bagVolumeRemaining; // absolute value of the change in miliLiters
|
||||
_bagVolumeRemaining = _bagVolumeRemaining - _bagChange;
|
||||
_bloodVolumeChange = _bloodVolumeChange + (_bagChange / 70); // ((bag change in ml) / (body total:7000ml)) out of 100 percent
|
||||
_bloodVolumeChange = _bloodVolumeChange + _bagChange;
|
||||
if (_bagVolumeRemaining < 0.01) then {
|
||||
[]
|
||||
} else {
|
||||
|
@ -24,4 +24,4 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
((_unit getVariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getVariable [QGVAR(heartRate), 80])/80-1);
|
||||
((_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) / MODIFIER_CARDIAC_OUTPUT) + ((_unit getVariable [QGVAR(heartRate), 80]) / 80 - 1);
|
||||
|
@ -49,7 +49,7 @@ if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then {
|
||||
_adjustment = _adjustment - [ObjNull];
|
||||
_unit setVariable [QGVAR(heartRateAdjustments), _adjustment];
|
||||
|
||||
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100];
|
||||
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
|
||||
if (_bloodVolume > 75) then {
|
||||
if (_bloodLoss > 0.0) then {
|
||||
if (_bloodLoss < 0.5) then {
|
||||
|
@ -13,7 +13,7 @@ if (!local _unit) exitWith {
|
||||
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
};
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
};
|
||||
|
||||
systemChat format["handling state default for unit: %1", _this];
|
||||
|
@ -13,7 +13,7 @@ if (!local _unit) exitWith {
|
||||
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
};
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
};
|
||||
|
||||
[_unit, CBA_missionTime - _lastTime] call FUNC(handleUnitVitals);
|
||||
|
@ -12,7 +12,7 @@ if (!local _unit) exitWith {
|
||||
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
};
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
};
|
||||
|
||||
private _startTime = _unit getVariable [QGVAR(reviveStartTime), 0];
|
||||
|
@ -13,7 +13,7 @@ if (!local _unit) exitWith {
|
||||
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
};
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
};
|
||||
|
||||
[_unit, CBA_missionTime - _lastTime] call FUNC(handleUnitVitals);
|
||||
|
@ -10,7 +10,6 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_interval"];
|
||||
@ -23,27 +22,24 @@ if (_syncValues) then {
|
||||
_unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime];
|
||||
};
|
||||
|
||||
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), 100]) + ([_unit, _syncValues] call FUNC(getBloodVolumeChange));
|
||||
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) + ([_unit, _syncValues] call FUNC(getBloodVolumeChange));
|
||||
_bloodVolume = _bloodVolume max 0;
|
||||
|
||||
_unit setVariable [QGVAR(bloodVolume), _bloodVolume, _syncValues];
|
||||
|
||||
TRACE_3("ACE_DEBUG",_bloodVolume,_syncValues,_unit);
|
||||
// Set variables for synchronizing information across the net
|
||||
if (_bloodVolume < 100) then {
|
||||
if (_bloodVolume < 90) then {
|
||||
TRACE_4("ACE_DEBUG",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit);
|
||||
if (_bloodVolume < BLOOD_VOLUME_HAS_LOST_SOME) then {
|
||||
if (_bloodVolume < BLOOD_VOLUME_HAS_LOST_MUCH) then {
|
||||
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 2) then {
|
||||
_unit setVariable [QGVAR(hasLostBlood), 2, true];
|
||||
};
|
||||
} else {
|
||||
TRACE_4("ACE_DEBUG", _bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit);
|
||||
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 1) then {
|
||||
_unit setVariable [QGVAR(hasLostBlood), 1, true];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
TRACE_4("ACE_DEBUG",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit);
|
||||
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 0) then {
|
||||
_unit setVariable [QGVAR(hasLostBlood), 0, true];
|
||||
};
|
||||
@ -76,12 +72,12 @@ if (_painStatus > (_unit getVariable [QGVAR(painSuppress), 0])) then {
|
||||
};
|
||||
};
|
||||
|
||||
if (_bloodVolume < 30) exitWith {
|
||||
if (_bloodVolume < BLOOD_VOLUME_DEAD) exitWith {
|
||||
[_unit] call FUNC(setDead);
|
||||
};
|
||||
|
||||
if ([_unit] call EFUNC(common,isAwake)) then {
|
||||
if (_bloodVolume < 60) then {
|
||||
if (_bloodVolume < BLOOD_VOLUME_UNCONSCIOUS) then {
|
||||
if (random(1) > 0.9) then {
|
||||
[_unit, true, 15 + random(20)] call FUNC(setUnconscious);
|
||||
};
|
||||
@ -129,7 +125,7 @@ if (GVAR(level) >= 2) then {
|
||||
_bloodPressure params ["_bloodPressureL", "_bloodPressureH"];
|
||||
|
||||
if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then {
|
||||
if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then {
|
||||
if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < BLOOD_VOLUME_CARDIAC_ARREST) then {
|
||||
[_unit, true, 10+ random(20)] call FUNC(setUnconscious); // safety check to ensure unconsciousness for units if they are not dead already.
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ if (damage _unit > 0) then {
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(pain), 0, true];
|
||||
_unit setVariable [QGVAR(bloodVolume), 100, true];
|
||||
_unit setVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME, true];
|
||||
_unit setVariable ["ACE_isUnconscious", false, true]; // TODO this is done based on state
|
||||
|
||||
// tourniquets
|
||||
|
@ -14,3 +14,19 @@
|
||||
#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default})
|
||||
#define GET_STRING(config,default) (if (isText (config)) then {getText (config)} else {default})
|
||||
#define GET_ARRAY(config,default) (if (isArray (config)) then {getArray (config)} else {default})
|
||||
|
||||
// --- blood
|
||||
// 0.077 l/kg * 80kg = 6.16l
|
||||
#define DEFAULT_BLOOD_VOLUME 6.0 // in liters
|
||||
|
||||
#define BLOOD_VOLUME_HAS_LOST_SOME 5.900 // lost 100ml
|
||||
#define BLOOD_VOLUME_HAS_LOST_MUCH 5.500 // lost 500ml
|
||||
|
||||
#define BLOOD_VOLUME_UNCONSCIOUS 3.6 // in liters
|
||||
#define BLOOD_VOLUME_DEAD 1.8 // in liters
|
||||
#define BLOOD_VOLUME_CARDIAC_ARREST 1.2 // in liters
|
||||
|
||||
// IV Change per second calculation:
|
||||
// 250ml should take 60 seconds to fill. 250/60 = 4.166.
|
||||
// Basic medical is 10x (will take 6 seconds for 250ml)
|
||||
#define IV_CHANGE_PER_SECOND ([41.66, 4.166] select (GVAR(level) >= 2))
|
||||
|
@ -23,5 +23,5 @@ private _bloodAdded = switch (true) do {
|
||||
default {BLOODBAGHEAL};
|
||||
};
|
||||
|
||||
private _blood = ((_target getVariable [QEGVAR(medical,bloodVolume), 100]) + _bloodAdded) min 100;
|
||||
private _blood = ((_target getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]) + _bloodAdded) min DEFAULT_BLOOD_VOLUME;
|
||||
_target setVariable [QEGVAR(medical,bloodVolume), _blood, true];
|
||||
|
@ -18,7 +18,7 @@ params ["_caller", "_target"];
|
||||
if (alive _target) exitWith {
|
||||
_target setVariable [QEGVAR(medical,pain), 0, true];
|
||||
_target setVariable [QEGVAR(medical,morphine), 0, true];
|
||||
_target setVariable [QEGVAR(medical,bloodVolume), 100, true];
|
||||
_target setVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME, true];
|
||||
|
||||
// tourniquets
|
||||
_target setVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0], true];
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
params ["_target", "_treatmentClassname"];
|
||||
|
||||
private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), 100];
|
||||
private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME];
|
||||
|
||||
if (_bloodVolume >= 100) exitWith {};
|
||||
if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith {};
|
||||
|
||||
// Find the proper attributes for the used IV
|
||||
private _config = (configFile >> "ace_medical_treatment" >> "IV");
|
||||
|
Loading…
Reference in New Issue
Block a user