Clenaup / Debug

This commit is contained in:
PabstMirror 2017-04-26 10:16:09 -05:00
parent 9139a52a38
commit c6fc4d0a13
6 changed files with 20 additions and 18 deletions

View File

@ -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 ["<t color='#%1'>State: %2</t> [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 "<br/>";
}, [10]] call ace_common_fnc_watchVariable;
}, [15]] call ace_common_fnc_watchVariable;
[{!isNull findDisplay 46}, {

View File

@ -8,7 +8,7 @@
* 1: Damage to Add <NUMBER>
* 2: Body part ("Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg") <STRING>
* 3: Projectile Type <STRING>
* 3: Source <OBJECT>
* 4: Source <OBJECT>
*
* Return Value:
* Successful <BOOL>

View File

@ -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;
};

View File

@ -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);

View File

@ -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

View File

@ -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), {