From 23a1bc86ca00ef1ee1d6e8d321730426f0b1d823 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sat, 16 May 2015 23:20:38 +0200 Subject: [PATCH] Loading config data to extension --- .../functions/fnc_parseConfigForInjuries.sqf | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/addons/medical/functions/fnc_parseConfigForInjuries.sqf b/addons/medical/functions/fnc_parseConfigForInjuries.sqf index 503ff9833e..9a46e26321 100644 --- a/addons/medical/functions/fnc_parseConfigForInjuries.sqf +++ b/addons/medical/functions/fnc_parseConfigForInjuries.sqf @@ -118,4 +118,62 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); if (isNumber(_damageTypesConfig >> _x >> "selectionSpecific")) then { _selectionSpecificType = getNumber(_damageTypesConfig >> _x >> "selectionSpecific");}; }; missionNamespace setvariable [_varName, [_typeThresholds, _selectionSpecificType > 0, _woundTypes]]; + + private ["_minDamageThresholds", "_amountThresholds"]; + // extension loading + _minDamageThresholds = ""; + _amountThresholds = ""; + { + _minDamageThresholds = _minDamageThresholds + str(_x select 0); + _amountThresholds = _amountThresholds + str(_x select 1); + if (_forEachIndex < (count _typeThresholds) - 1) then { + _minDamageThresholds = _minDamageThresholds + ":"; + _amountThresholds = _amountThresholds + ":"; + }; + }foreach _typeThresholds; + + _extensionInput = format ["addDamageType,%1,%2,%3,%4,%5", _type, GVAR(minLethalDamages) select _foreachIndex, _minDamageThresholds, _amountThresholds, _selectionSpecificType]; + diag_log format["Calling extension with input: %1", _extensionInput]; + diag_log format ["Extension return: %1", "ace_medical" callExtension _extensionInput]; + }foreach _allFoundDamageTypes; + + +// Extension loading + +{ + private ["_classID", "_className", "_allowedSelections", "_bloodLoss", "_pain", "_minDamage", "_maxDamage", "_causes", "_classDisplayName", "_extensionInput", "_selections", "_causesArray"]; + // add shit to addInjuryType + _classID = _x select 0; + _className = GVAR(woundClassNames) select _forEachIndex; + _allowedSelections = ""; + + _selections = _x select 1; + { + _allowedSelections = _allowedSelections + _x; + if (_forEachIndex < (count _selections) - 1) then { + _allowedSelections = _allowedSelections + ":"; + }; + }foreach _selections; + + _bloodLoss = _x select 2; + _pain = _x select 3; + _minDamage = (_x select 4) select 0; + _maxDamage = (_x select 4) select 1; + _causes = ""; + _causesArray = (_x select 5); + { + _causes = _causes + _x; + if (_forEachIndex < (count _causesArray) - 1) then { + _causes = _causes + ":"; + }; + }foreach _causesArray; + _classDisplayName = _x select 6; + _extensionInput = format["addInjuryType,%1,%2,%3,%4,%5,%6,%7,%8,%9", _classID, _className, _allowedSelections, _bloodLoss, _pain, _minDamage, _maxDamage, _causes, _classDisplayName]; + + diag_log format["Calling extension with input: %1", _extensionInput]; + diag_log format ["Extension return: %1", "ace_medical" callExtension _extensionInput]; + +}foreach _allWoundClasses; + +diag_log format["Extension configComplete: %1", "ace_medical" callExtension "ConfigComplete"];