mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixes and code review changes
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
#define DISABLE_COMPILE_CACHE
|
||||
#define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
|
||||
#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
|
||||
#define ALL_SELECTIONS ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
|
||||
#define ALL_HITPOINTS ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]
|
||||
@ -110,6 +109,10 @@
|
||||
#define TRIAGE_TEXT_COLOR_IMMEDIATE 1, 1, 1, 1
|
||||
#define TRIAGE_TEXT_COLOR_DECEASED 1, 1, 1, 1
|
||||
|
||||
// Medical activity logs
|
||||
#define MED_LOG_MAX_ENTRIES 8
|
||||
#define MED_LOG_VARNAME(type) (format [QEGVAR(medical,log_%1), type])
|
||||
|
||||
// - Unit Variables ----------------------------------------------------
|
||||
// These variables get stored in object space and used across components
|
||||
// Defined here for easy consistency with GETVAR/SETVAR (also a list for reference)
|
||||
@ -129,7 +132,6 @@
|
||||
#define VAR_IN_PAIN QEGVAR(medical,inPain)
|
||||
#define VAR_TOURNIQUET QEGVAR(medical,tourniquets)
|
||||
|
||||
|
||||
// - Unit Functions ---------------------------------------------------
|
||||
// Retrieval macros for common unit values
|
||||
// Defined for easy consistency and speed
|
||||
|
@ -53,7 +53,7 @@ if (isNull _display) then {
|
||||
|
||||
// Update activity log
|
||||
private _ctrlActivityLog = _display displayCtrl IDC_ACTIVITY;
|
||||
private _activityLog = _target getVariable [QEGVAR(medical,logFile_activity_view), []];
|
||||
private _activityLog = _target getVariable [MED_LOG_VARNAME("activity"), []];
|
||||
[_ctrlActivityLog, _activityLog] call FUNC(updateLogList);
|
||||
|
||||
// Update triage status
|
||||
|
@ -44,11 +44,11 @@ private _ctrlBodyImage = _display displayCtrl IDC_BODY_GROUP;
|
||||
|
||||
// Update activity and quick view logs
|
||||
private _ctrlActivityLog = _display displayCtrl IDC_ACTIVITY;
|
||||
private _activityLog = GVAR(target) getVariable [QEGVAR(medical,logFile_activity_view), []];
|
||||
private _activityLog = GVAR(target) getVariable [MED_LOG_VARNAME("activity"), []];
|
||||
[_ctrlActivityLog, _activityLog] call FUNC(updateLogList);
|
||||
|
||||
private _ctrlQuickView = _display displayCtrl IDC_QUICKVIEW;
|
||||
private _quickView = GVAR(target) getVariable [QEGVAR(medical,logFile_quick_view), []];
|
||||
private _quickView = GVAR(target) getVariable [MED_LOG_VARNAME("quick_view"), []];
|
||||
[_ctrlQuickView, _quickView] call FUNC(updateLogList);
|
||||
|
||||
// Update triage status
|
||||
|
@ -21,7 +21,7 @@ params ["_ctrl", "_logs"];
|
||||
lbClear _ctrl;
|
||||
|
||||
{
|
||||
_x params ["_message", "_moment", "", "_arguments"];
|
||||
_x params ["_message", "_timeStamp", "_arguments"];
|
||||
|
||||
// Localize message and arguments
|
||||
if (isLocalized _message) then {
|
||||
@ -33,5 +33,5 @@ lbClear _ctrl;
|
||||
// Format message with arguments
|
||||
_message = format ([_message] + _arguments);
|
||||
|
||||
_ctrl lbAdd format ["%1 %2", _moment, _message];
|
||||
_ctrl lbAdd format ["%1 %2", _timeStamp, _message];
|
||||
} forEach _logs;
|
||||
|
@ -582,7 +582,7 @@ class ADDON {
|
||||
timeInSystem = 1800;
|
||||
timeTillMaxEffect = 30;
|
||||
maxDose = 4;
|
||||
incompatableMedication[] = {};
|
||||
incompatibleMedication[] = {};
|
||||
viscosityChange = -10;
|
||||
};
|
||||
class Epinephrine {
|
||||
@ -593,7 +593,7 @@ class ADDON {
|
||||
timeInSystem = 120;
|
||||
timeTillMaxEffect = 10;
|
||||
maxDose = 10;
|
||||
incompatableMedication[] = {};
|
||||
incompatibleMedication[] = {};
|
||||
};
|
||||
class Adenosine {
|
||||
painReduce = 0;
|
||||
@ -603,7 +603,7 @@ class ADDON {
|
||||
timeInSystem = 120;
|
||||
timeTillMaxEffect = 15;
|
||||
maxDose = 6;
|
||||
incompatableMedication[] = {};
|
||||
incompatibleMedication[] = {};
|
||||
};
|
||||
class Atropine {
|
||||
painReduce = 0;
|
||||
@ -613,14 +613,14 @@ class ADDON {
|
||||
timeInSystem = 120;
|
||||
timeTillMaxEffect = 15;
|
||||
maxDose = 6;
|
||||
incompatableMedication[] = {};
|
||||
incompatibleMedication[] = {};
|
||||
};
|
||||
class PainKillers {
|
||||
painReduce = 0.1;
|
||||
timeInSystem = 600;
|
||||
timeTillMaxEffect = 60;
|
||||
maxDose = 10;
|
||||
incompatableMedication[] = {};
|
||||
incompatibleMedication[] = {};
|
||||
viscosityChange = 5;
|
||||
};
|
||||
};
|
||||
|
@ -27,10 +27,10 @@ if (!local _unit) exitWith {
|
||||
date params ["", "", "", "_hour", "_minute"];
|
||||
private _timeStamp = format ["%1:%2", _hour, [_minute, 2] call CBA_fnc_formatNumber];
|
||||
|
||||
private _logVarName = LOG_VARNAME(_logType);
|
||||
private _logVarName = MED_LOG_VARNAME(_logType);
|
||||
private _log = _unit getVariable [_logVarName, []];
|
||||
|
||||
if (count _log >= MAX_LOG_ENTRIES) then {
|
||||
if (count _log >= MED_LOG_MAX_ENTRIES) then {
|
||||
_log deleteAt 0;
|
||||
};
|
||||
|
||||
|
@ -33,13 +33,7 @@ isClass _config
|
||||
private _items = getArray (_config >> "items");
|
||||
_items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)}
|
||||
} && {
|
||||
private _condition = getText (_config >> "condition");
|
||||
|
||||
if (isNil _condition) then {
|
||||
_condition = compile _condition;
|
||||
} else {
|
||||
_condition = missionNamespace getVariable _condition;
|
||||
};
|
||||
GET_FUNCTION(_condition,_config >> "condition");
|
||||
|
||||
if (_condition isEqualType {}) then {
|
||||
_condition = call _condition;
|
||||
|
@ -26,32 +26,32 @@ if (alive _patient && {!([_patient, _bodyPart] call FUNC(hasTourniquetAppliedTo)
|
||||
};
|
||||
|
||||
private _bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_6);
|
||||
private _logOutPut = LSTRING(Check_Bloodpressure_NoBloodpressure);
|
||||
private _logOutput = LSTRING(Check_Bloodpressure_NoBloodpressure);
|
||||
|
||||
_bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"];
|
||||
|
||||
if (_bloodPressureHigh > 20) then {
|
||||
if (_medic call FUNC(isMedic)) then {
|
||||
_bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_1);
|
||||
_logOutPut = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow];
|
||||
_logOutput = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow];
|
||||
} else {
|
||||
if (_bloodPressureHigh > 20) then {
|
||||
_bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_2);
|
||||
_logOutPut = LSTRING(Check_Bloodpressure_Low);
|
||||
_logOutput = LSTRING(Check_Bloodpressure_Low);
|
||||
|
||||
if (_bloodPressureHigh > 100) then {
|
||||
_bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_3);
|
||||
_logOutPut = LSTRING(Check_Bloodpressure_Normal);
|
||||
_logOutput = LSTRING(Check_Bloodpressure_Normal);
|
||||
|
||||
if (_bloodPressureHigh > 160) then {
|
||||
_bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_4);
|
||||
_logOutPut = LSTRING(Check_Bloodpressure_High);
|
||||
_logOutput = LSTRING(Check_Bloodpressure_High);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[_patient, "quick_view", LSTRING(Check_Bloodpressure_Log), [_medic call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog);
|
||||
[_patient, "quick_view", LSTRING(Check_Bloodpressure_Log), [_medic call EFUNC(common,getName), _logOutput]] call FUNC(addToLog);
|
||||
|
||||
[QEGVAR(common,displayTextStructured), [[_bloodPressureOutput, _patient call EFUNC(common,getName), round _bloodPressureHigh, round _bloodPressureLow], 1.75, _medic], _medic] call CBA_fnc_targetEvent;
|
||||
|
@ -26,28 +26,28 @@ if (alive _patient && {!([_patient, _bodyPart] call FUNC(hasTourniquetAppliedTo)
|
||||
};
|
||||
|
||||
private _heartRateOutput = LSTRING(Check_Pulse_Output_5);
|
||||
private _logOutPut = LSTRING(Check_Pulse_None);
|
||||
private _logOutput = LSTRING(Check_Pulse_None);
|
||||
|
||||
if (_heartRate > 1) then {
|
||||
if (_medic call FUNC(isMedic)) then {
|
||||
_heartRateOutput = LSTRING(Check_Pulse_Output_1);
|
||||
_logOutPut = format ["%1", round _heartRate];
|
||||
_logOutput = format ["%1", round _heartRate];
|
||||
} else {
|
||||
_heartRateOutput = LSTRING(Check_Pulse_Output_2);
|
||||
_logOutPut = LSTRING(Check_Pulse_Weak);
|
||||
_logOutput = LSTRING(Check_Pulse_Weak);
|
||||
|
||||
if (_heartRate > 60) then {
|
||||
if (_heartRate > 100) then {
|
||||
_heartRateOutput = LSTRING(Check_Pulse_Output_3);
|
||||
_logOutPut = LSTRING(Check_Pulse_Strong);
|
||||
_logOutput = LSTRING(Check_Pulse_Strong);
|
||||
} else {
|
||||
_heartRateOutput = LSTRING(Check_Pulse_Output_4);
|
||||
_logOutPut = LSTRING(Check_Pulse_Normal);
|
||||
_logOutput = LSTRING(Check_Pulse_Normal);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[_patient, "quick_view", LSTRING(Check_Pulse_Log), [_medic call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog);
|
||||
[_patient, "quick_view", LSTRING(Check_Pulse_Log), [_medic call EFUNC(common,getName), _logOutput]] call FUNC(addToLog);
|
||||
|
||||
[QEGVAR(common,displayTextStructured), [[_heartRateOutput, _patient call EFUNC(common,getName), round _heartRate], 1.5, _medic], _medic] call CBA_fnc_targetEvent;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 1: Body Part <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Has Tourniquet Applied <BOOL>
|
||||
* Has Tourniquet Been Applied <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, "leftleg"] call ace_medical_treatment_fnc_hasTourniquetAppliedTo
|
||||
|
@ -63,7 +63,7 @@ private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChan
|
||||
private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow"));
|
||||
private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal"));
|
||||
private _hrIncreaseHigh = GET_ARRAY(_medicationConfig >> "hrIncreaseHigh",getArray (_defaultConfig >> "hrIncreaseHigh"));
|
||||
private _incompatableMedication = GET_ARRAY(_medicationConfig >> "incompatableMedication",getArray (_defaultConfig >> "incompatableMedication"));
|
||||
private _incompatibleMedication = GET_ARRAY(_medicationConfig >> "incompatibleMedication",getArray (_defaultConfig >> "incompatibleMedication"));
|
||||
|
||||
private _heartRate = GET_HEART_RATE(_patient);
|
||||
private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNormal, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55));
|
||||
@ -75,4 +75,4 @@ TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange);
|
||||
[_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment);
|
||||
|
||||
// Check for medication compatiblity
|
||||
[_patient, _className, _maxDose, _incompatableMedication] call FUNC(onMedicationUsage);
|
||||
[_patient, _className, _maxDose, _incompatibleMedication] call FUNC(onMedicationUsage);
|
||||
|
@ -18,8 +18,8 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_target", "_className", "_maxDosage", "_incompatabileMeds"];
|
||||
TRACE_4("onMedicationUsage",_target,_className,_maxDosage,_incompatabileMeds);
|
||||
params ["_target", "_className", "_maxDosage", "_incompatibleMedication"];
|
||||
TRACE_4("onMedicationUsage",_target,_className,_maxDosage,_incompatibleMedication);
|
||||
|
||||
private _fnc_getMedicationCount = {
|
||||
params ["_target", "_medication"];
|
||||
@ -51,9 +51,9 @@ if (_currentDose >= floor (_maxDosage + round(random(2))) && {_maxDosage >= 1})
|
||||
if (_inSystem> _xLimit) then {
|
||||
_overdosedMedications pushBackUnique _xMed;
|
||||
};
|
||||
} forEach _incompatabileMeds;
|
||||
} forEach _incompatibleMedication;
|
||||
|
||||
if ((count _overdosedMedications) > 0) then {
|
||||
if !(_overdosedMedications isEqualTo []) then {
|
||||
private _medicationConfig = (configFile >> "ace_medical_treatment" >> "Medication");
|
||||
private _onOverDose = getText (_medicationConfig >> "onOverDose");
|
||||
if (isClass (_medicationConfig >> _className)) then {
|
||||
|
@ -30,23 +30,16 @@ if !(_this call FUNC(canTreat)) exitWith {false};
|
||||
private _config = configFile >> QGVAR(actions) >> _classname;
|
||||
|
||||
// Get treatment time from config, exit if treatment time is zero
|
||||
// Supports number config entries and string entries of code or missionNamespace variables
|
||||
private _treatmentTime = 0;
|
||||
|
||||
if (isText (_config >> "treatmentTime")) then {
|
||||
_treatmentTime = getText (_config >> "treatmentTime");
|
||||
|
||||
if (isNil _treatmentTime) then {
|
||||
_treatmentTime = compile _treatmentTime;
|
||||
} else {
|
||||
_treatmentTime = missionNamespace getVariable _treatmentTime;
|
||||
};
|
||||
private _treatmentTime = if (isText (_config >> "treatmentTime")) then {
|
||||
GET_FUNCTION(_treatmentTime,_config >> "treatmentTime");
|
||||
|
||||
if (_treatmentTime isEqualType {}) then {
|
||||
_treatmentTime = call _treatmentTime;
|
||||
};
|
||||
|
||||
_treatmentTime
|
||||
} else {
|
||||
_treatmentTime = getNumber (_config >> "treatmentTime");
|
||||
getNumber (_config >> "treatmentTime");
|
||||
};
|
||||
|
||||
if (_treatmentTime == 0) exitWith {false};
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
// Returns a text config entry as compiled code or variable from missionNamespace
|
||||
#define GET_FUNCTION(var,cfg) \
|
||||
private var = getText (cfg); \
|
||||
if (isNil var) then { \
|
||||
@ -46,6 +47,3 @@
|
||||
#define TREATMENT_LOCATIONS_ALL 4
|
||||
|
||||
#define LITTER_CLEANUP_CHECK_DELAY 30
|
||||
|
||||
#define MAX_LOG_ENTRIES 8
|
||||
#define LOG_VARNAME(type) (format [QEGVAR(medical,log_%1), type])
|
||||
|
Reference in New Issue
Block a user