Fix medical status function calls

This commit is contained in:
SilentSpike 2018-05-08 10:16:12 +01:00
parent 65f57361a4
commit 697aa5dc08
52 changed files with 77 additions and 205 deletions

View File

@ -41,14 +41,14 @@ if (!isNull _instigator) then {
#ifdef DEBUG_TESTRESULTS #ifdef DEBUG_TESTRESULTS
private _startDmg = +(_unit getVariable [QGVAR(bodyPartDamage), [-1]]); private _startDmg = +(_unit getVariable [QGVAR(bodyPartDamage), [-1]]);
private _startPain = _unit getVariable [QGVAR(pain), 0]; private _startPain = GET_PAIN_TOTAL(_unit);
#endif #endif
[QEGVAR(medical_engine,woundReceived), [_unit, _bodyPart, _damageToAdd, _instigator, _typeOfDamage]] call CBA_fnc_localEvent; [QEGVAR(medical_engine,woundReceived), [_unit, _bodyPart, _damageToAdd, _instigator, _typeOfDamage]] call CBA_fnc_localEvent;
#ifdef DEBUG_TESTRESULTS #ifdef DEBUG_TESTRESULTS
private _endDmg = _unit getVariable [QGVAR(bodyPartDamage), [-1]]; private _endDmg = _unit getVariable [QGVAR(bodyPartDamage), [-1]];
private _endPain = _unit getVariable [QGVAR(pain), 0]; private _endPain = GET_PAIN_TOTAL(_unit);
private _typeOfDamageAdj = _typeOfDamage call EFUNC(medical_damage,getTypeOfDamage); private _typeOfDamageAdj = _typeOfDamage call EFUNC(medical_damage,getTypeOfDamage);
private _config = configFile >> "ACE_Medical_Injuries" >> "damageTypes" >> _typeOfDamageAdj; private _config = configFile >> "ACE_Medical_Injuries" >> "damageTypes" >> _typeOfDamageAdj;
private _selectionSpecific = true; private _selectionSpecific = true;

View File

@ -24,8 +24,6 @@ TRACE_2("adjustPainLevel",_unit,_desiredPainLevel);
_desiredPainLevel = _desiredPainLevel * GVAR(painCoefficient); _desiredPainLevel = _desiredPainLevel * GVAR(painCoefficient);
private _pain = _unit getVariable [QGVAR(pain), 0]; private _pain = GET_PAIN_TOTAL(_unit);
_pain = 0 max (_pain max _desiredPainLevel) min 1; SET_PAIN_TOTAL(_unit,_pain max _desiredPainLevel,false);
_unit setVariable [QGVAR(pain), _pain];

View File

@ -33,7 +33,7 @@
_return pushBack ""; _return pushBack "";
// State: // State:
private _hasStableVitals = [_unit] call EFUNC(medical,hasStableVitals); private _hasStableVitals = [_unit] call EFUNC(medical_status,hasStableVitals);
private _targetState = [_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; private _targetState = [_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
if (!local _unit) then {_targetState = "NotLocal";}; if (!local _unit) then {_targetState = "NotLocal";};
private _color = switch (_targetState) do {case "Default": {"33FF33"}; case "Injured": {"FF3333"}; case "Unconscious": {"FF8833"}; case "CardiacArrest": {"FF33AA"}; default {"555555"}}; private _color = switch (_targetState) do {case "Default": {"33FF33"}; case "Injured": {"FF3333"}; case "Unconscious": {"FF8833"}; case "CardiacArrest": {"FF33AA"}; default {"555555"}};
@ -48,8 +48,8 @@
_return pushBack format [" - [Loss: %1] %2", _bloodLoss toFixed 5, _secondsToHeartstop]; _return pushBack format [" - [Loss: %1] %2", _bloodLoss toFixed 5, _secondsToHeartstop];
// Heart: // Heart:
private _cardiacOutput = [_unit] call EFUNC(medical,getCardiacOutput); private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput);
private _heartRate = _unit getVariable [QEGVAR(medical,heartRate), DEFAULT_HEART_RATE]; private _heartRate = GET_HEART_RATE(_unit);
GET_BLOOD_PRESSURE(_unit) params ["_bpLow", "_bpHigh"]; GET_BLOOD_PRESSURE(_unit) params ["_bpLow", "_bpHigh"];
_return pushBack format ["CardiacOutput %1", _cardiacOutput toFixed 5]; _return pushBack format ["CardiacOutput %1", _cardiacOutput toFixed 5];
_return pushBack format [" - [HR: %1] [BP: %2 / %3]", _heartRate toFixed 1, _bpLow toFixed 1, _bpHigh toFixed 1]; _return pushBack format [" - [HR: %1] [BP: %2 / %3]", _heartRate toFixed 1, _bpLow toFixed 1, _bpHigh toFixed 1];

View File

@ -62,7 +62,7 @@ if (_show == 1) then {
if (((_target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]) select _selectionN) > 0) then { if (((_target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]) select _selectionN) > 0) then {
_genericMessages pushback [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]]; _genericMessages pushback [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
}; };
if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical,isMedic)}) then { if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical_status,isMedic)}) then {
private _painLevel = GET_PAIN_PERCEIVED(_target); private _painLevel = GET_PAIN_PERCEIVED(_target);
if (_painLevel > 0) then { if (_painLevel > 0) then {
private _painText = localize ELSTRING(medical,Status_Pain); private _painText = localize ELSTRING(medical,Status_Pain);

View File

@ -20,6 +20,6 @@ params ["_unit"];
if (!local _unit) exitWith {}; if (!local _unit) exitWith {};
_unit setVariable [QGVAR(pain), 0, true]; SET_PAIN_TOTAL(_unit,0);
_unit setVariable [QGVAR(heartRate), 0, true]; SET_HEART_RATE(_unit,0);
_unit setVariable [QGVAR(bloodPressure), [0, 0], true]; _unit setVariable [QGVAR(bloodPressure), [0, 0], true];

View File

@ -50,10 +50,10 @@ if (!alive _unit) exitWith {
// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation // In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation
if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith { if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith {
TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call FUNC(isBeingCarried), [_unit] call FUNC(isBeingDragged), _idPFH, _unit getVariable QGVAR(unconsciousArguments),animationState _unit); TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call EFUNC(medical_status,isBeingCarried), [_unit] call EFUNC(medical_status,isBeingDragged), _idPFH, _unit getVariable QGVAR(unconsciousArguments),animationState _unit);
// TODO, handle this with carry instead, so we can remove the PFH here. // TODO, handle this with carry instead, so we can remove the PFH here.
// Wait until the unit isn't being carried anymore, so we won't end up with wierd animations // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations
if !(([_unit] call FUNC(isBeingCarried)) || ([_unit] call FUNC(isBeingDragged))) then { if !(([_unit] call EFUNC(medical_status,isBeingCarried)) || ([_unit] call EFUNC(medical_status,isBeingDragged))) then {
if ("ACE_FakePrimaryWeapon" in (weapons _unit)) then { if ("ACE_FakePrimaryWeapon" in (weapons _unit)) then {
TRACE_1("Removing fake weapon [on wakeup]",_unit); TRACE_1("Removing fake weapon [on wakeup]",_unit);
_unit removeWeapon "ACE_FakePrimaryWeapon"; _unit removeWeapon "ACE_FakePrimaryWeapon";

View File

@ -60,11 +60,16 @@
// - Status macro functions --------------------------------------------------- // - Status macro functions ---------------------------------------------------
// These macros provide the same functionality as the functions in the status // These macros provide the same functionality as the functions in the status
// component, but are slightly faster (because most are just object variables) // component, but are slightly faster (because most are just object variables)
#define GET_PAIN_TOTAL(unit) (unit getVariable [QEGVAR(medical_status,pain), 0])
#define GET_PAIN_PERCEIVED(unit) ([unit] call EFUNC(medical_status,getPainPerceived)) // Just for consistency
#define GET_HEART_RATE(unit) (unit getVariable [QEGVAR(medical_status,heartRate), DEFAULT_HEART_RATE])
#define GET_BLOOD_VOLUME(unit) (unit getVariable [QEGVAR(medical_status,bloodVolume), DEFAULT_BLOOD_VOLUME])
#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss)) // Just for consistency #define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss)) // Just for consistency
#define GET_BLOOD_PRESSURE(unit) ([unit] call EFUNC(medical_status,getBloodPressure)) // Just for consistency #define GET_BLOOD_PRESSURE(unit) ([unit] call EFUNC(medical_status,getBloodPressure)) // Just for consistency
#define IS_UNCONSCIOUS(unit) (unit getVariable [QEGVAR(medical_status,isUnconscious), false]) #define GET_BLOOD_VOLUME(unit) (unit getVariable [QEGVAR(medical_status,bloodVolume), DEFAULT_BLOOD_VOLUME])
#define GET_HEART_RATE(unit) (unit getVariable [QEGVAR(medical_status,heartRate), DEFAULT_HEART_RATE])
#define GET_PAIN_PERCEIVED(unit) ([unit] call EFUNC(medical_status,getPainPerceived)) // Just for consistency
#define GET_PAIN_TOTAL(unit) (unit getVariable [QEGVAR(medical_status,pain), 0])
#define IS_IN_PAIN(unit) (GET_PAIN_PERCEIVED(unit) > 0) #define IS_IN_PAIN(unit) (GET_PAIN_PERCEIVED(unit) > 0)
#define IS_UNCONSCIOUS(unit) (unit getVariable [QEGVAR(medical_status,isUnconscious), false])
// Setters have overloaded versions for locality handling
#define SET_HEART_RATE(unit,value) unit setVariable [QEGVAR(medical_status,heartRate), value, true]
#define SET_HEART_RATE(unit,value,sync) unit setVariable [QEGVAR(medical_status,heartRate), value, sync]
#define SET_PAIN_TOTAL(unit,value) unit setVariable [QEGVAR(medical_status,pain), 0 max (value) min 1, true]
#define SET_PAIN_TOTAL(unit,value,sync) unit setVariable [QEGVAR(medical_status,pain), 0 max (value) min 1, sync]

View File

@ -4,7 +4,7 @@
TRACE_1("settingsInitialized", GVAR(enabledFor)); TRACE_1("settingsInitialized", GVAR(enabledFor));
if (GVAR(enabledFor) == 0) exitWith {}; // 0: disabled if (GVAR(enabledFor) == 0) exitWith {}; // 0: disabled
if ((GVAR(enabledFor) == 1) && {!isServer} && {hasInterface}) exitWith {}; // 1: Don't Run on non-hc Clients if ((GVAR(enabledFor) == 1) && {!isServer} && {hasInterface}) exitWith {}; // 1: Don't Run on non-hc Clients
// Only run for AI that does not have to deal with advanced medical // Only run for AI that does not have to deal with advanced medical
if (EGVAR(medical,enableFor) == 1 || {hasInterface}) exitWith {}; if (EGVAR(medical,enableFor) == 1 || {hasInterface}) exitWith {};
@ -19,7 +19,7 @@
private _medic = objNull; private _medic = objNull;
{ {
if ((!isPlayer _x) && {[_x] call EFUNC(medical,isMedic)}) exitWith { if ((!isPlayer _x) && {[_x] call EFUNC(medical_status,isMedic)}) exitWith {
_medic = _x; _medic = _x;
}; };
} forEach (units _unit); } forEach (units _unit);

View File

@ -19,10 +19,10 @@
// we ignore this here. We need to "notice" the medic that he should // we ignore this here. We need to "notice" the medic that he should
// treat other units, or else he won't do anything on his own. // treat other units, or else he won't do anything on his own.
if ([_this] call EFUNC(medical,isMedic) || {vehicle _this != _this}) exitWith {false}; if ([_this] call EFUNC(medical_status,isMedic) || {vehicle _this != _this}) exitWith {false};
{ {
if ([_x] call EFUNC(medical,isMedic) && {!([_x] call EFUNC(common,isPlayer))}) exitWith { if ([_x] call EFUNC(medical_status,isMedic) && {!([_x] call EFUNC(common,isPlayer))}) exitWith {
_this setVariable [QGVAR(assignedMedic), _x]; _this setVariable [QGVAR(assignedMedic), _x];
true true
}; };

View File

@ -39,7 +39,7 @@ if (((_target getVariable [QEGVAR(medical,tourniquets), [0, 0, 0, 0, 0, 0]]) sel
_genericMessages pushBack [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]]; _genericMessages pushBack [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
}; };
if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical,isMedic)}) then { if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical_status,isMedic)}) then {
private _painLevel = GET_PAIN_PERCEIVED(_target); private _painLevel = GET_PAIN_PERCEIVED(_target);
if (_painLevel > 0) then { if (_painLevel > 0) then {
private _painText = localize ELSTRING(medical,Status_Pain); private _painText = localize ELSTRING(medical,Status_Pain);

View File

@ -51,7 +51,7 @@ class ACE_Medical_StateMachine {
}; };
class WakeUp { class WakeUp {
targetState = "Injured"; targetState = "Injured";
condition = QUOTE(_this call FUNC(hasStableVitals)); condition = QUOTE(_this call EFUNC(medical_status,hasStableVitals));
events[] = {QGVAR(WakeUp)}; events[] = {QGVAR(WakeUp)};
onTransition = QUOTE([ARR_2(_this,(false))] call FUNC(setUnconsciousStatemachine)); onTransition = QUOTE([ARR_2(_this,(false))] call FUNC(setUnconsciousStatemachine));
}; };

View File

@ -21,4 +21,4 @@ _time = _time + random [_time*-0.1, 0, _time*0.1];
_unit setVariable [QGVAR(cardiacArrestTime), _time]; _unit setVariable [QGVAR(cardiacArrestTime), _time];
_unit setVariable [QGVAR(cardiacArrestStart), CBA_missionTime]; _unit setVariable [QGVAR(cardiacArrestStart), CBA_missionTime];
[_unit] call FUNC(setCardiacArrest); [_unit] call EFUNC(medical_status,setCardiacArrest);

View File

@ -8,7 +8,7 @@ if (!alive _unit) exitWith {};
// If locality changed, broadcast the last medical state and finish the local loop // If locality changed, broadcast the last medical state and finish the local loop
if (!local _unit) exitWith { if (!local _unit) exitWith {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true]; SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true]; _unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true]; _unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
}; };

View File

@ -8,7 +8,7 @@ if (!alive _unit) exitWith {};
// If locality changed, broadcast the last medical state and finish the local loop // If locality changed, broadcast the last medical state and finish the local loop
if (!local _unit) exitWith { if (!local _unit) exitWith {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true]; SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true]; _unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true]; _unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
}; };

View File

@ -9,7 +9,7 @@ if (!alive _unit) exitWith {};
// If locality changed, broadcast the last medical state and finish the local loop // If locality changed, broadcast the last medical state and finish the local loop
if (!local _unit) exitWith { if (!local _unit) exitWith {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true]; SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true]; _unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true]; _unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
}; };
@ -23,7 +23,7 @@ if (_painLevel > 0) then {
// Handle spontaneous wakeup from unconsciousness // Handle spontaneous wakeup from unconsciousness
if (GVAR(spontaneousWakeUpChance) > 0) then { if (GVAR(spontaneousWakeUpChance) > 0) then {
if (_unit call FUNC(hasStableVitals)) then { if (_unit call EFUNC(medical_status,hasStableVitals)) then {
private _lastWakeUpCheck = _unit getVariable [QGVAR(lastWakeUpCheck), CBA_missionTime]; private _lastWakeUpCheck = _unit getVariable [QGVAR(lastWakeUpCheck), CBA_missionTime];
if (CBA_missionTime - _lastWakeUpCheck > SPONTANEOUS_WAKE_UP_INTERVAL) then { if (CBA_missionTime - _lastWakeUpCheck > SPONTANEOUS_WAKE_UP_INTERVAL) then {
TRACE_2("Checking for wake up",_unit,GVAR(spontaneousWakeUpChance)); TRACE_2("Checking for wake up",_unit,GVAR(spontaneousWakeUpChance));

View File

@ -16,5 +16,5 @@ params ["_unit"];
_unit setVariable [QGVAR(inCardiacArrest), false, true]; _unit setVariable [QGVAR(inCardiacArrest), false, true];
_unit setVariable [QGVAR(cardiacArrestStart), nil]; _unit setVariable [QGVAR(cardiacArrestStart), nil];
_unit setVariable [QGVAR(heartRate), 40, true]; SET_HEART_RATE(_unit,40);
_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime]; _unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime];

View File

@ -3,9 +3,7 @@ PREP(getBloodLoss);
PREP(getBloodPressure); PREP(getBloodPressure);
PREP(getBloodVolumeChange); PREP(getBloodVolumeChange);
PREP(getCardiacOutput); PREP(getCardiacOutput);
PREP(getHeartRate);
PREP(getPainPerceived); PREP(getPainPerceived);
PREP(getPainTotal);
PREP(hasStableVitals); PREP(hasStableVitals);
PREP(hasTourniquetAppliedTo); PREP(hasTourniquetAppliedTo);
PREP(initUnit); PREP(initUnit);
@ -16,9 +14,6 @@ PREP(isInMedicalVehicle);
PREP(isInStableCondition); PREP(isInStableCondition);
PREP(isMedic); PREP(isMedic);
PREP(isMedicalVehicle); PREP(isMedicalVehicle);
PREP(isUnconscious);
PREP(setCardiacArrest); PREP(setCardiacArrest);
PREP(setDead); PREP(setDead);
PREP(setHeartRate);
PREP(setPainTotal);
PREP(setUnconscious); PREP(setUnconscious);

View File

@ -11,7 +11,7 @@
* Blood volume change (liters per second) <NUMBER> * Blood volume change (liters per second) <NUMBER>
* *
* Example: * Example:
* [player, 1, true] call ACE_medical_fnc_getBloodVolumeChange * [player, 1, true] call ACE_medical_status_fnc_getBloodVolumeChange
* *
* Public: No * Public: No
*/ */

View File

@ -9,7 +9,7 @@
* Current cardiac output (liter per second) <NUMBER> * Current cardiac output (liter per second) <NUMBER>
* *
* Example: * Example:
* [player] call ace_medical_fnc_getCardiacOutput * [player] call ace_medical_status_fnc_getCardiacOutput
* *
* Public: No * Public: No
*/ */
@ -26,8 +26,8 @@
params ["_unit"]; params ["_unit"];
private _bloodVolume = ((_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) / DEFAULT_BLOOD_VOLUME) * 100; private _bloodVolume = (GET_BLOOD_VOLUME(_unit) / DEFAULT_BLOOD_VOLUME) * 100;
private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; private _heartRate = GET_HEART_RATE(_unit);
private _cardiacOutput = ((_bloodVolume / MODIFIER_CARDIAC_OUTPUT) + ((_heartRate / DEFAULT_HEART_RATE) - 1)) / 60; private _cardiacOutput = ((_bloodVolume / MODIFIER_CARDIAC_OUTPUT) + ((_heartRate / DEFAULT_HEART_RATE) - 1)) / 60;
(0 max _cardiacOutput) (0 max _cardiacOutput)

View File

@ -1,14 +0,0 @@
/*
* Author: BaerMitUmlaut
* Get the heart rate of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* Heart Rate <NUMBER>
*/
#include "script_component.hpp"
params ["_unit"];
_unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]

View File

@ -14,7 +14,7 @@
params ["_unit"]; params ["_unit"];
private _pain = _unit getVariable [QGVAR(pain), 0]; private _pain = GET_PAIN_TOTAL(_unit);
private _painSuppress = _unit getVariable [QGVAR(painSuppress), 0]; private _painSuppress = _unit getVariable [QGVAR(painSuppress), 0];
(0 max (_pain - _painSuppress) min 1) (0 max (_pain - _painSuppress) min 1)

View File

@ -1,14 +0,0 @@
/*
* Author: BaerMitUmlaut
* Get the total pain level of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* Pain level (0 .. 1) <NUMBER>
*/
#include "script_component.hpp"
params ["_unit"];
_unit getVariable [QGVAR(pain), 0]

View File

@ -9,7 +9,7 @@
* Has stable vitals <BOOL> * Has stable vitals <BOOL>
* *
* Example: * Example:
* [player] call ace_medical_fnc_hasStableVitals * [player] call ace_medical_status_fnc_hasStableVitals
* *
* Public: No * Public: No
*/ */
@ -28,7 +28,7 @@ private _bloodPressure = GET_BLOOD_PRESSURE(_unit);
_bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; _bloodPressure params ["_bloodPressureL", "_bloodPressureH"];
if (_bloodPressureL < 50 || {_bloodPressureH < 60}) exitWith { false }; if (_bloodPressureL < 50 || {_bloodPressureH < 60}) exitWith { false };
private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; private _heartRate = GET_HEART_RATE(_unit);
if (_heartRate < 40) exitWith { false }; if (_heartRate < 40) exitWith { false };
true true

View File

@ -10,7 +10,7 @@
* Has tourniquet applied <BOOL> * Has tourniquet applied <BOOL>
* *
* Example: * Example:
* [player, "leftleg"] call ace_medical_fnc_hasTourniquetAppliedTo * [player, "leftleg"] call ace_medical_status_fnc_hasTourniquetAppliedTo
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -23,7 +23,7 @@ if (damage _unit > 0) then {
// - Blood and heart ---------------------------------------------------------- // - Blood and heart ----------------------------------------------------------
_unit setVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME, true]; _unit setVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME, true];
_unit setVariable [QGVAR(heartRate), DEFAULT_HEART_RATE, true]; SET_HEART_RATE(_unit,DEFAULT_HEART_RATE);
_unit setVariable [QGVAR(heartRateAdjustments), [], true]; _unit setVariable [QGVAR(heartRateAdjustments), [], true];
_unit setVariable [QGVAR(bloodPressure), [80, 120], true]; _unit setVariable [QGVAR(bloodPressure), [80, 120], true];
_unit setVariable [QGVAR(peripheralResistance), 100, true]; _unit setVariable [QGVAR(peripheralResistance), 100, true];
@ -33,7 +33,7 @@ _unit setVariable [QGVAR(hasLostBlood), 0, true];
_unit setVariable [QGVAR(isBleeding), false, true]; _unit setVariable [QGVAR(isBleeding), false, true];
// - Pain --------------------------------------------------------------------- // - Pain ---------------------------------------------------------------------
_unit setVariable [QGVAR(pain), 0, true]; SET_PAIN_TOTAL(_unit,0);
_unit setVariable [QGVAR(hasPain), false, true]; _unit setVariable [QGVAR(hasPain), false, true];
_unit setVariable [QGVAR(painSuppress), 0, true]; _unit setVariable [QGVAR(painSuppress), 0, true];
_unit setVariable [QGVAR(painSuppressAdjustments), [], true]; _unit setVariable [QGVAR(painSuppressAdjustments), [], true];

View File

@ -9,7 +9,7 @@
* Is being carried <BOOL> * Is being carried <BOOL>
* *
* Example: * Example:
* [bob] call ace_medical_fnc_isBeingCarried * [bob] call ace_medical_status_fnc_isBeingCarried
* *
* Public: No * Public: No
*/ */

View File

@ -9,7 +9,7 @@
* Is being dragged <BOOL> * Is being dragged <BOOL>
* *
* Example: * Example:
* [bob] call ace_medical_fnc_isBeingDragged * [bob] call ace_medical_status_fnc_isBeingDragged
* *
* Public: No * Public: No
*/ */

View File

@ -9,7 +9,7 @@
* Is in medical facility <BOOL> * Is in medical facility <BOOL>
* *
* Example: * Example:
* [player] call ace_medical_fnc_isInMedicalFacility * [player] call ace_medical_status_fnc_isInMedicalFacility
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -9,7 +9,7 @@
* Is unit in medical vehicle? <BOOL> * Is unit in medical vehicle? <BOOL>
* *
* Example: * Example:
* [player] call ace_medical_fnc_isInMedicalVehicle * [player] call ace_medical_status_fnc_isInMedicalVehicle
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -10,7 +10,7 @@
* Is in of medic class <BOOL> * Is in of medic class <BOOL>
* *
* Example: * Example:
* [player] call ace_medical_fnc_isMedic * [player] call ace_medical_status_fnc_isMedic
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -9,7 +9,7 @@
* Is in of medic class <BOOL> * Is in of medic class <BOOL>
* *
* Example: * Example:
* [cursorObject] call ace_medical_fnc_isMedicalVehicle * [cursorObject] call ace_medical_status_fnc_isMedicalVehicle
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -1,14 +0,0 @@
/*
* Author: BaerMitUmlaut
* Check if the unit is unconscious.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* Is unconscious <BOOL>
*/
#include "script_component.hpp"
params ["_unit"];
_unit getVariable [QGVAR(isUnconscious), false]

View File

@ -22,7 +22,7 @@ params ["_unit"];
if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith {}; if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith {};
_unit setVariable [QGVAR(inCardiacArrest), true, true]; _unit setVariable [QGVAR(inCardiacArrest), true, true];
_unit setVariable [QGVAR(heartRate), 0, true]; SET_HEART_RATE(_unit,0);
["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent; ["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent;

View File

@ -10,7 +10,7 @@
* None * None
* *
* Example: * Example:
* [bob, "bloodloss"] call ace_medical_fnc_setDead; * [bob, "bloodloss"] call ace_medical_status_fnc_setDead;
* *
* Public: No * Public: No
*/ */

View File

@ -1,15 +0,0 @@
/*
* Author: BaerMitUmlaut
* Sets the heart rate of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Heart rate <NUMBER>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_unit", "_heartRate"];
_unit setVariable [QGVAR(heartRate), _heartRate];

View File

@ -1,15 +0,0 @@
/*
* Author: BaerMitUmlaut
* Sets the total pain level of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Pain level (0..1) <NUMBER>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_unit", "_pain"];
_unit setVariable [QGVAR(pain), 0 max _pain min 1];

View File

@ -13,8 +13,8 @@
* Success? <BOOLEAN> * Success? <BOOLEAN>
* *
* Example: * Example:
* [bob, true] call ace_medical_fnc_setUnconscious; * [bob, true] call ace_medical_status__fnc_setUnconscious;
* [player, true, 5, true] call ace_medical_fnc_setUnconscious; * [player, true, 5, true] call ace_medical_status_fnc_setUnconscious;
* *
* Public: yes * Public: yes
*/ */
@ -63,7 +63,7 @@ if (_knockOut) then {
_unit setVariable [QGVAR(lastWakeUpCheck), CBA_missionTime + _minWaitingTime - SPONTANEOUS_WAKE_UP_INTERVAL]; _unit setVariable [QGVAR(lastWakeUpCheck), CBA_missionTime + _minWaitingTime - SPONTANEOUS_WAKE_UP_INTERVAL];
}; };
}; };
[QGVAR(knockOut), _unit] call CBA_fnc_localEvent; [QGVAR(knockOut), _unit] call CBA_fnc_localEvent;
} else { } else {
[QGVAR(WakeUp), _unit] call CBA_fnc_localEvent; [QGVAR(WakeUp), _unit] call CBA_fnc_localEvent;

View File

@ -77,7 +77,7 @@ class GVAR(Actions) {
items[] = {"ACE_tourniquet"}; items[] = {"ACE_tourniquet"};
treatmentTime = 7; treatmentTime = 7;
callbackSuccess = QFUNC(treatmentTourniquet); callbackSuccess = QFUNC(treatmentTourniquet);
condition = QUOTE(!([ARR_2(_target,_bodyPart)] call EFUNC(medical,hasTourniquetAppliedTo))); condition = QUOTE(!([ARR_2(_target,_bodyPart)] call EFUNC(medical_status,hasTourniquetAppliedTo)));
litter[] = {}; litter[] = {};
}; };
class RemoveTourniquet: Tourniquet { class RemoveTourniquet: Tourniquet {
@ -85,7 +85,7 @@ class GVAR(Actions) {
displayNameProgress = ECSTRING(medical,RemovingTourniquet); displayNameProgress = ECSTRING(medical,RemovingTourniquet);
items[] = {}; items[] = {};
callbackSuccess = QFUNC(treatmentTourniquetRemove); callbackSuccess = QFUNC(treatmentTourniquetRemove);
condition = QUOTE([ARR_2(_target,_bodyPart)] call EFUNC(medical,hasTourniquetAppliedTo)); condition = QUOTE([ARR_2(_target,_bodyPart)] call EFUNC(medical_status,hasTourniquetAppliedTo));
}; };
// --- syringes // --- syringes
@ -282,7 +282,7 @@ class GVAR(Actions) {
displayName = ECSTRING(medical,Use_Aid_Kit); displayName = ECSTRING(medical,Use_Aid_Kit);
displayNameProgress = ECSTRING(medical,TreatmentAction); displayNameProgress = ECSTRING(medical,TreatmentAction);
category = "advanced"; category = "advanced";
condition = QUOTE(_target call EFUNC(medical,isInStableCondition)); condition = QUOTE(_target call EFUNC(medical_status,isInStableCondition));
items[] = {"ACE_personalAidKit"}; items[] = {"ACE_personalAidKit"};
treatmentLocations[] = {QEGVAR(medical,useLocation_PAK)}; treatmentLocations[] = {QEGVAR(medical,useLocation_PAK)};
requiredMedic = QEGVAR(medical,medicSetting_PAK); requiredMedic = QEGVAR(medical,medicSetting_PAK);

View File

@ -48,8 +48,6 @@ PREP(getTriageStatus);
PREP(handleBandageOpening); PREP(handleBandageOpening);
PREP(healTime); PREP(healTime);
PREP(HealTimeMedkit); PREP(HealTimeMedkit);
PREP(isBeingCarried);
PREP(isBeingDragged);
PREP(onMedicationUsage); PREP(onMedicationUsage);
// items // items

View File

@ -18,7 +18,7 @@ params ["_caller", "_target", "_bodyPart"];
private _bloodPressure = [0, 0]; private _bloodPressure = [0, 0];
if (alive _target && !([_target, _bodyPart] call EFUNC(medical,hasTourniquetAppliedTo))) then { if (alive _target && !([_target, _bodyPart] call EFUNC(medical_status,hasTourniquetAppliedTo))) then {
_bloodPressure = GET_BLOOD_PRESSURE(_target); _bloodPressure = GET_BLOOD_PRESSURE(_target);
}; };
@ -28,7 +28,7 @@ private _logOutPut = ELSTRING(medical,Check_Bloodpressure_NoBloodpressure);
_bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"]; _bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"];
if (_bloodPressureHigh > 20) then { if (_bloodPressureHigh > 20) then {
if (_caller call EFUNC(medical,isMedic)) then { if (_caller call EFUNC(medical_status,isMedic)) then {
_bloodPressureOutput = ELSTRING(medical,Check_Bloodpressure_Output_1); _bloodPressureOutput = ELSTRING(medical,Check_Bloodpressure_Output_1);
_logOutPut = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow]; _logOutPut = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow];
} else { } else {

View File

@ -18,7 +18,7 @@ params ["_caller", "_target", "_bodyPart"];
private _heartRate = 0; private _heartRate = 0;
if (alive _target && !([_target, _bodyPart] call EFUNC(medical,hasTourniquetAppliedTo))) then { if (alive _target && !([_target, _bodyPart] call EFUNC(medical_status,hasTourniquetAppliedTo))) then {
_heartRate = _target getVariable [QEGVAR(medical,heartRate), 80]; _heartRate = _target getVariable [QEGVAR(medical,heartRate), 80];
}; };
@ -26,7 +26,7 @@ private _heartRateOutput = ELSTRING(medical,Check_Pulse_Output_5);
private _logOutPut = ELSTRING(medical,Check_Pulse_None); private _logOutPut = ELSTRING(medical,Check_Pulse_None);
if (_heartRate > 1.0) then { if (_heartRate > 1.0) then {
if (_caller call EFUNC(medical,isMedic)) then { if (_caller call EFUNC(medical_status,isMedic)) then {
_heartRateOutput = ELSTRING(medical,Check_Pulse_Output_1); _heartRateOutput = ELSTRING(medical,Check_Pulse_Output_1);
_logOutPut = format ["%1", round(_heartRate)]; _logOutPut = format ["%1", round(_heartRate)];
} else { } else {

View File

@ -23,11 +23,11 @@ if ([_target] call EFUNC(common,isAwake)) exitWith {
[QEGVAR(common,displayTextStructured), [[ELSTRING(medical,CanNotLoaded), _target call EFUNC(common,getName)], 1.5, _caller], _caller] call CBA_fnc_targetEvent; [QEGVAR(common,displayTextStructured), [[ELSTRING(medical,CanNotLoaded), _target call EFUNC(common,getName)], 1.5, _caller], _caller] call CBA_fnc_targetEvent;
}; };
if ([_target] call FUNC(isBeingCarried)) then { if ([_target] call EFUNC(medical_status,isBeingCarried)) then {
[_caller, _target] call EFUNC(dragging,dropObject_carry); [_caller, _target] call EFUNC(dragging,dropObject_carry);
}; };
if ([_target] call FUNC(isBeingDragged)) then { if ([_target] call EFUNC(medical_status,isBeingDragged)) then {
[_caller, _target] call EFUNC(dragging,dropObject); [_caller, _target] call EFUNC(dragging,dropObject);
}; };

View File

@ -27,7 +27,7 @@ if (!local _target) exitWith {
if (alive _target) then { if (alive _target) then {
TRACE_1("manually killing with setDead",_target); TRACE_1("manually killing with setDead",_target);
[_target, true, "buried_alive"] call EFUNC(medical,setDead); [_target, true, "buried_alive"] call EFUNC(medical_status,setDead);
}; };
private _position = (getPosASL _target) vectorAdd [0, 0, 0.2]; private _position = (getPosASL _target) vectorAdd [0, 0, 0.2];

View File

@ -23,7 +23,7 @@ private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(r
_unit setVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime]; _unit setVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime];
if (_deltaT != 0) then { if (_deltaT != 0) then {
private _change = ([_unit, _deltaT, _syncValues] call EFUNC(medical,getBloodVolumeChange)); private _change = ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
private _bloodVolume = (_unit getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]) + _change; private _bloodVolume = (_unit getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]) + _change;
_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME; _bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
_unit setVariable [QEGVAR(medical,bloodVolume), _bloodVolume, _syncValues]; _unit setVariable [QEGVAR(medical,bloodVolume), _bloodVolume, _syncValues];

View File

@ -52,7 +52,7 @@ if (isNumber (_config >> "requiredMedic")) then {
}; };
}; };
if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitWith {false}; if !([_caller, _medicRequired] call EFUNC(medical_status,isMedic)) exitWith {false};
// check selection // check selection
private _allowedSelections = getArray (_config >> "allowedSelections") apply {toLower _x}; private _allowedSelections = getArray (_config >> "allowedSelections") apply {toLower _x};
@ -92,8 +92,8 @@ private _locations = getArray (_config >> "treatmentLocations") apply {toLower _
if ("all" in _locations) then { if ("all" in _locations) then {
_locations = true; _locations = true;
} else { } else {
private _medFacility = {([_caller] call EFUNC(medical,isInMedicalFacility)) || ([_target] call EFUNC(medical,isInMedicalFacility))}; private _medFacility = {([_caller] call EFUNC(medical_status,isInMedicalFacility)) || ([_target] call EFUNC(medical_status,isInMedicalFacility))};
private _medVeh = {([_caller] call EFUNC(medical,isInMedicalVehicle)) || ([_target] call EFUNC(medical,isInMedicalVehicle))}; private _medVeh = {([_caller] call EFUNC(medical_status,isInMedicalVehicle)) || ([_target] call EFUNC(medical_status,isInMedicalVehicle))};
{ {
if (_x == "field") exitWith { _locations = true; }; if (_x == "field") exitWith { _locations = true; };

View File

@ -33,7 +33,7 @@ if ([_medic, _item] call EFUNC(common,hasItem)) exitWith {
private _return = false; private _return = false;
if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical,isMedicalVehicle)}) then { if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical_status,isMedicalVehicle)}) then {
{ {
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith { if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith {
_return = true; _return = true;

View File

@ -1,26 +0,0 @@
/*
* Author: PabstMirror
* Returns if a target is being carried. (from ace_dragging)
*
* Arguments:
* 0: Target Unit <OBJECT>
*
* Return Value:
* Is being carried <BOOL>
*
* Example:
* [bob] call ACE_medical_treatment_fnc_isBeingCarried
*
* Public: No
*/
#include "script_component.hpp"
params ["_target"];
private "_owner";
_owner = _target getVariable [QEGVAR(common,owner), objNull];
if (isNull _owner) exitWith {false};
(_owner getVariable [QEGVAR(dragging,carriedObject), objNull]) == _target

View File

@ -1,26 +0,0 @@
/*
* Author: PabstMirror
* Returns if a target is being dragged. (from ace_dragging)
*
* Arguments:
* 0: Target Unit <OBJECT>
*
* Return Value:
* Is being dragged <BOOL>
*
* Example:
* [bob] call ACE_medical_treatment_fnc_isBeingDragged
*
* Public: No
*/
#include "script_component.hpp"
params ["_target"];
private "_owner";
_owner = _target getVariable [QEGVAR(common,owner), objNull];
if (isNull _owner) exitWith {false};
(_owner getVariable [QEGVAR(dragging,draggedObject), objNull]) == _target

View File

@ -33,7 +33,7 @@ if ([_medic, _item] call EFUNC(common,hasItem)) exitWith {
private _return = [false, objNull]; private _return = [false, objNull];
if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical,isMedicalVehicle)}) then { if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical_status,isMedicalVehicle)}) then {
{ {
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith { if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith {
["ace_useItem", [_x, _item], _x] call CBA_fnc_targetEvent; ["ace_useItem", [_x, _item], _x] call CBA_fnc_targetEvent;

View File

@ -32,7 +32,7 @@ if (_syncValues) then {
_unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime]; _unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime];
}; };
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) + ([_unit, _deltaT, _syncValues] call FUNC(getBloodVolumeChange)); private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) + ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME; _bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
// @todo: replace this and the rest of the setVariable with EFUNC(common,setApproximateVariablePublic) // @todo: replace this and the rest of the setVariable with EFUNC(common,setApproximateVariablePublic)
@ -98,7 +98,7 @@ private _heartRate = [_unit, _deltaT, _syncValues] call FUNC(updateHeartRate);
private _bloodPressure = GET_BLOOD_PRESSURE(_unit); private _bloodPressure = GET_BLOOD_PRESSURE(_unit);
_unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues]; _unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues];
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput); private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput);
if (_bloodLoss > BLOOD_LOSS_KNOCK_OUT_THRESHOLD * _cardiacOutput) then { if (_bloodLoss > BLOOD_LOSS_KNOCK_OUT_THRESHOLD * _cardiacOutput) then {
[QGVAR(CriticalVitals), _unit] call CBA_fnc_localEvent; [QGVAR(CriticalVitals), _unit] call CBA_fnc_localEvent;
}; };

View File

@ -44,7 +44,7 @@ if (!(_adjustment isEqualTo [])) then {
_unit setVariable [QGVAR(heartRateAdjustments), _adjustment, _syncValue]; _unit setVariable [QGVAR(heartRateAdjustments), _adjustment, _syncValue];
}; };
private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; private _heartRate = GET_HEART_RATE(_unit);
if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then { if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
private _hrChange = 0; private _hrChange = 0;
@ -75,7 +75,7 @@ if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
_heartRate = (_heartRate + _deltaT * _hrChange) max 0; _heartRate = (_heartRate + _deltaT * _hrChange) max 0;
}; };
_unit setVariable [QGVAR(heartRate), _heartRate, _syncValue]; SET_HEART_RATE(_unit,_heartRate,_syncValue);
_heartRate _heartRate

View File

@ -44,8 +44,8 @@ if (!(_adjustment isEqualTo [])) then {
}; };
// Handle continuous pain reduction // Handle continuous pain reduction
private _pain = _unit getVariable [QGVAR(pain), 0]; private _pain = GET_PAIN_TOTAL(_unit);
_unit setVariable [QGVAR(pain), 0 max (_pain - _deltaT / PAIN_FADE_TIME), _syncValue]; _unit setVariable [QEGVAR(medical_status,pain), 0 max (_pain - _deltaT / PAIN_FADE_TIME), _syncValue];
// Handles simple medication // Handles simple medication
if (!GVAR(advancedMedication)) then { if (!GVAR(advancedMedication)) then {