mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Change clean up medical code
This commit is contained in:
parent
73bd684b65
commit
8e59993d7a
@ -14,17 +14,16 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_bloodPressure", "_logOutPut", "_output"];
|
||||
params ["_caller", "_target", "_selectionName"];
|
||||
|
||||
_bloodPressure = if (!alive _target) then {
|
||||
private _bloodPressure = if (!alive _target) then {
|
||||
[0,0]
|
||||
} else {
|
||||
[_target] call FUNC(getBloodPressure)
|
||||
};
|
||||
_bloodPressure params [ "_bloodPressureLow", "_bloodPressureHigh"];
|
||||
_output = "";
|
||||
_logOutPut = "";
|
||||
private _output = "";
|
||||
private _logOutPut = "";
|
||||
if ([_caller] call FUNC(isMedic)) then {
|
||||
_output = LSTRING(Check_Bloodpressure_Output_1);
|
||||
_logOutPut = format["%1/%2",round(_bloodPressureHigh),round(_bloodPressureLow)];
|
||||
|
@ -14,15 +14,14 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_heartRateOutput", "_heartRate", "_logOutPut"];
|
||||
params ["_caller", "_unit", "_selectionName"];
|
||||
|
||||
_heartRate = _unit getVariable [QGVAR(heartRate), 80];
|
||||
private _heartRate = _unit getVariable [QGVAR(heartRate), 80];
|
||||
if (!alive _unit) then {
|
||||
_heartRate = 0;
|
||||
};
|
||||
_heartRateOutput = LSTRING(Check_Pulse_Output_5);
|
||||
_logOutPut = LSTRING(Check_Pulse_None);
|
||||
private _heartRateOutput = LSTRING(Check_Pulse_Output_5);
|
||||
private _logOutPut = LSTRING(Check_Pulse_None);
|
||||
|
||||
if (_heartRate > 1.0) then {
|
||||
if ([_caller] call FUNC(isMedic)) then {
|
||||
|
@ -14,12 +14,11 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_output"];
|
||||
params ["_caller", "_target"];
|
||||
|
||||
_output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsive)] select ([_target] call EFUNC(common,isAwake));
|
||||
private _output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsive)] select ([_target] call EFUNC(common,isAwake));
|
||||
|
||||
[QEGVAR(common,displayTextStructured), [[_output, [_target] call EFUNC(common,getName)], 2, _caller], [_caller]] call CBA_fnc_targetEvent;
|
||||
|
||||
[_target,"activity",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target,"quick_view",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target ,"activity", _output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target, "quick_view", _output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
@ -17,14 +17,14 @@
|
||||
private "_genericMessages";
|
||||
params ["_caller", "_target"];
|
||||
|
||||
_genericMessages = [LSTRING(diagnoseMessage)];
|
||||
private _genericMessages = [LSTRING(diagnoseMessage), [_target] call EFUNC(common,getName)];
|
||||
|
||||
_genericMessages pushBack ([_target] call EFUNC(common,getName));
|
||||
if (alive _target) then {
|
||||
_genericMessages pushBack LSTRING(diagnoseAlive);
|
||||
} else {
|
||||
_genericMessages pushBack LSTRING(diagnoseDead);
|
||||
};
|
||||
|
||||
if (_target getVariable[QGVAR(hasLostBlood), 0] > 0) then {
|
||||
if (_target getVariable[QGVAR(hasLostBlood), 0] > 1) then {
|
||||
_genericMessages pushBack LSTRING(lostBloodALot);
|
||||
|
@ -15,11 +15,10 @@
|
||||
#include "script_component.hpp"
|
||||
params ["_vehicle", "_player", "_parameters"];
|
||||
|
||||
private ["_actions", "_unit"];
|
||||
_actions = [];
|
||||
private _actions = [];
|
||||
|
||||
{
|
||||
_unit = _x;
|
||||
private _unit = _x;
|
||||
if (_unit != _player && {(alive _unit) && {_unit getVariable ["ACE_isUnconscious", false]}}) then {
|
||||
_actions pushBack
|
||||
[
|
||||
|
@ -14,12 +14,11 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_accessLevel", "_return"];
|
||||
params ["_caller", "_target"];
|
||||
|
||||
_accessLevel = _target getVariable [QGVAR(allowSharedEquipmentAccess), -1];
|
||||
private _accessLevel = _target getVariable [QGVAR(allowSharedEquipmentAccess), -1];
|
||||
|
||||
_return = false;
|
||||
private _return = false;
|
||||
|
||||
if (_accessLevel >= 0) then {
|
||||
if (_accessLevel == 0) exitWith { _return = true; };
|
||||
|
@ -19,20 +19,18 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"];
|
||||
params ["_caller", "_target", "_selectionName", "_className"];
|
||||
|
||||
if !(_target isKindOf "CAManBase") exitWith { false };
|
||||
|
||||
|
||||
_config = (ConfigFile >> "ACE_Medical_Actions" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className);
|
||||
private _config = (ConfigFile >> "ACE_Medical_Actions" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className);
|
||||
|
||||
if !(isClass _config) exitwith {false};
|
||||
|
||||
// Allow self treatment check
|
||||
if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false};
|
||||
|
||||
_medicRequired = if (isNumber (_config >> "requiredMedic")) then {
|
||||
private _medicRequired = if (isNumber (_config >> "requiredMedic")) then {
|
||||
getNumber (_config >> "requiredMedic");
|
||||
} else {
|
||||
// Check for required class
|
||||
@ -43,15 +41,15 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then {
|
||||
};
|
||||
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith { false };
|
||||
|
||||
_items = getArray (_config >> "items");
|
||||
private _items = getArray (_config >> "items");
|
||||
if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith { false };
|
||||
|
||||
_allowedSelections = getArray (_config >> "allowedSelections");
|
||||
private _allowedSelections = getArray (_config >> "allowedSelections");
|
||||
if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith { false };
|
||||
|
||||
_return = true;
|
||||
private _return = true;
|
||||
if (getText (_config >> "condition") != "") then {
|
||||
_condition = getText (_config >> "condition");
|
||||
private _condition = getText (_config >> "condition");
|
||||
if (isnil _condition) then {
|
||||
_condition = compile _condition;
|
||||
} else {
|
||||
@ -65,27 +63,25 @@ if (getText (_config >> "condition") != "") then {
|
||||
};
|
||||
if (!_return) exitwith { false };
|
||||
|
||||
_patientStateCondition = if (isText(_config >> "patientStateCondition")) then {
|
||||
private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then {
|
||||
missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0]
|
||||
} else {
|
||||
getNumber(_config >> "patientStateCondition")
|
||||
};
|
||||
if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false};
|
||||
|
||||
_locations = getArray (_config >> "treatmentLocations");
|
||||
private _locations = getArray (_config >> "treatmentLocations");
|
||||
if ("All" in _locations) exitwith { true };
|
||||
|
||||
private [ "_medFacility", "_medVeh"];
|
||||
_medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))};
|
||||
_medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))};
|
||||
private _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))};
|
||||
private _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))};
|
||||
|
||||
{
|
||||
if (_x == "field") exitwith {_return = true;};
|
||||
if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;};
|
||||
if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;};
|
||||
if !(isnil _x) exitwith {
|
||||
private "_val";
|
||||
_val = missionNamespace getVariable _x;
|
||||
private _val = missionNamespace getVariable _x;
|
||||
if (_val isEqualType 0) then {
|
||||
_return = switch (_val) do {
|
||||
case 0: {true}; //AdvancedMedicalSettings_anywhere
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
// Exit for basic medical
|
||||
if (GVAR(level) < 2) exitWith {};
|
||||
private ["_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"];
|
||||
|
||||
params ["_target", ["_show", true], ["_selectionN", 0]];
|
||||
|
||||
GVAR(currentSelectedSelectionN) = [0, _selectionN] select (IS_SCALAR(_selectionN));
|
||||
@ -46,16 +46,16 @@ if (_show) then {
|
||||
};
|
||||
|
||||
disableSerialization;
|
||||
_display = uiNamespace getVariable QGVAR(DisplayInformation);
|
||||
private _display = uiNamespace getVariable QGVAR(DisplayInformation);
|
||||
if (isnil "_display") exitwith {
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_allInjuryTexts = [];
|
||||
_genericMessages = [];
|
||||
private _allInjuryTexts = [];
|
||||
private _genericMessages = [];
|
||||
|
||||
if (GVAR(level) >= 2 && {([_unit] call FUNC(hasMedicalEnabled))}) then {
|
||||
_partText = [LSTRING(Head), LSTRING(Torso), LSTRING(LeftArm) ,LSTRING(RightArm) ,LSTRING(LeftLeg), LSTRING(RightLeg)] select _selectionN;
|
||||
private _partText = [LSTRING(Head), LSTRING(Torso), LSTRING(LeftArm) ,LSTRING(RightArm) ,LSTRING(LeftLeg), LSTRING(RightLeg)] select _selectionN;
|
||||
_genericMessages pushback [localize _partText, [1, 1, 1, 1]];
|
||||
};
|
||||
|
||||
@ -73,10 +73,9 @@ if (_show) then {
|
||||
_genericMessages pushback [localize LSTRING(Status_Pain), [1, 1, 1, 1]];
|
||||
};
|
||||
|
||||
_totalIvVolume = 0;
|
||||
private _totalIvVolume = 0;
|
||||
{
|
||||
private "_value";
|
||||
_value = _target getVariable _x;
|
||||
private _value = _target getVariable _x;
|
||||
if !(isnil "_value") then {
|
||||
_totalIvVolume = _totalIvVolume + (_target getVariable [_x, 0]);
|
||||
};
|
||||
@ -85,16 +84,15 @@ if (_show) then {
|
||||
_genericMessages pushback [format[localize LSTRING(receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]];
|
||||
};
|
||||
|
||||
_damaged = [false, false, false, false, false, false];
|
||||
_selectionBloodLoss = [0,0,0,0,0,0];
|
||||
private _damaged = [false, false, false, false, false, false];
|
||||
private _selectionBloodLoss = [0,0,0,0,0,0];
|
||||
if (GVAR(level) >= 2 && {([_target] call FUNC(hasMedicalEnabled))}) then {
|
||||
_openWounds = _target getVariable [QGVAR(openWounds), []];
|
||||
private "_amountOf";
|
||||
private _openWounds = _target getVariable [QGVAR(openWounds), []];
|
||||
{
|
||||
_x params ["", "_x1", "_selectionX", "_amountOf", "_x4"];
|
||||
// Find how much this bodypart is bleeding
|
||||
if (_amountOf > 0) then {
|
||||
_damaged set[_selectionX, true];
|
||||
_damaged set [_selectionX, true];
|
||||
_selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))];
|
||||
|
||||
if (_selectionN == _selectionX) then {
|
||||
@ -110,7 +108,7 @@ if (_show) then {
|
||||
};
|
||||
} foreach _openWounds;
|
||||
|
||||
_bandagedwounds = _target getVariable [QGVAR(bandagedWounds), []];
|
||||
private _bandagedwounds = _target getVariable [QGVAR(bandagedWounds), []];
|
||||
{
|
||||
_x params ["", "", "_selectionX", "_amountOf", "_x4"];
|
||||
// Find how much this bodypart is bleeding
|
||||
@ -131,18 +129,18 @@ if (_show) then {
|
||||
};
|
||||
} foreach _bandagedwounds;
|
||||
} else {
|
||||
_damaged = [true, true, true, true, true, true];
|
||||
private _damaged = [true, true, true, true, true, true];
|
||||
{
|
||||
private _hitPoint = [_target, _x, true] call FUNC(translateSelections);
|
||||
_selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _hitPoint];
|
||||
if (_target getHitPointDamage _hitPoint > 0 && {_forEachIndex == _selectionN}) then {
|
||||
_pointDamage = _target getHitPointDamage _hitPoint;
|
||||
_severity = switch (true) do {
|
||||
private _pointDamage = _target getHitPointDamage _hitPoint;
|
||||
private _severity = switch (true) do {
|
||||
case (_pointDamage > 0.5): {localize LSTRING(HeavilyWounded)};
|
||||
case (_pointDamage > 0.1): {localize LSTRING(LightlyWounded)};
|
||||
default {localize LSTRING(VeryLightlyWounded)};
|
||||
};
|
||||
_part = localize ([
|
||||
private _part = localize ([
|
||||
LSTRING(Head),
|
||||
LSTRING(Torso),
|
||||
LSTRING(LeftArm),
|
||||
@ -157,14 +155,13 @@ if (_show) then {
|
||||
|
||||
// Handle the body image coloring
|
||||
|
||||
_availableSelections = [50,51,52,53,54,55];
|
||||
private _availableSelections = [50,51,52,53,54,55];
|
||||
{
|
||||
private ["_red", "_green", "_blue", "_total"];
|
||||
_total = _x;
|
||||
private _total = _x;
|
||||
private _red = 1;
|
||||
private _green = 1;
|
||||
private _blue = 1;
|
||||
|
||||
_red = 1;
|
||||
_green = 1;
|
||||
_blue = 1;
|
||||
if (_total > 0) then {
|
||||
if (_damaged select _forEachIndex) then {
|
||||
_green = (0.9 - _total) max 0;
|
||||
@ -178,7 +175,7 @@ if (_show) then {
|
||||
(_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0];
|
||||
} foreach _selectionBloodLoss;
|
||||
|
||||
_lbCtrl = (_display displayCtrl 200);
|
||||
private _lbCtrl = (_display displayCtrl 200);
|
||||
lbClear _lbCtrl;
|
||||
{
|
||||
_x params ["_add", "_color"];
|
||||
@ -186,7 +183,7 @@ if (_show) then {
|
||||
_lbCtrl lbSetColor [_foreachIndex, _color];
|
||||
} foreach _genericMessages;
|
||||
|
||||
_amountOfGeneric = count _genericMessages;
|
||||
private _amountOfGeneric = count _genericMessages;
|
||||
{
|
||||
_x params ["_add", "_color"];
|
||||
_lbCtrl lbAdd _add;
|
||||
@ -196,13 +193,11 @@ if (_show) then {
|
||||
_lbCtrl lbAdd (localize LSTRING(NoInjuriesBodypart));
|
||||
};
|
||||
|
||||
_logCtrl = (_display displayCtrl 302);
|
||||
private _logCtrl = (_display displayCtrl 302);
|
||||
lbClear _logCtrl;
|
||||
|
||||
private ["_logs", "_message", "_moment", "_arguments", "_lbCtrl"];
|
||||
_logs = _target getVariable [QGVAR(logFile_Activity), []];
|
||||
private _logs = _target getVariable [QGVAR(logFile_Activity), []];
|
||||
{
|
||||
// [_message,_moment,_type, _arguments]
|
||||
_x params ["_message", "_moment", "_type", "_arguments"];
|
||||
if (isLocalized _message) then {
|
||||
_message = localize _message;
|
||||
@ -217,7 +212,7 @@ if (_show) then {
|
||||
_logCtrl lbAdd format["%1 %2", _moment, _message];
|
||||
} foreach _logs;
|
||||
|
||||
_triageStatus = [_target] call FUNC(getTriageStatus);
|
||||
private _triageStatus = [_target] call FUNC(getTriageStatus);
|
||||
(_display displayCtrl 303) ctrlSetText (_triageStatus select 0);
|
||||
(_display displayCtrl 303) ctrlSetBackgroundColor (_triageStatus select 2);
|
||||
|
||||
|
@ -13,14 +13,13 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_return"];
|
||||
params ["_unit"];
|
||||
|
||||
if (isnil QGVAR(unconsciousConditions)) then {
|
||||
GVAR(unconsciousConditions) = [];
|
||||
};
|
||||
|
||||
_return = false;
|
||||
private _return = false;
|
||||
{
|
||||
if ((_x isEqualType {}) && {([_unit] call _x)}) exitwith {
|
||||
_return = true;
|
||||
|
@ -21,16 +21,16 @@
|
||||
private ["_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"];
|
||||
params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"];
|
||||
|
||||
_classID = _injury select 1;
|
||||
_className = GVAR(woundClassNames) select _classID;
|
||||
private _classID = _injury select 1;
|
||||
private _className = GVAR(woundClassNames) select _classID;
|
||||
|
||||
// default, just in case..
|
||||
_reopeningChance = 0.1;
|
||||
_reopeningMinDelay = 120;
|
||||
_reopeningMaxDelay = 200;
|
||||
private _reopeningChance = 0.1;
|
||||
private _reopeningMinDelay = 120;
|
||||
private _reopeningMaxDelay = 200;
|
||||
|
||||
// Get the default values for the used bandage
|
||||
_config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging");
|
||||
private _config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging");
|
||||
if (isClass (_config >> _bandage)) then {
|
||||
_config = (_config >> _bandage);
|
||||
_reopeningChance = getNumber (_config >> "reopeningChance");
|
||||
@ -41,7 +41,7 @@ if (isClass (_config >> _bandage)) then {
|
||||
};
|
||||
|
||||
if (isClass (_config >> _className)) then {
|
||||
_woundTreatmentConfig = (_config >> _className);
|
||||
private _woundTreatmentConfig = (_config >> _className);
|
||||
if (isNumber (_woundTreatmentConfig >> "reopeningChance")) then {
|
||||
_reopeningChance = getNumber (_woundTreatmentConfig >> "reopeningChance");
|
||||
};
|
||||
@ -56,10 +56,10 @@ if (isClass (_config >> _className)) then {
|
||||
};
|
||||
TRACE_5("configs",_bandage,_className,_reopeningChance,_reopeningMinDelay,_reopeningMaxDelay);
|
||||
|
||||
_bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];
|
||||
_injuryType = _injury select 1;
|
||||
_exist = false;
|
||||
_bandagedInjury = [];
|
||||
private _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];
|
||||
private _injuryType = _injury select 1;
|
||||
private _exist = false;
|
||||
private _bandagedInjury = [];
|
||||
{
|
||||
if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith {
|
||||
_exist = true;
|
||||
@ -85,19 +85,18 @@ if (random(1) <= _reopeningChance) then {
|
||||
_delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay);
|
||||
TRACE_1("Will open",_delay);
|
||||
[{
|
||||
private ["_bandage", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"];
|
||||
params ["_target", "_impact", "_part", "_injuryIndex", "_injury"];
|
||||
TRACE_5("params",_target,_impact,_part,_injuryIndex,_injury);
|
||||
|
||||
//if (alive _target) then {
|
||||
_openWounds = _target getVariable [QGVAR(openWounds), []];
|
||||
if ((count _openWounds)-1 < _injuryIndex) exitwith {};
|
||||
_selectedInjury = _openWounds select _injuryIndex;
|
||||
private _openWounds = _target getVariable [QGVAR(openWounds), []];
|
||||
if ((count _openWounds) - 1 < _injuryIndex) exitwith {};
|
||||
private _selectedInjury = _openWounds select _injuryIndex;
|
||||
if (_selectedInjury select 1 == _injury select 1 && (_selectedInjury select 2) == (_injury select 2)) then { // matching the IDs
|
||||
|
||||
_bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];
|
||||
_exist = false;
|
||||
_injuryId = _injury select 1;
|
||||
private _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];
|
||||
private _exist = false;
|
||||
private _injuryId = _injury select 1;
|
||||
{
|
||||
if ((_x select 1) == _injuryId && (_x select 2) == (_injury select 2)) exitwith {
|
||||
_exist = true;
|
||||
|
Loading…
Reference in New Issue
Block a user