diff --git a/addons/frag/functions/fnc_getMaterialInfo.sqf b/addons/frag/functions/fnc_getMaterialInfo.sqf index f225124bbf..72851b295b 100644 --- a/addons/frag/functions/fnc_getMaterialInfo.sqf +++ b/addons/frag/functions/fnc_getMaterialInfo.sqf @@ -28,16 +28,17 @@ if !(isNil "_material") exitWith { if (isClass (configFile >> "CfgSurfaces" >> _surfType)) then { _material = getText (configFile >> "CfgSurfaces" >> _surfType >> "soundEnviron"); } else { // Messy way when a surface isn't added to cfgSurfaces - private _surfFileText = loadFile _surfType; - _surfFileText = (tolower _surfFileText) splitString " "";="+ endl; - private _idx = _surfFileText find "soundenviron"; - _material = _surfFileText#(_idx+1); - if (_material isEqualTo "empty") then { - _idx = _surfFileText find "soundhit"; - _material = _surfFileText#(_idx+1); - }; + private _surfFileText = tolower preprocessFile _surfType; + _surfFileText = _surfFileText regexReplace ["[^A-Za-z0-9]", ""]; + private _idx = 12 + (_surfFileText find "soundenviron"); + if (_surfFileText select [_idx, 5] isEqualTo "empty") then { + _idx = 8 + (_surfFileText find "soundhit"); + _material = _surfFileText select [_idx, 10]; + } else { + _material = _surfFileText select [_idx, 10]; + }; }; -TRACE_1("soundFound",_material); +TRACE_1("materialSubString",_material); _material = switch (true) do {