diff --git a/addons/medical/script_macros_medical.hpp b/addons/medical/script_macros_medical.hpp index d9881ab1b5..be52b768cf 100644 --- a/addons/medical/script_macros_medical.hpp +++ b/addons/medical/script_macros_medical.hpp @@ -1,8 +1,6 @@ #define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"] -#define CUR_LEVEL (["Basic", "Advanced"] select (EGVAR(medical,level) >= 2)) - // scale received pain to 0-2 level to select type of scream // below 0.25: 0, from 0.25 to 0.5: 1, more than 0.5: 2 #define PAIN_TO_SCREAM(pain) (floor (4 * pain) min 2) diff --git a/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf b/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf index 9124b19e84..d31b8fbe18 100644 --- a/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf @@ -15,10 +15,8 @@ * * Public: No */ - #include "script_component.hpp" -private ["_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"]; params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"]; private _classID = _injury select 1; @@ -30,9 +28,10 @@ private _reopeningMinDelay = 120; private _reopeningMaxDelay = 200; // Get the default values for the used bandage -private _config = (ConfigFile >> "ace_medical_treatment" >> "Bandaging"); +private _config = configFile >> QUOTE(ADDON) >> "Bandaging"; + if (isClass (_config >> _bandage)) then { - _config = (_config >> _bandage); + _config = _config >> _bandage; _reopeningChance = getNumber (_config >> "reopeningChance"); _reopeningMinDelay = getNumber (_config >> "reopeningMinDelay"); _reopeningMaxDelay = getNumber (_config >> "reopeningMaxDelay") max _reopeningMinDelay; @@ -41,13 +40,16 @@ if (isClass (_config >> _bandage)) then { }; if (isClass (_config >> _className)) then { - private _woundTreatmentConfig = (_config >> _className); + private _woundTreatmentConfig = _config >> _className; + if (isNumber (_woundTreatmentConfig >> "reopeningChance")) then { _reopeningChance = getNumber (_woundTreatmentConfig >> "reopeningChance"); }; + if (isNumber (_woundTreatmentConfig >> "reopeningMinDelay")) then { _reopeningMinDelay = getNumber (_woundTreatmentConfig >> "reopeningMinDelay"); }; + if (isNumber (_woundTreatmentConfig >> "reopeningMaxDelay")) then { _reopeningMaxDelay = getNumber (_woundTreatmentConfig >> "reopeningMaxDelay") max _reopeningMinDelay; }; @@ -61,28 +63,28 @@ private _injuryType = _injury select 1; private _exist = false; private _bandagedInjury = []; { - if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith { + if (_x select 1 == _injuryType && {_x select 2 == _injury select 2}) exitWith { _exist = true; - _existingInjury = _x; + private _existingInjury = _x; _existingInjury set [3, (_existingInjury select 3) + _impact]; - _bandagedWounds set [_foreachIndex, _existingInjury]; + _bandagedWounds set [_forEachIndex, _existingInjury]; _bandagedInjury = _existingInjury; }; -} foreach _bandagedWounds; +} forEach _bandagedWounds; if !(_exist) then { // [ID, classID, bodypart, percentage treated, bloodloss rate] _bandagedInjury = [_injury select 0, _injury select 1, _injury select 2, _impact, _injury select 4]; - _bandagedWounds pushback _bandagedInjury; + _bandagedWounds pushBack _bandagedInjury; }; _target setVariable [QEGVAR(medical,bandagedWounds), _bandagedWounds, true]; TRACE_1("",_reopeningChance); // Check if we are ever going to reopen this -if (random(1) <= _reopeningChance) then { - _delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay); +if (random 1 <= _reopeningChance) then { + private _delay = _reopeningMinDelay + random (_reopeningMaxDelay - _reopeningMinDelay); TRACE_1("Will open",_delay); [{ params ["_target", "_impact", "_part", "_injuryIndex", "_injury"]; @@ -90,21 +92,21 @@ if (random(1) <= _reopeningChance) then { //if (alive _target) then { private _openWounds = _target getVariable [QEGVAR(medical,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 + 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 private _bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), []]; private _exist = false; private _injuryId = _injury select 1; { - if ((_x select 1) == _injuryId && (_x select 2) == (_injury select 2)) exitwith { + if (_x select 1 == _injuryId && {_x select 2 == _injury select 2}) exitWith { _exist = true; - _existingInjury = _x; + private _existingInjury = _x; _existingInjury set [3, ((_existingInjury select 3) - _impact) max 0]; - _bandagedWounds set [_foreachIndex, _existingInjury]; + _bandagedWounds set [_forEachIndex, _existingInjury]; }; - } foreach _bandagedWounds; + } forEach _bandagedWounds; if (_exist) then { TRACE_2("Reopening Wound",_bandagedWounds,_openWounds); @@ -115,6 +117,6 @@ if (random(1) <= _reopeningChance) then { }; }; // Otherwise something went wrong, we we don't reopen them.. - //}; + //}; }, [_target, _impact, _part, _injuryIndex, +_injury], _delay] call CBA_fnc_waitAndExecute; }; diff --git a/addons/medical_treatment/functions/fnc_litterCreate.sqf b/addons/medical_treatment/functions/fnc_litterCreate.sqf index ca1f59950a..72a5d0c0c1 100644 --- a/addons/medical_treatment/functions/fnc_litterCreate.sqf +++ b/addons/medical_treatment/functions/fnc_litterCreate.sqf @@ -32,7 +32,7 @@ if !(EGVAR(medical,allowLitterCreation)) exitWith {}; // Don't create litter if medic or patient are inside a vehicle if (vehicle _caller != _caller || {vehicle _target != _target}) exitWith {}; -private _config = configFile >> "ACE_Medical_Treatment_Actions" >> CUR_LEVEL >> _className; +private _config = configFile >> QGVAR(Actions) >> _className; if !(isClass _config) exitWith {TRACE_1("No action config",_className);}; if !(isArray (_config >> "litter")) exitWith {TRACE_1("No litter config",_className);}; diff --git a/addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf index 41c9e0d56e..22955ffcdb 100644 --- a/addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf @@ -25,7 +25,7 @@ private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []]; if (count _openWounds == 0) exitWith {false}; // nothing to do here! // Get the default effectiveness for the used bandage -private _config = configFile >> "ace_medical_treatment" >> "Bandaging"; +private _config = configFile >> QUOTE(ADDON) >> "Bandaging"; private _effectiveness = getNumber (_config >> "effectiveness"); if (isClass (_config >> _bandage)) then { diff --git a/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf index faa87fbafb..6dec85c99d 100644 --- a/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf @@ -54,7 +54,7 @@ private _currentInSystem = _target getVariable [_varName, 0]; _target setVariable [_varName, _currentInSystem + 1]; // Find the proper attributes for the used medication -private _medicationConfig = configFile >> "ace_medical_treatment" >> "Medication"; +private _medicationConfig = configFile >> QUOTE(ADDON) >> "Medication"; private _painReduce = getNumber (_medicationConfig >> "painReduce"); private _hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow"); private _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal");