Icontypes.lua - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki

Location

icontypes.lua is a file in the Gamedata/ directory of a Spring Game.

Purpose

This file defines the icons used to represent units on the minimap and rendered in place of 3d geometry when zoomed out.

Source

The engine source code which parses the data from this file is viewable here:

Data Types

Details

Game developers can set icons for different types of units, (such as land, air, sea), or go so far as to give every unit its own icon. The different types icons will be shown for friendly units, and enemy units within Line Of Sight. For enemy units in radar range Spring will use the 'default' icon.

IconType Properties

Assigning IconTypes

To assign units to a specific icon type, set the attribute of their UnitDef to the type name set in icontypes.lua (see #Example)

...
iconType = "circle",
...

If the tag is missing, Spring sets it to the "default" icontype. If the "default" type is not specified, Spring will create it with the default values. Furthermore, enemy units that are within radar range, but not in your Line Of Sight, will be shown as the default icon. Thus if there is a bitmap specified for the "default" icon type it will override the standard radar blip.

Example

local iconTypes = {
  default = {
    size = 1,
    radiusadjust = true,
  },
  flag = {
    bitmap = "icons/flag.png",
    size = 6,
    radiusadjust = true,
    distance = 100,
  },
  circle = {
    bitmap = "icons/circle.png",
    size = 4,
    radiusadjust = true,
    distance = 100,
  },
  ...
}

return iconTypes

Category:Gamedata