ACE3/addons/medical_ai/XEH_preStart.sqf
PabstMirror 25b8fd6d54
Medical AI - Add setting to require items for treatment (#9362)
* Medical AI - Add setting to require items for treatment

* all ivs

* invert setting

* Update addons/medical_ai/stringtable.xml

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>

* move item hash to preStart

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
2023-09-06 12:37:26 -04:00

28 lines
1.1 KiB
Plaintext

#include "script_component.hpp"
#include "XEH_PREP.hpp"
private _itemHash = createHashMap;
// key is Treatment Type (prefix @ represents a group of treatments)
// value is hash of item/treatment pairs
{
_x params ["_itemType", "_treatments"];
private _typeHash = createHashMap;
{
private _items = getArray (configFile >> "ace_medical_treatment_actions" >> _x >> "items");
if (_items isEqualTo []) then { ERROR_1("bad action %1",_x); };
private _itemClassname = configName (configFile >> "CfgWeapons" >> _items # 0);
private _treatment = if ((count _treatments) > 1) then { _x } else { "" };
_typeHash set [_itemClassname, _treatment];
} forEach _treatments;
_itemHash set [_itemType, _typeHash];
} forEach [
["@bandage", ["FieldDressing", "PackingBandage", "ElasticBandage", "QuikClot"]],
["@iv", ["SalineIV", "SalineIV_500", "SalineIV_250", "BloodIV", "BloodIV_500", "BloodIV_250", "PlasmaIV", "PlasmaIV_500", "PlasmaIV_250"]],
["splint", ["splint"]],
["morphine", ["morphine"]],
["epinephrine", ["epinephrine"]]
];
uinamespace setVariable [QGVAR(itemHash), compileFinal _itemHash];