2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
2015-02-21 20:10:57 +00:00
|
|
|
/*
|
2016-09-27 09:05:38 +00:00
|
|
|
* Author: Glowbal, commy2
|
2015-02-21 20:10:57 +00:00
|
|
|
* Parse the ACE_Medical_Advanced config for all injury types.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-22 14:25:10 +00:00
|
|
|
* None
|
2016-09-27 09:05:38 +00:00
|
|
|
*
|
2015-02-21 20:10:57 +00:00
|
|
|
* ReturnValue:
|
2015-08-22 14:25:10 +00:00
|
|
|
* None
|
2015-02-21 20:10:57 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2016-09-27 09:05:38 +00:00
|
|
|
private _injuriesConfigRoot = configFile >> "ACE_Medical_Injuries";
|
|
|
|
|
|
|
|
// --- parse wounds
|
|
|
|
GVAR(woundClassNames) = [];
|
|
|
|
GVAR(woundsData) = []; // @todo classTypes are strings currently. Convert them to unqiue IDs instead.
|
|
|
|
|
|
|
|
private _woundsConfig = _injuriesConfigRoot >> "wounds";
|
2016-06-30 15:33:29 +00:00
|
|
|
private _classID = 0;
|
2016-09-27 09:05:38 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
private _entry = _x;
|
|
|
|
private _className = configName _entry;
|
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
private _selections = GET_ARRAY(_entry >> "selections",["All"]);
|
|
|
|
private _bleeding = GET_NUMBER(_entry >> "bleeding",0);
|
2016-09-27 09:05:38 +00:00
|
|
|
private _pain = GET_NUMBER(_entry >> "pain",0);
|
|
|
|
private _minDamage = GET_NUMBER(_entry >> "minDamage",0);
|
|
|
|
private _maxDamage = GET_NUMBER(_entry >> "maxDamage",-1);
|
|
|
|
private _causes = GET_ARRAY(_entry >> "causes",[]);
|
2016-12-05 20:34:20 +00:00
|
|
|
private _causeLimping = GET_NUMBER(_entry >> "causeLimping",0);
|
2016-09-27 09:05:38 +00:00
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
if (count _causes > 0) then {
|
|
|
|
GVAR(woundClassNames) pushBack _className;
|
2016-12-07 20:56:13 +00:00
|
|
|
GVAR(woundsData) pushBack [_classID, _selections, _bleeding, _pain, [_minDamage, _maxDamage], _causes, _className, _causeLimping];
|
2016-12-05 20:34:20 +00:00
|
|
|
_classID = _classID + 1;
|
2015-02-28 18:28:05 +00:00
|
|
|
};
|
2016-09-27 09:05:38 +00:00
|
|
|
} forEach configProperties [_woundsConfig, "isClass _x"];
|
|
|
|
|
|
|
|
// --- parse damage types
|
|
|
|
GVAR(allDamageTypes) = []; // @todo, currently unused by handle damage (was GVAR(allAvailableDamageTypes))
|
|
|
|
GVAR(allDamageTypesData) = [] call CBA_fnc_createNamespace;
|
|
|
|
|
|
|
|
// minimum lethal damage collection, mapped to damageTypes
|
|
|
|
private _damageTypesConfig = _injuriesConfigRoot >> "damageTypes";
|
|
|
|
private _thresholdsDefault = getArray (_damageTypesConfig >> "thresholds");
|
|
|
|
private _selectionSpecificDefault = getNumber (_damageTypesConfig >> "selectionSpecific");
|
2015-02-21 20:10:57 +00:00
|
|
|
|
2016-09-27 09:05:38 +00:00
|
|
|
// Collect all available damage types from the config
|
2015-02-21 20:10:57 +00:00
|
|
|
{
|
2016-09-27 09:05:38 +00:00
|
|
|
private _entry = _x;
|
|
|
|
private _className = configName _entry;
|
|
|
|
|
|
|
|
GVAR(allDamageTypes) pushBack _className;
|
|
|
|
|
|
|
|
// Check if this type is in the causes of a wound class, if so, we will store the wound types for this damage type
|
2016-06-30 15:33:29 +00:00
|
|
|
private _woundTypes = [];
|
2015-02-28 18:28:05 +00:00
|
|
|
{
|
2016-09-27 09:05:38 +00:00
|
|
|
if (_className in (_x select 5)) then {
|
2015-11-30 16:21:28 +00:00
|
|
|
_woundTypes pushBack _x;
|
2015-02-28 18:28:05 +00:00
|
|
|
};
|
2016-09-27 09:05:38 +00:00
|
|
|
} forEach GVAR(woundsData);
|
|
|
|
|
|
|
|
private _damageTypeSubClassConfig = _damageTypesConfig >> _className;
|
2016-06-30 15:33:29 +00:00
|
|
|
|
2016-09-27 09:05:38 +00:00
|
|
|
private _thresholds = GET_ARRAY(_damageTypeSubClassConfig >> "thresholds",_thresholdsDefault);
|
|
|
|
private _selectionSpecific = GET_NUMBER(_damageTypeSubClassConfig >> "selectionSpecific",_selectionSpecificDefault);
|
|
|
|
|
|
|
|
GVAR(allDamageTypesData) setVariable [_className, [_thresholds, _selectionSpecific > 0, _woundTypes]];
|
2015-05-16 21:20:38 +00:00
|
|
|
|
|
|
|
// extension loading
|
2016-09-27 09:05:38 +00:00
|
|
|
private _minDamageThresholds = (_thresholds apply {str (_x select 0)}) joinString ":";
|
2016-09-27 09:57:37 +00:00
|
|
|
private _amountThresholds = (_thresholds apply {str (_x select 1)}) joinString ":";
|
2015-05-16 21:20:38 +00:00
|
|
|
|
2016-06-30 15:33:29 +00:00
|
|
|
// load in the damage types into the medical extension
|
2016-09-27 09:57:37 +00:00
|
|
|
private _extensionArgs = format [
|
2016-09-27 09:05:38 +00:00
|
|
|
"addDamageType,%1,%2,%3,%4,%5",
|
|
|
|
_className,
|
2016-12-05 20:34:20 +00:00
|
|
|
1, //@todo remove 'minLethalDamage' from extension
|
2016-06-30 15:33:29 +00:00
|
|
|
_minDamageThresholds,
|
|
|
|
_amountThresholds,
|
2016-09-27 09:05:38 +00:00
|
|
|
_selectionSpecific
|
2016-06-30 15:33:29 +00:00
|
|
|
];
|
2016-09-27 09:57:37 +00:00
|
|
|
TRACE_1("",_extensionArgs);
|
|
|
|
|
|
|
|
private _extensionRes = "ace_medical" callExtension _extensionArgs;
|
2016-09-18 12:17:18 +00:00
|
|
|
TRACE_1("",_extensionRes);
|
2016-09-27 09:05:38 +00:00
|
|
|
} forEach configProperties [_damageTypesConfig, "isClass _x"];
|
2015-05-16 21:20:38 +00:00
|
|
|
|
2016-09-27 09:57:37 +00:00
|
|
|
// extension loading
|
2015-05-16 21:20:38 +00:00
|
|
|
{
|
2016-09-27 09:05:38 +00:00
|
|
|
_x params ["_classID", "_selections", "_bleedingRate", "_pain", "_damageExtrema", "_causes", "_displayName"];
|
|
|
|
_damageExtrema params ["_minDamage", "_maxDamage"];
|
2016-09-18 12:05:05 +00:00
|
|
|
|
2016-06-30 15:33:29 +00:00
|
|
|
private _className = GVAR(woundClassNames) select _forEachIndex;
|
2015-05-16 21:20:38 +00:00
|
|
|
|
2016-09-27 09:05:38 +00:00
|
|
|
if (_displayName isEqualTo "") then {
|
|
|
|
_displayName = _className;
|
|
|
|
};
|
2015-05-16 21:20:38 +00:00
|
|
|
|
2016-09-27 09:05:38 +00:00
|
|
|
private _selections = _selections joinString ":";
|
|
|
|
private _causes = _causes joinString ":";
|
|
|
|
|
|
|
|
private _extensionArgs = format [
|
|
|
|
"addInjuryType,%1,%2,%3,%4,%5,%6,%7,%8,%9",
|
|
|
|
_classID,
|
|
|
|
_className,
|
|
|
|
_selections,
|
|
|
|
_bleedingRate,
|
|
|
|
_pain,
|
|
|
|
_minDamage,
|
|
|
|
_maxDamage,
|
|
|
|
_causes,
|
|
|
|
_displayName
|
|
|
|
];
|
2016-09-18 12:17:18 +00:00
|
|
|
TRACE_1("",_extensionArgs);
|
|
|
|
|
|
|
|
private _extensionRes = "ace_medical" callExtension _extensionArgs;
|
|
|
|
TRACE_1("",_extensionRes);
|
2016-09-27 09:05:38 +00:00
|
|
|
} forEach GVAR(woundsData);
|
2015-05-16 21:20:38 +00:00
|
|
|
|
2015-05-16 22:47:42 +00:00
|
|
|
"ace_medical" callExtension "ConfigComplete";
|