Factorio Prototype DocsVersion 1.1.107

RotatedSprite :: struct Example code

Specifies series of sprites used to visualize different rotations of the object.

Inherits from SpriteParameters

Properties

layers optional :: array[RotatedSprite]

If this property is present, all RotatedSprite definitions have to be placed as entries in the array, and they will all be loaded from there. [...]

If this property is present, all RotatedSprite definitions have to be placed as entries in the array, and they will all be loaded from there. [...]

direction_count :: uint16

Count of direction (frames) specified.

Count of direction (frames) specified.

hr_version optional :: RotatedSprite

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

filenames optional :: array[FileName]

Only loaded, and mandatory if both layers and filename are not defined.

Only loaded, and mandatory if both layers and filename are not defined.

lines_per_file optional :: uint64

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

slice or dice optional :: SpriteSizeType

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

slice_x or dice_x optional :: SpriteSizeType

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

slice_y or dice_y optional :: SpriteSizeType

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

axially_symmetrical optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

back_equals_front optional :: bool

Only loaded if layers is not defined.

Only loaded if layers is not defined.

apply_projection optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

counterclockwise optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

line_length optional :: uint32

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

allow_low_quality_rotation optional :: bool

Only loaded if layers is not defined.

Only loaded if layers is not defined.

Inherited from SpriteParameters
filename[overridden] :: FileName

The path to the sprite file to use.

The path to the sprite file to use.

priority optional :: SpritePriority
flags optional :: SpriteFlags
size optional :: SpriteSizeType or {SpriteSizeType, SpriteSizeType}

The width and height of the sprite. [...]

The width and height of the sprite. [...]

width optional :: SpriteSizeType

Mandatory if size is not defined. [...]

Mandatory if size is not defined. [...]

height optional :: SpriteSizeType

Mandatory if size is not defined. [...]

Mandatory if size is not defined. [...]

x optional :: SpriteSizeType

Horizontal position of the sprite in the source file in pixels.

Horizontal position of the sprite in the source file in pixels.

y optional :: SpriteSizeType

Vertical position of the sprite in the source file in pixels.

Vertical position of the sprite in the source file in pixels.

position optional :: {SpriteSizeType, SpriteSizeType}

Loaded only when x and y are both 0. [...]

Loaded only when x and y are both 0. [...]

shift optional :: Vector

The shift in tiles. [...]

The shift in tiles. [...]

scale optional :: double

Values other than 1 specify the scale of the sprite on default zoom. [...]

Values other than 1 specify the scale of the sprite on default zoom. [...]

draw_as_shadow optional :: bool

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. [...]

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. [...]

draw_as_glow optional :: bool

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. [...]

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. [...]

draw_as_light optional :: bool

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true.

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true.

mipmap_count optional :: uint8

Only loaded if this is an icon, that is it has the flag "group=icon" or "group=gui".

Only loaded if this is an icon, that is it has the flag "group=icon" or "group=gui".

apply_runtime_tint optional :: bool
tint optional :: Color
blend_mode optional :: BlendMode
load_in_minimal_mode optional :: bool

Minimal mode is entered when mod loading fails. [...]

Minimal mode is entered when mod loading fails. [...]

premul_alpha optional :: bool

Whether alpha should be pre-multiplied.

Whether alpha should be pre-multiplied.

generate_sdf[overridden] optional :: bool

This property is only used by sprites used in UtilitySprites that have the "icon" flag set. [...]

This property is only used by sprites used in UtilitySprites that have the "icon" flag set. [...]

Properties

layers :: array[RotatedSprite] optional

If this property is present, all RotatedSprite definitions have to be placed as entries in the array, and they will all be loaded from there. layers may not be an empty table. Each definition in the array may also have the layers property.

If this property is present, all other properties, including those inherited from SpriteParameters, are ignored.

direction_count :: uint16

Count of direction (frames) specified.

hr_version :: RotatedSprite optional

Only loaded if layers is not defined.

If this property exists and high resolution sprites are turned on, this is used to load the sprite.

filenames :: array[FileName] optional

Only loaded, and mandatory if both layers and filename are not defined.

lines_per_file :: uint64 optional

Default: 0

Only loaded if layers is not defined. Mandatory if filenames is defined.

slice or dice :: SpriteSizeType optional

Only loaded if layers is not defined.

Number of slices this is sliced into when using the "optimized atlas packing" option. If you are a modder, you can just ignore this property. As an example, if this is 4, the sprite will be sliced into a 4x4 grid.

slice_x or dice_x :: SpriteSizeType optional

Only loaded if layers is not defined.

Same as slice, but this specifies only how many slices there are on the x-axis.

slice_y or dice_y :: SpriteSizeType optional

Only loaded if layers is not defined.

Same as slice, but this specifies only how many slices there are on the y-axis.

axially_symmetrical :: bool optional

Default: false

Only loaded if layers is not defined.

When true, the same picture is used for left/right direction, just flipped, which can save half of the space required, but is not usable once the picture contains shadows, etc.

back_equals_front :: bool optional

Default: false

Only loaded if layers is not defined.

apply_projection :: bool optional

Default: true

Only loaded if layers is not defined.

Used to fix the inconsistency of direction of the entity in 3d when rendered and direction on the screen (where the 45 degree angle for projection is used).

counterclockwise :: bool optional

Default: false

Only loaded if layers is not defined.

Set to true to indicate sprites in the spritesheet are in counterclockwise order.

line_length :: uint32 optional

Default: 0

Only loaded if layers is not defined.

Once the specified number of pictures is loaded, other pictures are loaded on other line. This is to allow having more sprites in matrix, to input files with too high width. The game engine limits the width of any input files to 8192px, so it is compatible with most graphics cards. 0 means that all the pictures are in one horizontal line.

allow_low_quality_rotation :: bool optional

Default: false

Only loaded if layers is not defined.

Overridden Properties

filename :: FileName optional

Only loaded if layers is not defined.

The path to the sprite file to use.

generate_sdf :: bool optional

Default: false

Only loaded if layers is not defined.

Unused.

Example

pictures =
{
  layers =
  {
    {
      filename = "__base__/graphics/entity/radar/radar.png",
      priority = "low",
      width = 98,
      height = 128,
      apply_projection = false,
      direction_count = 64,
      line_length = 8,
      shift = util.by_pixel(1, -16),
      hr_version =
      {
        filename = "__base__/graphics/entity/radar/hr-radar.png",
        priority = "low",
        width = 196,
        height = 254,
        apply_projection = false,
        direction_count = 64,
        line_length = 8,
        shift = util.by_pixel(1, -16),
        scale = 0.5
      }
    },
    {
      filename = "__base__/graphics/entity/radar/radar-shadow.png",
      priority = "low",
      width = 172,
      height = 94,
      apply_projection = false,
      direction_count = 64,
      line_length = 8,
      shift = util.by_pixel(39,3),
      draw_as_shadow = true,
      hr_version =
      {
        filename = "__base__/graphics/entity/radar/hr-radar-shadow.png",
        priority = "low",
        width = 343,
        height = 186,
        apply_projection = false,
        direction_count = 64,
        line_length = 8,
        shift = util.by_pixel(39.25,3),
        draw_as_shadow = true,
        scale = 0.5
      }
    }
  }
}

Prototypes

Types