mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
356a8f640a
Conflicts: addons/medical/functions/fnc_actionCheckBloodPressure.sqf addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf addons/medical/functions/fnc_actionCheckPulse.sqf addons/medical/functions/fnc_actionCheckPulseLocal.sqf addons/medical/functions/fnc_actionDiagnose.sqf addons/medical/functions/fnc_actionRemoveTourniquet.sqf addons/medical/functions/fnc_addHeartRateAdjustment.sqf addons/medical/functions/fnc_addToInjuredCollection.sqf addons/medical/functions/fnc_addUnconsciousCondition.sqf addons/medical/functions/fnc_addVitalLoop.sqf addons/medical/functions/fnc_canTreat.sqf addons/medical/functions/fnc_copyDeadBody.sqf addons/medical/functions/fnc_createLitter.sqf addons/medical/functions/fnc_determineIfFatal.sqf addons/medical/functions/fnc_getBloodLoss.sqf addons/medical/functions/fnc_getBloodPressure.sqf addons/medical/functions/fnc_getBloodVolumeChange.sqf addons/medical/functions/fnc_getCardiacOutput.sqf addons/medical/functions/fnc_getHeartRateChange.sqf addons/medical/functions/fnc_getTriageStatus.sqf addons/medical/functions/fnc_getUnconsciousCondition.sqf addons/medical/functions/fnc_handleBandageOpening.sqf addons/medical/functions/fnc_handleCollisionDamage.sqf addons/medical/functions/fnc_handleDamage.sqf addons/medical/functions/fnc_handleDamage_advanced.sqf addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf addons/medical/functions/fnc_handleDamage_airway.sqf addons/medical/functions/fnc_handleDamage_caching.sqf addons/medical/functions/fnc_handleDamage_fractures.sqf addons/medical/functions/fnc_handleDamage_internalInjuries.sqf addons/medical/functions/fnc_handleDamage_wounds.sqf addons/medical/functions/fnc_handleDamage_woundsOld.sqf addons/medical/functions/fnc_hasMedicalEnabled.sqf addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf addons/medical/functions/fnc_isInStableCondition.sqf addons/medical/functions/fnc_isMedicalVehicle.sqf addons/medical/functions/fnc_itemCheck.sqf addons/medical/functions/fnc_medicationEffectLoop.sqf addons/medical/functions/fnc_modifyMedicalAction.sqf addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf addons/medical/functions/fnc_moduleBasicMedicalSettings.sqf addons/medical/functions/fnc_moduleReviveSettings.sqf addons/medical/functions/fnc_parseConfigForInjuries.sqf addons/medical/functions/fnc_playInjuredSound.sqf addons/medical/functions/fnc_reviveStateLoop.sqf addons/medical/functions/fnc_selectionNameToNumber.sqf addons/medical/functions/fnc_setDead.sqf addons/medical/functions/fnc_setHitPointDamage.sqf addons/medical/functions/fnc_setStructuralDamage.sqf addons/medical/functions/fnc_setUnconscious.sqf addons/medical/functions/fnc_showBloodEffect.sqf addons/medical/functions/fnc_treatment.sqf addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf addons/medical/functions/fnc_treatmentAdvanced_medication.sqf addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf addons/medical/functions/fnc_treatmentBasic_epipen.sqf addons/medical/functions/fnc_treatmentBasic_morphine.sqf addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf addons/medical/functions/fnc_treatmentIV.sqf addons/medical/functions/fnc_treatmentIVLocal.sqf addons/medical/functions/fnc_treatmentTourniquet.sqf addons/medical/functions/fnc_treatmentTourniquetLocal.sqf addons/medical/functions/fnc_treatment_failure.sqf addons/medical/functions/fnc_treatment_success.sqf addons/medical/functions/fnc_unconsciousPFH.sqf addons/medical/functions/fnc_useItem.sqf addons/medical/functions/fnc_vitalLoop.sqf addons/medical_blood/functions/fnc_hit.sqf addons/medical_treatment/functions/fnc_hasItem.sqf addons/medical_treatment/functions/fnc_useItems.sqf
234 lines
11 KiB
Plaintext
234 lines
11 KiB
Plaintext
/*
|
|
* Author: Glowbal
|
|
* Displays the patient information for given unit.
|
|
*
|
|
* Arguments:
|
|
* 0: The Unit <OBJECT>
|
|
* 1: Show <NUMBER> (default: 0)
|
|
* 2: Selection <NUMBER> (default: 0)
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [bob, true, 2] call ACE_medical_fnc_displayPatientInformation
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
#define MAX_DISTANCE 10
|
|
|
|
params ["_target", ["_show", 0], ["_selectionN", 0]];
|
|
|
|
GVAR(currentSelectedSelectionN) = [0, _selectionN] select (IS_SCALAR(_selectionN));
|
|
GVAR(displayPatientInformationTarget) = [ObjNull, _target] select _show;
|
|
|
|
if (_show == 1) then {
|
|
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"];
|
|
|
|
[{
|
|
private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel", "_allInjuryTexts", "_lbCtrl", "_genericMessages"];
|
|
params ["_args", "_idPFH"];
|
|
_args params ["_target", "_selectionN"];
|
|
|
|
if (GVAR(displayPatientInformationTarget) != _target || GVAR(currentSelectedSelectionN) != _selectionN) exitwith {
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
};
|
|
if (ACE_player distance _target > MAX_DISTANCE) exitwith {
|
|
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
[QEGVAR(common,displayTextStructured), [[ELSTRING(medical,DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player], [ACE_player]] call CBA_fnc_targetEvent;
|
|
};
|
|
|
|
disableSerialization;
|
|
private _display = uiNamespace getVariable QGVAR(DisplayInformation);
|
|
if (isnil "_display") exitwith {
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
};
|
|
|
|
private _allInjuryTexts = [];
|
|
private _genericMessages = [];
|
|
|
|
private _partText = [ELSTRING(medical,Head), ELSTRING(medical,Torso), ELSTRING(medical,LeftArm) ,ELSTRING(medical,RightArm) ,ELSTRING(medical,LeftLeg), ELSTRING(medical,RightLeg)] select _selectionN;
|
|
_genericMessages pushback [localize _partText, [1, 1, 1, 1]];
|
|
|
|
if (_target getVariable[QEGVAR(medical,isBleeding), false]) then {
|
|
_genericMessages pushback [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]];
|
|
};
|
|
if (_target getVariable[QEGVAR(medical,hasLostBlood), 0] > 1) then {
|
|
_genericMessages pushback [localize ELSTRING(medical,Status_Lost_Blood), [1, 0.1, 0.1, 1]];
|
|
};
|
|
|
|
if (((_target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]) select _selectionN) > 0) then {
|
|
_genericMessages pushback [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
|
|
};
|
|
if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical,isMedic)}) then {
|
|
private _painLevel = _target call EFUNC(medical,getPainLevel);
|
|
if (_painLevel > 0) then {
|
|
private _painText = localize ELSTRING(medical,Status_Pain);
|
|
if (_painLevel < 0.1) then {
|
|
_painText = localize ELSTRING(medical,Status_MildPain);
|
|
} else {
|
|
if (_painLevel > 0.5) then {
|
|
_painText = localize ELSTRING(medical,Status_SeverePain);
|
|
};
|
|
};
|
|
_genericMessages pushback [_painText, [1, 1, 1, 1]];
|
|
};
|
|
};
|
|
|
|
private _totalIvVolume = 0;
|
|
{
|
|
_x params ["_xVolumeAdded"];
|
|
_totalIvVolume = _totalIvVolume + _xVolumeAdded;
|
|
} foreach (_target getVariable [QEGVAR(medical,ivBags), []]);
|
|
|
|
if (_totalIvVolume >= 1) then {
|
|
_genericMessages pushback [format[localize ELSTRING(medical,receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]];
|
|
};
|
|
|
|
private _selectionTourniquet = _target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]];
|
|
private _selectionBloodLoss = [0, 0, 0, 0, 0, 0];
|
|
private _selectionDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
|
private _allInjuryTexts = [];
|
|
|
|
{
|
|
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
|
|
_selectionBloodLoss set [_bodyPartN, (_selectionBloodLoss select _bodyPartN) + (20 * (_bleeding * _amountOf))];
|
|
if (_selectionN == _bodyPartN) then {
|
|
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
|
|
if (_amountOf > 0) then {
|
|
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
|
|
private _postfix = ["Minor", "Medium", "Large"] select _category;
|
|
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
|
|
if (_amountOf >= 1) then {
|
|
_allInjuryTexts pushBack [format["%2x %1", _woundDescription, ceil _amountOf], [1,1,1,1]];
|
|
} else {
|
|
_allInjuryTexts pushBack [format["Partial %1", _woundDescription], [1,1,1,1]];
|
|
};
|
|
} else {
|
|
if (!EGVAR(medical,advancedBandages) || {!EGVAR(medical,woundReopening)}) then {
|
|
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
|
|
private _postfix = ["Minor", "Medium", "Large"] select _category;
|
|
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
|
|
if (_amountOf >= 1) then {
|
|
_allInjuryTexts pushBack [format ["[B] %2x %1", _woundDescription, ceil _amountOf], [0.7,0.7,0.7,1]];
|
|
} else {
|
|
_allInjuryTexts pushBack [format ["[B] Partial %1", _woundDescription], [0.7,0.7,0.7,1]];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
} forEach (_target getVariable [QEGVAR(medical,openWounds), []]);
|
|
|
|
{
|
|
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
|
|
if (_selectionN == _bodyPartN) then {
|
|
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
|
|
if (_amountOf > 0) then {
|
|
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
|
|
private _postfix = ["Minor", "Medium", "Large"] select _category;
|
|
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
|
|
if (_amountOf >= 1) then {
|
|
_allInjuryTexts pushBack [format ["[B] %2x %1", _woundDescription, ceil _amountOf], [0.88,0.7,0.65,1]];
|
|
} else {
|
|
_allInjuryTexts pushBack [format ["[B] Partial %1", _woundDescription], [0.88,0.7,0.65,1]];
|
|
};
|
|
};
|
|
};
|
|
} forEach (_target getVariable [QEGVAR(medical,bandagedWounds), []]);
|
|
|
|
{
|
|
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
|
|
if (_selectionN == _bodyPartN) then {
|
|
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
|
|
if (_amountOf > 0) then {
|
|
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
|
|
private _postfix = ["Minor", "Medium", "Large"] select _category;
|
|
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
|
|
if (_amountOf >= 1) then {
|
|
_allInjuryTexts pushBack [format ["[S] %2x %1", _woundDescription, ceil _amountOf], [0.7,0.7,0.7,1]];
|
|
} else {
|
|
_allInjuryTexts pushBack [format ["[S] Partial %1", _woundDescription], [0.7,0.7,0.7,1]];
|
|
};
|
|
};
|
|
};
|
|
} forEach (_target getVariable [QEGVAR(medical,stitchedWounds), []]);
|
|
|
|
// Handle the body image coloring
|
|
private _availableSelections = [50, 51, 52, 53, 54, 55];
|
|
{
|
|
private _red = 1;
|
|
private _green = 1;
|
|
private _blue = 1;
|
|
|
|
private _torniquet = _selectionTourniquet select _forEachIndex;
|
|
if (_torniquet > 0) then {
|
|
_red = 0;
|
|
_green = 0;
|
|
_blue = 0.8;
|
|
} else {
|
|
private _bloodLoss = _selectionBloodLoss select _forEachIndex;
|
|
if (_bloodLoss > 0) then {
|
|
_green = 0 max (0.8 - _bloodLoss);
|
|
_blue = _green;
|
|
} else {
|
|
private _damage = _selectionDamage select _forEachIndex;
|
|
if (_damage > 0.1) then {
|
|
_blue = 0 max (1 - _damage);
|
|
_green = 0.5 max (1 - _damage / 2);
|
|
};
|
|
};
|
|
};
|
|
|
|
(_display displayCtrl _x) ctrlSetTextColor [_red, _green, _blue, 1.0];
|
|
} forEach _availableSelections;
|
|
|
|
private _lbCtrl = (_display displayCtrl 200);
|
|
lbClear _lbCtrl;
|
|
{
|
|
_x params ["_add", "_color"];
|
|
_lbCtrl lbAdd _add;
|
|
_lbCtrl lbSetColor [_foreachIndex, _color];
|
|
} foreach _genericMessages;
|
|
|
|
private _amountOfGeneric = count _genericMessages;
|
|
{
|
|
_x params ["_add", "_color"];
|
|
_lbCtrl lbAdd _add;
|
|
_lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _color];
|
|
} foreach _allInjuryTexts;
|
|
if (count _allInjuryTexts == 0) then {
|
|
_lbCtrl lbAdd (localize ELSTRING(medical,NoInjuriesBodypart));
|
|
};
|
|
|
|
private _logCtrl = (_display displayCtrl 302);
|
|
lbClear _logCtrl;
|
|
|
|
private _logs = _target getVariable [QGVAR(logFile_Activity), []];
|
|
{
|
|
_x params ["_message", "_moment", "_type", "_arguments"];
|
|
if (isLocalized _message) then {
|
|
_message = localize _message;
|
|
};
|
|
|
|
{
|
|
if (_x isEqualType "" && {isLocalized _x}) then {
|
|
_arguments set [_foreachIndex, localize _x];
|
|
};
|
|
} foreach _arguments;
|
|
_message = format([_message] + _arguments);
|
|
_logCtrl lbAdd format["%1 %2", _moment, _message];
|
|
} foreach _logs;
|
|
|
|
private _triageStatus = [_target] call EFUNC(medical_treatment,getTriageStatus);
|
|
(_display displayCtrl 303) ctrlSetText (_triageStatus select 0);
|
|
(_display displayCtrl 303) ctrlSetBackgroundColor (_triageStatus select 2);
|
|
|
|
}, 0, [_target, GVAR(currentSelectedSelectionN)]] call CBA_fnc_addPerFrameHandler;
|
|
|
|
} else {
|
|
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
|
|
};
|