and when zoomed out). This will override the mod's icon settings. There
is also a new filename that can be used to load user icons, usericons.tdf.
This file is loaded before the usual icontypes.tdf, and the first icon entry
of a particular name is the one that is used.
The user specification can only be done through the LUA UI interface
(so far). It is also possible to create animated icons (you will have to
have the LUA calls change the icon names at the appropriate times).
The LUA callout is Spring.SetUnitDefIcon(number udid, string "icon").
Here is an example of the code that could be used:
Code: Select all
-- Setup the unitdef icons
for udid,ud in pairs(UnitDefs) do
if ((udid ~= nil) and (ud ~= nil)) then
if (ud.origIconType == nil) then
-- save the original name, in case we want to revert
ud.origIconType = ud.iconType
end
if (ud.isCommander) then
Spring.SetUnitDefIcon(udid, "x.png")
elseif (ud.canFly) then
Spring.SetUnitDefIcon(udid, "triangle-up.png")
elseif ((ud.radarRadius > 1) and not ud.canMove) then
Spring.SetUnitDefIcon(udid, "hourglass-side.png")
elseif (ud.isBuilding or ud.isFactory) then
Spring.SetUnitDefIcon(udid, "square.png")
elseif (ud.isBuilder) then
Spring.SetUnitDefIcon(udid, "cross.png")
end
end
end