From 27314c34b193c5e4aae2b5a4e27d19cdaf381288 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 18 Sep 2016 22:58:56 +0200 Subject: [PATCH] fix treatment functionality --- addons/medical/ACE_Medical_Injuries.hpp | 2 +- addons/medical_damage/XEH_preInit.sqf | 4 ++-- addons/medical_damage/functions/fnc_woundsHandler.sqf | 2 ++ .../medical_damage/functions/fnc_woundsHandlerSqf.sqf | 3 ++- addons/medical_menu/functions/fnc_updateUIInfo.sqf | 2 +- addons/medical_treatment/functions/fnc_canTreat.sqf | 11 +++++++---- addons/medical_treatment/functions/fnc_checkItems.sqf | 4 ++-- addons/medical_treatment/functions/fnc_treatment.sqf | 6 +++--- .../functions/fnc_treatment_failure.sqf | 6 +++--- .../functions/fnc_treatment_success.sqf | 6 +++--- 10 files changed, 26 insertions(+), 20 deletions(-) diff --git a/addons/medical/ACE_Medical_Injuries.hpp b/addons/medical/ACE_Medical_Injuries.hpp index 72e3336148..e344823d32 100644 --- a/addons/medical/ACE_Medical_Injuries.hpp +++ b/addons/medical/ACE_Medical_Injuries.hpp @@ -214,7 +214,7 @@ class ACE_Medical_Injuries { class fractures { class Femur { name = CSTRING(Wounds_Femur); - selections[] = {"Head", "Torso"}; + selections[] = {"Head", "Body"}; pain = 0.2; causes[] = {"Bullet", "VehicleCrash", "Backblast", "Explosive", "Shell", "Grenade"}; minDamage = 0.5; diff --git a/addons/medical_damage/XEH_preInit.sqf b/addons/medical_damage/XEH_preInit.sqf index ace0aeb4fb..97926965c7 100644 --- a/addons/medical_damage/XEH_preInit.sqf +++ b/addons/medical_damage/XEH_preInit.sqf @@ -7,9 +7,9 @@ ADDON = false; [QEGVAR(medical_engine,woundReceived), { params ["_unit", "_woundedHitPoint", "_receivedDamage", "", "_ammo"]; - private _selectionName = EGVAR(medical,SELECTIONS) param [EGVAR(medical,HITPOINTS) find _woundedHitPoint]; // @todo + // private _selectionName = EGVAR(medical,SELECTIONS) select (EGVAR(medical,HITPOINTS) find _woundedHitPoint); // @todo private _typeOfDamage = _ammo call FUNC(getTypeOfDamage); - [_unit, _selectionName, _receivedDamage, _ammo, _typeOfDamage] call FUNC(woundsHandler); // TODO also support the sqf variant + [_unit, _woundedHitPoint, _receivedDamage, _ammo, _typeOfDamage] call FUNC(woundsHandler); // TODO also support the sqf variant [_unit, EGVAR(medical,STATE_MACHINE)] call EFUNC(medical,addStateHandler); }] call CBA_fnc_addEventHandler; diff --git a/addons/medical_damage/functions/fnc_woundsHandler.sqf b/addons/medical_damage/functions/fnc_woundsHandler.sqf index 0964a4d6a9..4eeee8f5ee 100644 --- a/addons/medical_damage/functions/fnc_woundsHandler.sqf +++ b/addons/medical_damage/functions/fnc_woundsHandler.sqf @@ -20,6 +20,8 @@ params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; TRACE_6("ACE_DEBUG: woundshandler",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); +systemChat format["input: %1", _this]; + if (_typeOfDamage == "") then {_typeOfDamage = "unknown";}; // Administration for open wounds and ids diff --git a/addons/medical_damage/functions/fnc_woundsHandlerSqf.sqf b/addons/medical_damage/functions/fnc_woundsHandlerSqf.sqf index cc3d55e498..693730e353 100644 --- a/addons/medical_damage/functions/fnc_woundsHandlerSqf.sqf +++ b/addons/medical_damage/functions/fnc_woundsHandlerSqf.sqf @@ -21,8 +21,9 @@ private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPoss params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); +systemChat format["input: %1", _this]; // Convert the selectionName to a number and ensure it is a valid selection. -_bodyPartn = [_selectionName] call EFUNC(medical,selectionNameToNumber); +_bodyPartn = EGVAR(medical,HITPOINTS) find _selectionName; //[_selectionName] call EFUNC(medical,selectionNameToNumber); if (_bodyPartn < 0) exitWith {}; if (_typeOfDamage == "") then {_typeOfDamage = "unknown";}; diff --git a/addons/medical_menu/functions/fnc_updateUIInfo.sqf b/addons/medical_menu/functions/fnc_updateUIInfo.sqf index 03506821cd..2b92d9f3a7 100644 --- a/addons/medical_menu/functions/fnc_updateUIInfo.sqf +++ b/addons/medical_menu/functions/fnc_updateUIInfo.sqf @@ -60,7 +60,7 @@ _damaged = [false, false, false, false, false, false]; _selectionBloodLoss = [0, 0, 0, 0, 0, 0]; _allInjuryTexts = []; -if ((EGVAR(medical,level) >= 2) ) then { // && {([_target] call EFUNC(medical,hasMedicalEnabled))} +if (EGVAR(medical,level) >= 2) then { // && {([_target] call EFUNC(medical,hasMedicalEnabled))} _openWounds = _target getVariable [QEGVAR(medical,openWounds), []]; private "_amountOf"; { diff --git a/addons/medical_treatment/functions/fnc_canTreat.sqf b/addons/medical_treatment/functions/fnc_canTreat.sqf index f7b6353fe8..4625a554c0 100644 --- a/addons/medical_treatment/functions/fnc_canTreat.sqf +++ b/addons/medical_treatment/functions/fnc_canTreat.sqf @@ -12,7 +12,7 @@ * Can Treat * * Example: - * [player, cursorTarget, "Head", "SurgicalKit"] call ace_medical_fnc_canTreat + * [player, cursorTarget, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreat * * Public: Yes */ @@ -23,7 +23,7 @@ params ["_caller", "_target", "_selectionName", "_className"]; if !(_target isKindOf "CAManBase") exitWith { false }; -private _config = (ConfigFile >> "ACE_Medical_Treatment" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className); +private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> (["Basic", "Advanced"] select (EGVAR(medical,level)>=2)) >> _className); if !(isClass _config) exitwith {false}; @@ -35,10 +35,11 @@ private _medicRequired = if (isNumber (_config >> "requiredMedic")) then { } else { // Check for required class if (isText (_config >> "requiredMedic")) exitwith { - missionNamespace getVariable [(getText (_config >> "requiredMedic")), 0] + missionNamespace getVariable [getText (_config >> "requiredMedic"), 0]; }; 0; }; + if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitwith { false }; private _items = getArray (_config >> "items"); @@ -61,7 +62,9 @@ if (getText (_config >> "condition") != "") then { _return = [_caller, _target, _selectionName, _className] call _condition; }; }; -if (!_return) exitwith { false }; +if (!_return) exitwith { + false; +}; private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] diff --git a/addons/medical_treatment/functions/fnc_checkItems.sqf b/addons/medical_treatment/functions/fnc_checkItems.sqf index d49e04e774..5781dd0c98 100644 --- a/addons/medical_treatment/functions/fnc_checkItems.sqf +++ b/addons/medical_treatment/functions/fnc_checkItems.sqf @@ -17,7 +17,7 @@ params ["_unit"]; while {({_x == "FirstAidKit"} count items _unit) > 0} do { _unit removeItem "FirstAidKit"; - if (GVAR(level) >= 2) then { + if (EGVAR(medical,level) >= 2) then { _unit addItem "ACE_fieldDressing"; _unit addItem "ACE_packingBandage"; _unit addItem "ACE_morphine"; @@ -31,7 +31,7 @@ while {({_x == "FirstAidKit"} count items _unit) > 0} do { while {({_x == "Medikit"} count items _unit) > 0} do { _unit removeItem "Medikit"; - if (GVAR(level) >= 2) then { + if (EGVAR(medical,level) >= 2) then { _unit addItemToBackpack "ACE_fieldDressing"; _unit addItemToBackpack "ACE_packingBandage"; _unit addItemToBackpack "ACE_packingBandage"; diff --git a/addons/medical_treatment/functions/fnc_treatment.sqf b/addons/medical_treatment/functions/fnc_treatment.sqf index 5e5b768d90..c24a0748ee 100644 --- a/addons/medical_treatment/functions/fnc_treatment.sqf +++ b/addons/medical_treatment/functions/fnc_treatment.sqf @@ -25,9 +25,9 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exit if !(_target isKindOf "CAManBase") exitWith {false}; -private _config = (configFile >> "ACE_Medical_Treatment" >> "Basic" >> _className); -if (GVAR(level) >= 2) then { - _config = (configFile >> "ACE_Medical_Treatment" >> "Advanced" >> _className); +private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className); +if (EGVAR(medical,level) >= 2) then { + _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className); }; if !(isClass _config) exitwith {false}; diff --git a/addons/medical_treatment/functions/fnc_treatment_failure.sqf b/addons/medical_treatment/functions/fnc_treatment_failure.sqf index 1ace4b945a..be1ae7c860 100644 --- a/addons/medical_treatment/functions/fnc_treatment_failure.sqf +++ b/addons/medical_treatment/functions/fnc_treatment_failure.sqf @@ -57,9 +57,9 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") } forEach _usersOfItems; // Record specific callback -private _config = (configFile >> "ACE_Medical_Treatment" >> "Basic" >> _className); -if (GVAR(level) >= 2) then { - _config = (configFile >> "ACE_Medical_Treatment" >> "Advanced" >> _className); +private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className); +if (EGVAR(medical,level) >= 2) then { + _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className); }; private _callback = getText (_config >> "callbackFailure"); diff --git a/addons/medical_treatment/functions/fnc_treatment_success.sqf b/addons/medical_treatment/functions/fnc_treatment_success.sqf index 8f3759fbbc..33de6fb3bf 100644 --- a/addons/medical_treatment/functions/fnc_treatment_success.sqf +++ b/addons/medical_treatment/functions/fnc_treatment_success.sqf @@ -52,9 +52,9 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") }; // Record specific callback -private _config = (configFile >> "ACE_Medical_Treatment" >> "Basic" >> _className); -if (GVAR(level) >= 2) then { - _config = (configFile >> "ACE_Medical_Treatment" >> "Advanced" >> _className); +private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className); +if (EGVAR(medical,level) >= 2) then { + _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className); }; private _callback = getText (_config >> "callbackSuccess");