diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 0c31b8ab6e..4743d95d57 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -1,4 +1,4 @@ -// #define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" ["ace_interactMenuClosed", {[objNull, 0] call FUNC(displayPatientInformation);}] call CBA_fnc_addEventHandler; @@ -49,7 +49,7 @@ if (!hasInterface) exitWith {}; // 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"}}; + private _color = switch (_targetState) do {case "Default": {"33FF33"}; case "Injured": {"FF3333"}; case "Unconscious": {"FF8833"}; case "CardiacArrest": {"FF33AA"}; default {"333333"}}; _return pushBack format ["State: %2 [Stable Vitals: %3]", _color, _targetState, _hasStableVitals]; // Blood: @@ -74,12 +74,18 @@ if (!hasInterface) exitWith {}; 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)]; + _return pushBack format ["Tourniquet on %1 [Time On: %2]", GVAR(SELECTIONS) select _forEachIndex, (CBA_missionTime - _x)]; }; - } forEach _tourniquets; + } forEach _tourniquets; + + // Wounds: + private _wounds = _unit getVariable [QGVAR(openWounds), []]; + { + _return pushBack format ["Wound: %1", _x]; + } forEach _wounds; }; _return joinString "
"; -}, [10]] call ace_common_fnc_watchVariable; +}, [15]] call ace_common_fnc_watchVariable; [{!isNull findDisplay 46}, { diff --git a/addons/medical/functions/fnc_addDamageToUnit.sqf b/addons/medical/functions/fnc_addDamageToUnit.sqf index d84429c347..86ae38efb7 100644 --- a/addons/medical/functions/fnc_addDamageToUnit.sqf +++ b/addons/medical/functions/fnc_addDamageToUnit.sqf @@ -8,7 +8,7 @@ * 1: Damage to Add * 2: Body part ("Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg") * 3: Projectile Type - * 3: Source + * 4: Source * * Return Value: * Successful diff --git a/addons/medical/functions/fnc_handleIncapacitation.sqf b/addons/medical/functions/fnc_handleIncapacitation.sqf index 1e9ba01051..6808a25c4c 100644 --- a/addons/medical/functions/fnc_handleIncapacitation.sqf +++ b/addons/medical/functions/fnc_handleIncapacitation.sqf @@ -33,13 +33,6 @@ private _damageThreshold = if (isPlayer _unit) then { GVAR(AIDamageThreshold) }; -if (_headDamage > _damageThreshold / 2) then { - [QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent; -}; -if (_bodyDamage > _damageThreshold) then { - [QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent; -}; - -if ((_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}) then { +if ((_headDamage > _damageThreshold / 2) || {_bodyDamage > _damageThreshold} || {(_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}}) then { [QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent; }; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 73bf62f36a..c773d26693 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -21,8 +21,10 @@ params ["_unit"]; private _lastTimeUpdated = _unit getVariable [QGVAR(lastTimeUpdated), 0]; private _deltaT = (CBA_missionTime - _lastTimeUpdated) min 10; if (_deltaT < 1) exitWith {}; // state machines could be calling this very rapidly depending on number of local units -_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime]; +BEGIN_COUNTER(Vitals); + +_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime]; private _lastTimeValuesSynced = _unit getVariable [QGVAR(lastMomentValuesSynced), 0]; private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(random(10))); @@ -115,3 +117,4 @@ if ((_heartRate < 20) || {_heartRate > 220} || {_bloodPressureH < 50}) then { [QGVAR(FatalVitals), _unit] call CBA_fnc_localEvent; }; +END_COUNTER(Vitals); diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index c93f584b0c..19015b3af7 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -4,7 +4,7 @@ // #define DEBUG_MODE_FULL #define DISABLE_COMPILE_CACHE -// #define ENABLE_PERFORMANCE_COUNTERS +#define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MEDICAL #define DEBUG_MODE_FULL diff --git a/addons/medical_damage/XEH_preInit.sqf b/addons/medical_damage/XEH_preInit.sqf index b796caf105..c2a5055e76 100644 --- a/addons/medical_damage/XEH_preInit.sqf +++ b/addons/medical_damage/XEH_preInit.sqf @@ -16,9 +16,9 @@ addMissionEventHandler ["Loaded",{ // decide which woundsHandler to use by whether the extension is present or not if ("ace_medical" callExtension "version" != "") then { - DFUNC(woundsHandlerActive) = FUNC(woundsHandler); + DFUNC(woundsHandlerActive) = LINKFUNC(woundsHandler); } else { - DFUNC(woundsHandlerActive) = FUNC(woundsHandlerSQF); + DFUNC(woundsHandlerActive) = LINKFUNC(woundsHandlerSQF); }; [QEGVAR(medical_engine,woundReceived), {