From 95d83554da56d1018ad080ff33f3c71fd2a276c7 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 28 Apr 2015 20:32:02 +0200 Subject: [PATCH] Added local treatment through remoteExec for basic --- addons/medical/XEH_preInit.sqf | 2 ++ .../functions/fnc_treatmentBasic_bloodbag.sqf | 7 ++--- .../fnc_treatmentBasic_bloodbagLocal.sqf | 21 +++++++++++++++ .../functions/fnc_treatmentBasic_morphine.sqf | 11 ++------ .../fnc_treatmentBasic_morphineLocal.sqf | 27 +++++++++++++++++++ 5 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf create mode 100644 addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 051f7da266..4f4ff5bc30 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -80,8 +80,10 @@ PREP(treatmentAdvanced_medication); PREP(treatmentAdvanced_medicationLocal); PREP(treatmentBasic_bandage); PREP(treatmentBasic_bloodbag); +PREP(treatmentBasic_bloodbagLocal); PREP(treatmentBasic_epipen); PREP(treatmentBasic_morphine); +PREP(treatmentBasic_morphineLocal); PREP(treatmentIV); PREP(treatmentIVLocal); PREP(treatmentTourniquet); diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf index 57563ad8fc..9d2c12280d 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -15,12 +15,9 @@ */ #include "script_component.hpp" -#define BLOODBAGHEAL 70 -private ["_caller", "_target","_className","_blood"]; +private ["_caller", "_target"]; _caller = _this select 0; _target = _this select 1; -_className = _this select 3; -_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100; -_target setVariable [QGVAR(bloodVolume), _blood, true]; +[[_target], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf new file mode 100644 index 0000000000..9bbe04b35f --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf @@ -0,0 +1,21 @@ +/* + * Author: KoffeinFlummi + * Local callback when the bloodbag treatment is complete + * + * Arguments: + * 0: The patient + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define BLOODBAGHEAL 70 + +private ["_target","_blood"]; +_target = _this select 0; + +_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100; +_target setVariable [QGVAR(bloodVolume), _blood, true]; diff --git a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf index d8d793d0bc..048b314781 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf @@ -17,15 +17,8 @@ #include "script_component.hpp" #define MORPHINEHEAL 0.4 -private ["_caller", "_target","_className","_blood","_morphine","_pain"]; +private ["_caller", "_target"]; _caller = _this select 0; _target = _this select 1; -_className = _this select 3; -// reduce pain, pain sensitivity -_morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; -_target setVariable [QGVAR(morphine), _morphine, true]; -_pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0; -_target setVariable [QGVAR(pain), _pain, true]; - -// @todo overdose +[[_target], QUOTE(DFUNC(treatmentBasic_morphineLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf new file mode 100644 index 0000000000..9dddf743e2 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf @@ -0,0 +1,27 @@ +/* + * Author: KoffeinFlummi + * Local callback when the morphine treatment is complete + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define MORPHINEHEAL 0.4 + +private ["_target", "_morphine", "_pain"]; +_target = _this select 0; + +// reduce pain, pain sensitivity +_morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; +_target setVariable [QGVAR(morphine), _morphine, true]; +_pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0; +_target setVariable [QGVAR(pain), _pain, true]; + +// @todo overdose