From ca930a5717b6fc980c11b3ed329e9ff8e5acecb0 Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Sun, 22 Feb 2015 17:45:46 +0100 Subject: [PATCH] Add basic treatments, rename onProgress --- addons/medical/ACE_Medical_Treatments.hpp | 46 ++++++++++++++++------ addons/medical/functions/fnc_treatment.sqf | 14 +++---- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 86a0fb8eae..d2b395c0ba 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -1,22 +1,46 @@ class ACE_Medical_Actions { class Basic { - class ACE_Bandaging { - // Which locations can this treatment action be used? Available: Field, MedicalFacility, MedicalVehicle, All. + class Bandage { treatmentLocations[] = {"Field", "MedicalFacility", "MedicalVehicle"}; - // What is the level of medical skill required for this treatment action? 0 = all soldiers, 1 = medic, 2 = doctor + requiredMedic = 0; - // The time it takes for a treatment action to complete. Time is in seconds. treatmentTime = 5; - // Item required for the action. Leave empty for no item required. - items[] = {"ace_sampleItem"}; - // Callbacks - callbackSuccess = "hint ""Success"";"; - callbackFailure = "hint ""Failure "";"; - onProgress = ""; + treatmentTimeSelfCoef = 1; + items[] = {QGVAR(bandage)}; + itemConsumed = 1; + + callbackSuccess = QUOTE(_this call FUNC(treatmentBasic_bandage)); + callbackFailure = QUOTE(_this call FUNC(treatmentBasic_abort)); + callbackProgress = ""; animationPatient = ""; animationCaller = ""; }; + class Morphine: Bandage { + treatmentTime = 2; + items[] = {QGVAR(morphine)}; + callbackSuccess = QUOTE(_this call FUNC(treatmentBasic_morphine)); + animationCaller = ""; // @todo + }; + class Epipen: Bandage { + treatmentTime = 3; + items[] = {QGVAR(epipen)}; + callbackSuccess = QUOTE(_this call FUNC(treatmentBasic_epipen)); + animationCaller = ""; // @todo + }; + class Bloodbag: Bandage { + treatmentTime = 20; + items[] = {QGVAR(bloodbag)}; + callbackSuccess = QUOTE(_this call FUNC(treatmentBasic_bloodbag)); + animationCaller = ""; // @todo + }; + class Diagnose: Bandage { + treatmentTime = 10; + treatmentTimeSelfCoef = 0; + items[] = {}; + callbackSuccess = QUOTE(_this call FUNC(treatmentBasic_diagnose)); + animationCaller = ""; // @todo + }; }; class Advanced { @@ -32,7 +56,7 @@ class ACE_Medical_Actions { // Callbacks callbackSuccess = "hint ""Success"";"; callbackFailure = "hint ""Failure "";"; - onProgress = ""; + callbackProgress = ""; animationPatient = ""; animationCaller = ""; }; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index 6cc9e72bba..396668f594 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", "_onProgress", "_treatmentTime", "_callerAnim", "_patietAnim"]; +private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patietAnim"]; _caller = _this select 0; _target = _this select 1; _selectionName = _this select 2; @@ -65,16 +65,16 @@ if (isNil _callbackFailure) then { _callbackFailure = missionNamespace getvariable _callbackFailure; }; -// Parse the config for the onProgress callback -_onProgress = getText (_config >> "onProgress"); -if (isNil _onProgress) then { - _onProgress = compile _onProgress; +// Parse the config for the callbackProgress callback +_callbackProgress = getText (_config >> "callbackProgress"); +if (isNil _callbackProgress) then { + _callbackProgress = compile _callbackProgress; } else { - _onProgress = missionNamespace getvariable _onProgress; + _callbackProgress = missionNamespace getvariable _callbackProgress; }; _treatmentTime = getNumber (_config >> "treatmentTime"); -[_treatmentTime, [_caller, _target, _selectionName, _className, _items], _callbackSuccess, _callbackFailure, (localize ""), _onProgress] call EFUNC(common,progressBar); +[_treatmentTime, [_caller, _target, _selectionName, _className, _items], _callbackSuccess, _callbackFailure, (localize ""), _callbackProgress] call EFUNC(common,progressBar); _callerAnim = getText (_config >> "animationCaller"); _patietAnim = getText (_confg >> "animationPatient");