Simplify condition checking in canTreat.

This commit is contained in:
KoffeinFlummi 2015-03-19 22:01:40 +01:00
parent 69e0ebf107
commit 97082e4ce3

View File

@ -39,19 +39,16 @@ if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exi
_locations = getArray (_config >> "treatmentLocations");
_return = true;
if (isText (_config >> "Condition")) then {
_condition = getText(_config >> "condition");
if (_condition != "") then {
if (isnil _condition) then {
_condition = compile _condition;
} else {
_condition = missionNamespace getvariable _condition;
};
if (typeName _condition == "BOOL") then {
_return = _condition;
} else {
_return = [_caller, _target, _selectionName, _className] call _condition;
};
if (getText (_config >> "condition") != "") then {
if (isnil _condition) then {
_condition = compile _condition;
} else {
_condition = missionNamespace getvariable _condition;
};
if (typeName _condition == "BOOL") then {
_return = _condition;
} else {
_return = [_caller, _target, _selectionName, _className] call _condition;
};
};
if (!_return) exitwith {false};