I had a look at the healthbars widget to see how to make the decision to render the full bars, the cut down ones, or nothing at all and it's a reasonably simple distance calculation between the camera and the unit/feature. All good so far. However, in my spring settings, my unit icon draw distance is set to 129. However, the healthbars widget uses code like this:
Code: Select all
local infoDistance = 700000
<snip>
cx, cy, cz = GetCameraPosition()
<snip>
local ux, uy, uz = GetUnitViewPosition(unitID)
local dx, dy, dz = ux-cx, uy-cy, uz-cz
dist = dx*dx + dy*dy + dz*dz
if (dist>9000000) then
return
elseif (dist > infoDistance) then
fullText = false
end
So the infoDistance for full text display is really representing a distance of 836 (700000 ^ 0.5). I would expect this distance to be less than the icon draw distance (129), because you need to be quite close to see the full info on the healthbars, but quite far before unit icons are drawn. So where this big difference in scales come from?
Secondly, in Lua, how do I get access to the clients graphical settings (like the unit icon draw distance)? I had a look at the wiki, but I can only see game/mod/map/server related settings, but not client settings... Am I looking in the wrong place?