ACE3/addons/medical/dev/watchVariable.sqf

172 lines
9.3 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
2017-04-29 17:58:35 +00:00
if (missionNamespace getVariable [QGVAR(dev_watchVariableRunning), false]) exitWith {};
GVAR(dev_watchVariableRunning) = true;
2017-04-29 17:58:35 +00:00
["medical", {
// Hide when patient display is up because they might overlap
private _display = uiNamespace getVariable [QEGVAR(medical_gui,RscPatientInfo), displayNull];
if (!isNull _display) exitWith {"Paused"};
2017-04-29 17:58:35 +00:00
private _unit = cursorTarget;
if !(_unit isKindOf "CAManBase") then {_unit = cursorObject};
if !(_unit isKindOf "CAManBase") then {_unit = ACE_player};
2018-05-22 16:21:24 +00:00
if ((_unit != ACE_player) && {IS_UNCONSCIOUS(ACE_player)}) then {_unit = ACE_player};
if !(_unit isKindOf "CAManBase") exitWith {"No Unit?"};
2017-04-29 17:58:35 +00:00
private _return = [];
// Header:
2017-09-26 22:43:54 +00:00
_return pushBack format ["<t size='1.2'><t color='#%1'>%2</t> [%3]", (["00FF00", "0000FF"] select (_unit == ACE_player)), [_unit] call EFUNC(common,getName), typeOf _unit];
2017-04-29 17:58:35 +00:00
_return pushBack "";
// State:
2018-07-16 21:25:54 +00:00
private _targetState = [_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
2017-09-26 22:43:54 +00:00
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"}};
_return pushBack format ["<t color='#%1'>State: %2</t>", _color, _targetState];
private _hasStableVitals = ["N", "Y"] select ([_unit] call EFUNC(medical_status,hasStableVitals));
private _hasStableCondition = ["N", "Y"] select ([_unit] call EFUNC(medical_status,isInStableCondition));
private _unconcFlag = ["", "[<t color='#BBFFBB'>U</t>]"] select IS_UNCONSCIOUS(_unit);
private _timeLeft = _unit getVariable [QEGVAR(medical_statemachine,cardiacArrestTimeLeft), -1];
private _cardiactArrestFlag = if IN_CRDC_ARRST(_unit) then {format ["[<t color='#BBBBFF'>CA</t> %1]", _timeLeft toFixed 1]} else {""};
_return pushBack format ["[StableVitals: %1] [StableCon: %2] %3 %4", _hasStableVitals, _hasStableCondition, _unconcFlag, _cardiactArrestFlag];
2017-04-29 17:58:35 +00:00
// Blood:
2018-04-27 15:03:55 +00:00
private _bloodVolume = GET_BLOOD_VOLUME(_unit);
private _woundBleeding = GET_WOUND_BLEEDING(_unit);
2018-04-27 15:03:55 +00:00
private _bloodLoss = GET_BLOOD_LOSS(_unit);
private _hemorrhage = GET_HEMORRHAGE(_unit);
private _isBleeding = ["", "[<t color ='#FF9999'>Bleeding</t>]"] select IS_BLEEDING(_unit);
private _secondsToHeartstop = if (_bloodLoss != 0) then {format ["[<t color ='#FF9999'>Time Left:</t> %1 sec]", (((_bloodVolume - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) max 0) / _bloodLoss) toFixed 0]} else {""};
_return pushBack format ["Blood: %1 [Hemorrhage: %2] %3", _bloodVolume toFixed 3, _hemorrhage, _isBleeding];
_return pushBack format [" - [W: %1 T: %2] %3", _woundBleeding toFixed 4, _bloodLoss toFixed 4, _secondsToHeartstop];
2017-04-29 17:58:35 +00:00
// Heart:
2018-05-08 09:16:12 +00:00
private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput);
private _heartRate = GET_HEART_RATE(_unit);
2018-05-08 08:28:16 +00:00
GET_BLOOD_PRESSURE(_unit) params ["_bpLow", "_bpHigh"];
2017-04-29 17:58:35 +00:00
_return pushBack format ["CardiacOutput %1", _cardiacOutput toFixed 5];
2019-09-07 17:18:12 +00:00
_return pushBack format [" - [HR: %1] [BP: %2 / %3]", _heartRate toFixed 1, _bpHigh toFixed 1, _bpLow toFixed 1];
2017-04-29 17:58:35 +00:00
// Pain:
private _pain = GET_PAIN(_unit);
private _painSuppress = GET_PAIN_SUPPRESS(_unit);
2018-05-08 07:47:03 +00:00
private _painLevel = GET_PAIN_PERCEIVED(_unit);
private _isInPain = IS_IN_PAIN(_unit);
_return pushBack format ["Effective Pain: %1 [%2]", _painLevel toFixed 3, _isInPain];
2017-04-29 17:58:35 +00:00
_return pushBack format [" - [Pain: %1] [Suppress: %2]", _pain toFixed 3, _painSuppress toFixed 3];
// Damage:
private _damage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _limping = ["", "[<t color ='#FFCC22'> Limping </t>]"] select (_unit getVariable [QEGVAR(medical,isLimping), false]);
_return pushBack format ["BodyPartDamage: [H: %1] [B: %2]", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2];
2017-06-05 17:30:54 +00:00
_return pushBack format ["[LA:%1] [RA: %2] [LL:%3] [RL: %4]", (_damage select 2) toFixed 2, (_damage select 3) toFixed 2, (_damage select 4) toFixed 2, (_damage select 5) toFixed 2];
2017-04-29 17:58:35 +00:00
_return pushBack format ["Hitpoints: [HHed:%1] [HBod: %2]", (_unit getHitPointDamage "HitHead") toFixed 2, (_unit getHitPointDamage "HitBody") toFixed 2];
_return pushBack format ["[HHnd:%1] [HLeg: %2] %3", (_unit getHitPointDamage "HitHands") toFixed 2, (_unit getHitPointDamage "HitLegs") toFixed 2, _limping];
Medical Treatment - Modernize and Cleanup (#6933) * Modernize and cleanup medical_treatment * One line for each old public function * Fix litterCleanupDelay name * Improve adjustment calcs / wound blood loss / medications fix func descriptions Calc wound blood loss on events reorder includes so scritpmacroMed has global effect trivial optimization for getCardiacOutput Fix var Fix wounds not reopening (nil _category) Fix surgical kit inherting canBandage conditional debug hitpoints Update ACE_Medical_Treatment_Actions.hpp Use woundBleeding for IS_BLEEDING macro rework medication vars comments Reset var in init / fullHeal Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf Co-Authored-By: PabstMirror <pabstmirror@gmail.com> * Change wound data array Drop unique id and merge classId and category * Splinting and treatment and gui * Add arm fractures and aim effects * localizations and event * fix * fix merge for renamed files * Fixes and code review changes * Move medical logs clearing to treatment * More cleanup work * cleanup * Apply suggestions from code review Co-Authored-By: PabstMirror <pabstmirror@gmail.com> * formating, rename bone images * Fix args for setDead call in actionPlaceInBodyBag * Apply suggestions from code review Co-Authored-By: PabstMirror <pabstmirror@gmail.com> * disable calls to extension * Update fnc_onMedicationUsage.sqf * Medical - Skip unneeded setVars on initUnit (#6949) * Medical - Transfer state machine state on locality (#6950) * Medical - Transfer state machine state on locality * Fix feedback isUnconscious var * Exclude AI * Make UAV excludes consistant, formating * Update fnc_treatmentFullHealLocal.sqf * reset fractures on respawn * Fix merge * Add PAK time coefficient setting * Fix medication * Add ace_medical_replacementItems config array * checkItems performance improvement * Treatment - cap max animation speed (#6995) * Treatment - cap max animation speed and add lock to prevent AF from reseting anim * Update fnc_getBandageTime.sqf * Use local version of setAnimSpeedCoef * Revert "Use local version of setAnimSpeedCoef" This reverts commit 36c22a90473fd0670ab97f3a373e4ae08493ff52. * Move replacementItems compiling to preInit * Improve replacementItems compiling * Cleanup splint functions, use macros for fractures * Rename splintCondition to canSplint * Add cprCreatesPulse setting * Cleanup remaining functions * Capitalize stringtable entry names * getStitchTime function and fix treatment locations * Update addons/medical_treatment/functions/fnc_getHealTime.sqf Co-Authored-By: SilentSpike <silentspike100+Github@gmail.com>
2019-06-03 15:31:46 +00:00
private _fractures = GET_FRACTURES(_unit);
private _canSprint = ["[<t color ='#FFCC22'>Sprint Blocked</t>]", ""] select (isSprintAllowed _unit);
private _forceWalk = ["", "[<t color ='#FF9922'>Forced Walking</t>]"] select (isForcedWalk _unit);
_return pushBack format ["Fractures: %1 %2%3", _fractures, _canSprint, _forceWalk];
2017-04-29 17:58:35 +00:00
// Tourniquets:
_return pushBack "------- Tourniquets: -------";
private _tourniquets = GET_TOURNIQUETS(_unit);
2017-04-29 17:58:35 +00:00
private _occludedMedications = _unit getVariable [QEGVAR(medical,occludedMedications), []];
{
private _tPartNum = _forEachIndex;
if (_x != 0) then {
_return pushBack format ["%1 [Time On: %2]", ALL_SELECTIONS select _tPartNum, (CBA_missionTime - _x) toFixed 1];
2017-04-29 17:58:35 +00:00
};
{
Medical Treatment - Modernize and Cleanup (#6933) * Modernize and cleanup medical_treatment * One line for each old public function * Fix litterCleanupDelay name * Improve adjustment calcs / wound blood loss / medications fix func descriptions Calc wound blood loss on events reorder includes so scritpmacroMed has global effect trivial optimization for getCardiacOutput Fix var Fix wounds not reopening (nil _category) Fix surgical kit inherting canBandage conditional debug hitpoints Update ACE_Medical_Treatment_Actions.hpp Use woundBleeding for IS_BLEEDING macro rework medication vars comments Reset var in init / fullHeal Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf Co-Authored-By: PabstMirror <pabstmirror@gmail.com> * Change wound data array Drop unique id and merge classId and category * Splinting and treatment and gui * Add arm fractures and aim effects * localizations and event * fix * fix merge for renamed files * Fixes and code review changes * Move medical logs clearing to treatment * More cleanup work * cleanup * Apply suggestions from code review Co-Authored-By: PabstMirror <pabstmirror@gmail.com> * formating, rename bone images * Fix args for setDead call in actionPlaceInBodyBag * Apply suggestions from code review Co-Authored-By: PabstMirror <pabstmirror@gmail.com> * disable calls to extension * Update fnc_onMedicationUsage.sqf * Medical - Skip unneeded setVars on initUnit (#6949) * Medical - Transfer state machine state on locality (#6950) * Medical - Transfer state machine state on locality * Fix feedback isUnconscious var * Exclude AI * Make UAV excludes consistant, formating * Update fnc_treatmentFullHealLocal.sqf * reset fractures on respawn * Fix merge * Add PAK time coefficient setting * Fix medication * Add ace_medical_replacementItems config array * checkItems performance improvement * Treatment - cap max animation speed (#6995) * Treatment - cap max animation speed and add lock to prevent AF from reseting anim * Update fnc_getBandageTime.sqf * Use local version of setAnimSpeedCoef * Revert "Use local version of setAnimSpeedCoef" This reverts commit 36c22a90473fd0670ab97f3a373e4ae08493ff52. * Move replacementItems compiling to preInit * Improve replacementItems compiling * Cleanup splint functions, use macros for fractures * Rename splintCondition to canSplint * Add cprCreatesPulse setting * Cleanup remaining functions * Capitalize stringtable entry names * getStitchTime function and fix treatment locations * Update addons/medical_treatment/functions/fnc_getHealTime.sqf Co-Authored-By: SilentSpike <silentspike100+Github@gmail.com>
2019-06-03 15:31:46 +00:00
_x params ["_medPartNum", "_medClassname"];
2017-04-29 17:58:35 +00:00
if (_medPartNum == _tPartNum) then {
_return pushBack format [" - Occluded Med: %1", _medClassname];
};
} forEach _occludedMedications;
} forEach _tourniquets;
// Wounds:
_return pushBack "------- Open Wounds: -------";
2019-06-22 18:36:27 +00:00
private _wounds = GET_OPEN_WOUNDS(_unit);
2017-04-29 17:58:35 +00:00
{
private _bodyPart = _x;
{
_x params ["_xClassID", "_xAmountOf", "_xBleeding", "_xDamage"];
_return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", _bodyPart, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
} forEach _y;
2017-04-29 17:58:35 +00:00
} forEach _wounds;
// Bandaged Wounds:
_return pushBack "------- Bandaged Wounds: -------";
2019-06-22 18:36:27 +00:00
private _wounds = GET_BANDAGED_WOUNDS(_unit);
{
private _bodyPart = _x;
{
_x params ["_xClassID", "_xAmountOf", "_xBleeding", "_xDamage"];
_return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", _bodyPart, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
} forEach _y;
} forEach _wounds;
// Stitched Wounds:
_return pushBack "------- Stitched Wounds: -------";
2019-06-22 18:36:27 +00:00
private _wounds = GET_STITCHED_WOUNDS(_unit);
{
private _bodyPart = _x;
{
_x params ["_xClassID", "_xAmountOf", "_xBleeding", "_xDamage"];
_return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", _bodyPart, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
} forEach _y;
} forEach _wounds;
2017-04-29 17:58:35 +00:00
// IVs:
_return pushBack "------- IVs: -------";
private _ivBags = _unit getVariable [QEGVAR(medical,ivBags), []];
{
_x params ["_xVolumeAdded", "_xType", "_xBodyPartN"];
_return pushBack format ["%1: %2 [%3 ml]", ALL_SELECTIONS select _xBodyPartN, _xType, _xVolumeAdded];
2017-04-29 17:58:35 +00:00
} forEach _ivBags;
// Medications:
_return pushBack "------- Medications: -------";
private _hrTargetAdjustment = 0;
private _painSupressAdjustment = 0;
private _peripheralResistanceAdjustment = 0;
private _uniqueMedications = [];
private _rawMedications = (_unit getVariable [VAR_MEDICATIONS, []]) apply {
_x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"];
_uniqueMedications pushBackUnique _medication;
private _timeInSystem = CBA_missionTime - _timeAdded;
private _effectRatio = (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem;
_hrTargetAdjustment = _hrTargetAdjustment + _hrAdjust * _effectRatio;
_painSupressAdjustment = _painSupressAdjustment + _painAdjust * _effectRatio;
_peripheralResistanceAdjustment = _peripheralResistanceAdjustment + _flowAdjust * _effectRatio;
format ["%1 [%2 / %3][%4][%5,%6,%7]",_medication,_timeInSystem toFixed 0,_maxTimeInSystem toFixed 0, _effectRatio toFixed 2, _hrAdjust toFixed 1, _painAdjust toFixed 2, _flowAdjust toFixed 1];
};
_return pushBack format ["Adjusts: [HR %1][PS %2][PR %3]", _hrTargetAdjustment toFixed 2, _painSupressAdjustment toFixed 2, _peripheralResistanceAdjustment toFixed 2];
{
private _medicationCount = [_unit, _x, true] call EFUNC(medical_status,getMedicationCount);
private _medicationEffectiveness = [_unit, _x, false] call EFUNC(medical_status,getMedicationCount);
_return pushBack format ["-%1: C: %2 - E: %3", _x, _medicationCount toFixed 2, _medicationEffectiveness toFixed 2];
} forEach _uniqueMedications;
_return pushBack "------- Medications Raw: -------";
_return append _rawMedications;
if (_unit isEqualTo ACE_player) then {
_return pushBack format ["ACE_setCustomAimCoef: %1", [missionNamespace, "ACE_setCustomAimCoef", "max"] call EFUNC(common,arithmeticGetResult)];
};
_return pushBack format ["%1 - %2",lifeState _unit, animationState _unit];
2017-04-29 17:58:35 +00:00
// Footer:
_return pushBack "</t>";
// Return:
_return joinString "<br/>"
}, [40]] call EFUNC(common,watchVariable);