-- Optional %APPDATA%\Arrowhead\Helldivers2\mech_hud.cfg (key=value, data only). return function(dir) local C={x=0.02,y=0.55,right=0.27,bottom=0.035,plate=0.28,scale=1,alpha=0.9,debug=false,spatial=true,tagged_ref=true,mount_match=true,poll=0.25} local limits={x={0,1},y={0,1},right={0,0.95},bottom={0,0.9},plate={0,1},scale={0.5,2.5},alpha={0.1,1},poll={0.1,2}} if not dir or not io or not io.open then return C end local ok,f=pcall(io.open,dir..'mech_hud.cfg','r');if not ok or not f then return C end local n=0 for l in f:lines() do n=n+1;if n>64 then break end local k,v=l:match('^%s*([%w_]+)%s*=%s*([%w%.%-]+)') if k=='debug'or k=='spatial'or k=='tagged_ref'or k=='mount_match' then if v=='true' or v=='false' then C[k]=v=='true' end elseif k and limits[k] then local x=tonumber(v) if x and x==x then C[k]=math.max(limits[k][1],math.min(limits[k][2],x)) end end end f:close();return C end