diff --git a/Olympus.Stratis/CfgFunctions.hpp b/Olympus.Stratis/CfgFunctions.hpp index b96eed8..a0c8e88 100644 --- a/Olympus.Stratis/CfgFunctions.hpp +++ b/Olympus.Stratis/CfgFunctions.hpp @@ -30,6 +30,7 @@ class CfgFunctions { class specific_projectileTypeActions; class specific_severityActions; class applyRandomDamage; + class instructorDisplay; }; }; }; diff --git a/Olympus.Stratis/functions/medical/fn_init.sqf b/Olympus.Stratis/functions/medical/fn_init.sqf index ab9c4eb..5930dc7 100644 --- a/Olympus.Stratis/functions/medical/fn_init.sqf +++ b/Olympus.Stratis/functions/medical/fn_init.sqf @@ -114,3 +114,32 @@ private _randomDamageMainAction = [ [_controller, 0, ["ACE_MainActions", QGVAR(randomDamageMainAction)], _randomDamageAction] call ACEFUNC(interact_menu,addActionToObject); } forEach _stretchers; + +// Instructor display +private _instructorDisplayOpen = [ + QGVAR(instructorDisplayOpen), + "Open instructor display", + "", + {(_this select 2) call TAC_Olympus_Medical_fnc_instructorDisplay}, + {isNil GVAR(instructorDisplayToggle)}, + {}, + [_stretchers] +] call ACEFUNC(interact_menu,createAction); + +[_controller, 0, ["ACE_MainActions"], _instructorDisplayOpen] call ACEFUNC(interact_menu,addActionToObject); + +private _instructorDisplayClose = [ + QGVAR(instructorDisplayClose), + "Close instructor display", + "", + { + GVAR(instructorDisplayToggle) = false; + (_this select 2) call TAC_Olympus_Medical_fnc_instructorDisplay; + }, + {GVAR(instructorDisplayToggle)}, + {}, + [_stretchers] +] call ACEFUNC(interact_menu,createAction); + +[_controller, 0, ["ACE_MainActions"], _instructorDisplayClose] call ACEFUNC(interact_menu,addActionToObject); + diff --git a/Olympus.Stratis/functions/medical/fn_instructorDisplay.sqf b/Olympus.Stratis/functions/medical/fn_instructorDisplay.sqf new file mode 100644 index 0000000..6172bab --- /dev/null +++ b/Olympus.Stratis/functions/medical/fn_instructorDisplay.sqf @@ -0,0 +1,82 @@ +#include "..\..\script_component.hpp" +/* + * Author: alganthe, JoramD + * Shows instructor info display with subject medical information. + * + * Arguments: + * 0: Stretchers + * + * Return Value: + * None + * + * Example: + * [_stretchers] call TAC_Olympus_Medical_fnc_instructorDisplay + */ + +params ["_stretchers"]; + +GVAR(instructorDisplayToggle) = true; +[{ + params ["_args", "_pfhID"]; + _args params ["_stretchers"]; + + if (!GVAR(instructorDisplayToggle)) then { + hintSilent ""; + GVAR(instructorDisplayToggle) = nil; + _pfhID call CBA_fnc_removePerFrameHandler; + } else { + private _completeText = []; + { + _x params ["_stretcher", "_subjectName"]; + + private _medSubject = _stretcher getVariable [format [QGVAR(medSubject_%1), _stretcher], []]; + + if (_medsubject isEqualTo []) then { + _completeText pushBack format ["Subject %1
Not present
", _subjectName]; + } else { + // Retrieve medical data first + private _HR = _medSubject getVariable "ace_medical_heartRate"; + private _BP = _medSubject getVariable "ace_medical_bloodPressure"; + private _bloodVolume = (_medSubject getVariable "ace_medical_bloodVolume") / 6 * 100; + private _pain = _medSubject getVariable "ace_medical_pain"; + private _isUnconscious = _medSubject getVariable "ace_isUnconscious"; + private _ivFluids = 0; + { + _x params ["_amount"]; + _ivFluids = _ivFluids + _amount; + } forEach (_medSubject getVariable ["ace_medical_ivBags", []]); + _ivFluids = _ivFluids toFixed 0; + private _isDead = !alive _medSubject; + + private _roundBabyRoundRound = { + params ["_n"]; + round (_n * 100) / 100 + }; + + private _text = format [ + "%1
+ Heart rate:%2
+ Blood pressure:%3 / %4
+ Blood volume:%5
+ Pain level:%6
+ Unconsious:%7
+ IV fluids:%8ml
+ Dead:%9
", + + ["Subject", _subjectName] joinString " ", + _HR call _roundBabyRoundRound, + _BP select 1 call _roundBabyRoundRound, + _BP select 0 call _roundBabyRoundRound, + [_bloodVolume call _roundBabyRoundRound, "%"] joinString "", + _pain call _roundBabyRoundRound, + _isUnconscious, + _ivFluids, + _isDead + ]; + _completeText pushBack _text; + }; + } forEach _stretchers; + + hintSilent parseText (_completeText joinString ""); + }; +}, 0, [_stretchers]] call CBA_fnc_addPerFrameHandler;