From d752dd50d0a35fcee704d64a97f1b5fb0054f19a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 23 May 2015 01:16:18 -0500 Subject: [PATCH] Basic - Bloodbag size matters --- addons/medical/ACE_Medical_Treatments.hpp | 8 +++++++- .../functions/fnc_treatmentBasic_bloodbag.sqf | 5 +++-- .../functions/fnc_treatmentBasic_bloodbagLocal.sqf | 14 +++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 8b4361d002..064f29c8f9 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -50,11 +50,17 @@ class ACE_Medical_Actions { displayNameProgress = "$STR_ACE_Medical_Transfusing_Blood"; requiredMedic = 1; treatmentTime = 20; - items[] = {{"ACE_bloodIV", "ACE_bloodIV_500", "ACE_bloodIV_250"}}; + items[] = {"ACE_bloodIV"}; callbackSuccess = QUOTE(DFUNC(treatmentBasic_bloodbag)); animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = {}; }; + class BloodIV_500: BloodIV { + items[] = {"ACE_bloodIV_500"}; + }; + class BloodIV_250: BloodIV { + items[] = {"ACE_bloodIV_250"}; + }; class BodyBag: Bandage { displayName = "$STR_ACE_Medical_PlaceInBodyBag"; displayNameProgress = "$STR_ACE_Medical_PlacingInBodyBag"; diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf index 9d2c12280d..7cfb65a909 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -16,8 +16,9 @@ #include "script_component.hpp" -private ["_caller", "_target"]; +private ["_caller", "_target", "_treatmentClassname"]; _caller = _this select 0; _target = _this select 1; +_treatmentClassname = _this select 3; -[[_target], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +[[_target, _treatmentClassname], 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 index 9bbe04b35f..08057c9492 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf @@ -4,6 +4,7 @@ * * Arguments: * 0: The patient + * 1: Treatment Classname * * Return Value: * nil @@ -14,8 +15,15 @@ #include "script_component.hpp" #define BLOODBAGHEAL 70 -private ["_target","_blood"]; -_target = _this select 0; +PARAMS_2(_target,_treatmentClassname); -_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100; +private ["_blood", "_bloodAdded"]; + +_bloodAdded = switch (true) do { + case (_treatmentClassname == "BloodIV_250"): {0.25 * BLOODBAGHEAL}; + case (_treatmentClassname == "BloodIV_500"): {0.5 * BLOODBAGHEAL}; + default {BLOODBAGHEAL}; +}; + +_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + _bloodAdded) min 100; _target setVariable [QGVAR(bloodVolume), _blood, true];