From 9139a52a381ad5b86b1f6839c6fd106bfb12a441 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 22 Apr 2017 13:45:56 -0500 Subject: [PATCH] Add more debug --- addons/medical/XEH_postInit.sqf | 49 +++++++++++++++++++ .../functions/fnc_getBloodPressure.sqf | 3 ++ 2 files changed, 52 insertions(+) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index a09e4fe14f..0c31b8ab6e 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -33,6 +33,55 @@ if (!hasInterface) exitWith {}; }] call EFUNC(common,arithmeticSetSource); #ifdef DEBUG_MODE_FULL + +["medical", { + private _unit = cursorTarget; + private _return = []; + + if (!(_unit isKindOf "CAManBase")) then {_unit = cursorObject}; + if (!(_unit isKindOf "CAManBase")) then {_unit = player}; + + if (_unit isKindOf "CAManBase") then { + // Header: + _return pushBack format ["%2 [%3]", (["00FF00", "0000FF"] select (_unit == player)), [_unit] call EFUNC(common,getName), typeOf _unit]; + _return pushBack ""; + + // State: + private _hasStableVitals = [_unit] call FUNC(hasStableVitals); + private _targetState = [_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; + private _color = switch (_targetState) do {case "Default": {"33FF33"}; case "Injured": {"FF3333"}; case "Unconscious": {"FF8833"}; case "CardiacArrest": {"FF33A"}; default {"333333"}}; + _return pushBack format ["State: %2 [Stable Vitals: %3]", _color, _targetState, _hasStableVitals]; + + // Blood: + private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]; + private _bloodLoss = [_unit] call FUNC(getBloodLoss); + private _secondsToHeartstop = if (_bloodLoss != 0) then {format ["[Time Left: %1]", (((_bloodVolume - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) max 0) / _bloodLoss) toFixed 1]} else {""}; + _return pushBack format ["Blood: %1 [Loss: %2] %3", _bloodVolume toFixed 3, _bloodLoss toFixed 5, _secondsToHeartstop]; + + // Vitals: + private _cardiacOutput = [_unit] call FUNC(getCardiacOutput); + private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; + ([_unit] call FUNC(getBloodPressure)) params ["_bpLow", "_bpHigh"]; + _return pushBack format ["Output %1 [HR: %2] [BP: %3 / %4]", _cardiacOutput toFixed 4, _heartRate toFixed 1, _bpLow toFixed 1, _bpHigh toFixed 1]; + + // Pain: + private _pain = _unit getVariable [QGVAR(pain), 0]; + private _painSuppress = _unit getVariable [QGVAR(painSuppress), 0]; + private _painLevel = [_unit] call FUNC(getPainLevel); + _return pushBack format ["Effective Pain: %1 [pain: %2] [suppress: %3]", _painLevel toFixed 4, _pain toFixed 3, _painSuppress toFixed 3]; + + // Tourniquets: + private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; + { + if (_x != 0) then { + _return pushBack ["Tourniquet on %1 [Time On: %2]", GVAR(SELECTIONS) select _forEachIndex, (CBA_missionTime - _x)]; + }; + } forEach _tourniquets; + }; + _return joinString "
"; +}, [10]] call ace_common_fnc_watchVariable; + + [{!isNull findDisplay 46}, { INFO("Creating Debug Display"); if (!isNull (uiNamespace getVariable [QGVAR(debugControl), controlNull])) then { diff --git a/addons/medical/functions/fnc_getBloodPressure.sqf b/addons/medical/functions/fnc_getBloodPressure.sqf index 7c6aef1e13..118d5ca433 100644 --- a/addons/medical/functions/fnc_getBloodPressure.sqf +++ b/addons/medical/functions/fnc_getBloodPressure.sqf @@ -9,6 +9,9 @@ * 0: BloodPressure Low * 1: BloodPressure High * + * Example: + * [player] call ace_medical_fnc_getBloodPressure + * * Public: No */