Implemented dynamic treatment time

This commit is contained in:
BaerMitUmlaut 2015-05-27 00:45:22 +02:00
parent 41892fd6df
commit 890b568225

View File

@ -16,7 +16,7 @@
#include "script_component.hpp"
private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn"];
private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTime", "_treatmentTimeConfig"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
@ -174,8 +174,26 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
[_caller, _callerAnim] call EFUNC(common,doAnimation);
};
//Get treatment time
if (isNumber (_config >> "treatmentTime")) then {
_treatmentTime = getNumber (_config >> "treatmentTime");
} else {
if (isText (_config >> "treatmentTime")) then {
_treatmentTimeConfig = getText(_config >> "treatmentTime");
if (isnil _treatmentTimeConfig) then {
_treatmentTimeConfig = compile _treatmentTimeConfig;
} else {
_treatmentTimeConfig = missionNamespace getvariable _treatmentTimeConfig;
};
if (typeName _treatmentTimeConfig == "SCALAR") then {
_treatmentTime = _treatmentTimeConfig;
} else {
_treatmentTime = [_caller, _target, _selectionName, _className] call _treatmentTimeConfig;
};
};
};
// Start treatment
_treatmentTime = getNumber (_config >> "treatmentTime");
[
_treatmentTime,
[_caller, _target, _selectionName, _className, _items, _usersOfItems],