Add basic treatments, rename onProgress

This commit is contained in:
KoffeinFlummi 2015-02-22 17:45:46 +01:00
parent ab6bc998c2
commit ca930a5717
2 changed files with 42 additions and 18 deletions

View File

@ -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 = "";
};

View File

@ -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");