From 529b6bd3cf58793de13561746ebe2c7643a35d2b Mon Sep 17 00:00:00 2001 From: Katalam Date: Thu, 21 Mar 2019 12:47:50 +0100 Subject: [PATCH] Medical menu is now working for iv stands --- addons/kat_acemisc/config.cpp | 12 ++++++------ addons/kat_acemisc/functions/fn_conditionIV.sqf | 3 ++- addons/kat_acemisc/functions/fn_treatmentIV.sqf | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/kat_acemisc/config.cpp b/addons/kat_acemisc/config.cpp index 741610d..e662e43 100644 --- a/addons/kat_acemisc/config.cpp +++ b/addons/kat_acemisc/config.cpp @@ -394,20 +394,20 @@ class ACE_Medical_Actions { class SalineIV_Stand: SalineIV { displayName = "$STR_kat_aceMisc_Display_IVStand"; requiredMedic = 0; - condition = "[_player, 1000] call kat_aceMisc_fnc_conditionIV"; + condition = "params ['_player'];[_player, 1000] call kat_aceMisc_fnc_conditionIV"; // no idea why here is a params needed items[] = {}; - callbackSuccess = "[_player, _target, _selectionName, 'SalineIV'] call kat_aceMisc_fnc_treatmentIV"; + callbackSuccess = "[_player, _target, _selectionName, 'SalineIV', ['ACE_salineIV']] call kat_aceMisc_fnc_treatmentIV"; itemConsumed = 0; }; class SalineIV_Stand_500: SalineIV_Stand { displayName = "$STR_kat_aceMisc_Display_IVStand_500"; - condition = "[_player, 500] call kat_aceMisc_fnc_conditionIV"; - callbackSuccess = "[_player, _target, _selectionName, 'SalineIV_500'] call kat_aceMisc_fnc_treatmentIV"; + condition = "params ['_player'];[_player, 500] call kat_aceMisc_fnc_conditionIV"; + callbackSuccess = "[_player, _target, _selectionName, 'SalineIV_500', ['ACE_salineIV_500']] call kat_aceMisc_fnc_treatmentIV"; }; class SalineIV_Stand_250: SalineIV_Stand { displayName = "$STR_kat_aceMisc_Display_IVStand_250"; - condition = "[_player, 250] call kat_aceMisc_fnc_conditionIV"; - callbackSuccess = "[_player, _target, _selectionName, 'SalineIV_250'] call kat_aceMisc_fnc_treatmentIV"; + condition = "params ['_player'];[_player, 250] call kat_aceMisc_fnc_conditionIV"; + callbackSuccess = "[_player, _target, _selectionName, 'SalineIV_250', ['ACE_salineIV_250']] call kat_aceMisc_fnc_treatmentIV"; }; class PersonalAidKit; class LimitWounds: PersonalAidKit { diff --git a/addons/kat_acemisc/functions/fn_conditionIV.sqf b/addons/kat_acemisc/functions/fn_conditionIV.sqf index 9dd4594..7fce15b 100644 --- a/addons/kat_acemisc/functions/fn_conditionIV.sqf +++ b/addons/kat_acemisc/functions/fn_conditionIV.sqf @@ -23,8 +23,9 @@ params [ if !(kat_aceMisc_enable) exitWith {false}; private _object = nearestObjects [_player, ['Land_IntravenStand_01_1bag_F', 'Land_IntravenStand_01_2bags_F'], 10, false]; +if (isNil "_object") exitWith {false}; _object = _object select {_ml in (_x getVariable ["kat_aceMisc_stand", []])}; -_object = _object select 0; if (isNil "_object") exitWith {false}; +_object = _object select 0; if (_object distance _player <= 10) exitWith {true}; false; diff --git a/addons/kat_acemisc/functions/fn_treatmentIV.sqf b/addons/kat_acemisc/functions/fn_treatmentIV.sqf index 3b2f264..39f098d 100644 --- a/addons/kat_acemisc/functions/fn_treatmentIV.sqf +++ b/addons/kat_acemisc/functions/fn_treatmentIV.sqf @@ -14,7 +14,7 @@ * Public: No */ -params ["_player", "_target", "_selectionName", "_className"]; +params ["_player", "_target", "_selectionName", "_className", "_item"]; private _value = 0; @@ -30,4 +30,4 @@ switch (_className) do { }; }; [_player, _value] call kat_aceMisc_fnc_removeIVbag; -[_player, _target, _selectionName, _className] call ace_medical_fnc_treatmentIV; +[_player, _target, _selectionName, _className, _item] call ace_medical_fnc_treatmentIV;