Skip to content

Commit

Permalink
Add medical instructor display (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoramD0 authored Apr 22, 2021
1 parent 45bb591 commit 1e2d899
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 0 deletions.
1 change: 1 addition & 0 deletions Olympus.Stratis/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CfgFunctions {
class specific_projectileTypeActions;
class specific_severityActions;
class applyRandomDamage;
class instructorDisplay;
};
};
};
29 changes: 29 additions & 0 deletions Olympus.Stratis/functions/medical/fn_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);

82 changes: 82 additions & 0 deletions Olympus.Stratis/functions/medical/fn_instructorDisplay.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#include "..\..\script_component.hpp"
/*
* Author: alganthe, JoramD
* Shows instructor info display with subject medical information.
*
* Arguments:
* 0: Stretchers <ARRAY>
*
* 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 ["<t align='center' size='1.8'>Subject %1</t><br/><t align='center' size='1.4'>Not present</t><br/>", _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 [
"<t align='center' size='1.8'>%1</t><br/>
<t align='left' size='1.4'>Heart rate:</t><t align='right' size='1.4'>%2</t><br/>
<t align='left' size='1.4'>Blood pressure:</t><t align='right' size='1.4'>%3 / %4</t><br/>
<t align='left' size='1.4'>Blood volume:</t><t align='right' size='1.4'>%5</t><br/>
<t align='left' size='1.4'>Pain level:</t><t align='right' size='1.4'>%6</t><br/>
<t align='left' size='1.4'>Unconsious:</t><t align='right' size='1.4'>%7</t><br/>
<t align='left' size='1.4'>IV fluids:</t><t align='right' size='1.4'>%8ml</t><br/>
<t align='left' size='1.4'>Dead:</t><t align='right' size='1.4'>%9</t><br/>",

["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;

0 comments on commit 1e2d899

Please sign in to comment.