From 1d33ce52b30b2ff2ec1c6dab017af5878cf77047 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sat, 4 Apr 2015 21:20:24 +0200 Subject: [PATCH] added support for adjustable settings for consumeItem and medicalLevel --- addons/medical/ACE_Medical_Treatments.hpp | 16 +++++++------- addons/medical/ACE_Settings.hpp | 16 ++++++++++++++ addons/medical/functions/fnc_canTreat.sqf | 10 ++++++++- addons/medical/functions/fnc_treatment.sqf | 25 ++++++++++++++++++---- 4 files changed, 54 insertions(+), 13 deletions(-) diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 8134ea82ba..855653718a 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -205,10 +205,10 @@ class ACE_Medical_Actions { displayNameProgress = ""; items[] = {"ACE_surgicalKit"}; treatmentLocations[] = {"MedicalFacility", "MedicalVehicle"}; - requiredMedic = 2; - treatmentTime = 15; + requiredMedic = QGVAR(medicSetting_SurgicalKit); + treatmentTime = 10; callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit)); - itemConsumed = 0; + itemConsumed = QGVAR(consumeItem_SurgicalKit); animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }}; }; @@ -217,10 +217,10 @@ class ACE_Medical_Actions { displayNameProgress = ""; items[] = {"ACE_personalAidKit"}; treatmentLocations[] = {"All"}; - requiredMedic = 1; - treatmentTime = 15; + requiredMedic = QGVAR(medicSetting_PAK); + treatmentTime = 10; callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal)); - itemConsumed = 0; + itemConsumed = QGVAR(consumeItem_PAK); animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; animationCaller = "AinvPknlMstpSlayWnonDnon_medic"; @@ -260,12 +260,12 @@ class ACE_Medical_Actions { displayNameProgress = "Performing CPR"; treatmentLocations[] = {"All"}; requiredMedic = 0; - treatmentTime = 25; + treatmentTime = 15; items[] = {}; condition = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])"; callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR)); callbackFailure = ""; - callbackProgress = ""; + callbackProgress = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])"; animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; animationCaller = "AinvPknlMstpSlayWnonDnon_medic"; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 034708934d..b5fc65b7f8 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -76,4 +76,20 @@ class ACE_Settings { typeName = "BOOL"; value = true; }; + class GVAR(medicSetting_PAK) { + typeName = "SCALAR"; + value = 1; + }; + class GVAR(medicSetting_SurgicalKit) { + typeName = "SCALAR"; + value = 1; + }; + class GVAR(consumeItem_PAK) { + typeName = "SCALAR"; + value = 0; + }; + class GVAR(consumeItem_SurgicalKit) { + typeName = "SCALAR"; + value = 0; + }; }; diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index 5467031cea..4cb9adf8e1 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -30,7 +30,15 @@ if (GVAR(level)>=2) then { }; if !(isClass _config) exitwith {false}; -_medicRequired = getNumber (_config >> "requiredMedic"); +_medicRequired = if (isNumber (_config >> "requiredMedic")) then { + getNumber (_config >> "requiredMedic"); +} else { + // Check for required class + if (isText (_config >> "requiredMedic")) exitwith { + missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0]; + }; + 0; +}; if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; _items = getArray (_config >> "items"); diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index 4a91e859ad..318b67af1c 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems"]; +private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems"]; _caller = _this select 0; _target = _this select 1; _selectionName = _this select 2; @@ -30,8 +30,16 @@ if (GVAR(level) >= 2) then { }; if !(isClass _config) exitwith {false}; -// Check for required class -_medicRequired = getNumber (_config >> "requiredMedic"); +_medicRequired = if (isNumber (_config >> "requiredMedic")) then { + getNumber (_config >> "requiredMedic"); +} else { + // Check for required class + if (isText (_config >> "requiredMedic")) exitwith { + missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0]; + }; + 0; +}; + if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; // Check item @@ -72,7 +80,16 @@ if ("All" in _locations) then { if !(_return) exitwith {false}; _usersOfItems = []; -if (getNumber (_config >> "itemConsumed") > 0) then { +_consumeItems = if (isNumber (_config >> "itemConsumed")) then { + getNumber (_config >> "itemConsumed"); +} else { + // Check for required class + if (isText (_config >> "itemConsumed")) exitwith { + missionNamespace getvariable [(getText (_config >> "itemConsumed")), 0]; + }; + 0; +}; +if (_consumeItems > 0) then { _usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1; };