Types/RotatedSprite: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(→‎Example: updated)
(0.16)
Line 2: Line 2:
Specifies series of sprites used to visualise different rotations of the object.
Specifies series of sprites used to visualise different rotations of the object.


== Properties ==
== Mandatory properties ==
=== filename ===
 
'''Type''':[[Types/FileName]]
=== width ===
=== priority ===
'''Type''': [[Types/SpriteSizeType]]
'''Type''':[[Types/string]]
 
Width of a single frame in pixels, from 0-8192.


Possible values:
=== height ===
*extra-high
'''Type''': [[Types/SpriteSizeType]]
*high
*medium
*low
*very low
=== frame_width ===
'''Type''': [[Types/uint32]]


Width of single frame in pixels.
Height of a single frame in pixels, from 0-8192.
=== frame_height ===
'''Type''': [[Types/uint32]]


Height of single frame in pixels
=== direction_count ===
=== direction_count ===
'''Type''': [[Types/uint32]]
'''Type''': [[Types/uint16]]


Count of direction (frames) specified.
Count of direction (frames) specified.
=== line_length ===
'''Type''': [[Types/uint32]]


'''Defult''': 0
== Optional properties ==
 
=== filename ===
'''Type''': [[Types/FileName]]
 
'''Default''': ""
 
Either this or <code>"filenames"</code> has to be non-empty.
 
=== filenames ===
'''Type''': [[types/table]] of [[Types/FileName]]
 
'''Default''': ""
 
Array of filenames. Either this or <code>"filename"</code> has to be non-empty.
 
=== layers ===
'''Type''': [[Types/table]] of [[Types/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. Each item (RotatedSprite definition) in the array may also have the <code>layers</code> property.
 
If this property is present, all other properties are ignored and the mandatory properties do not have to be defined.
 
=== hr_version ===
'''Type''': [[Types/RotatedSprite]]
 
If this property exists and high resolution sprites are turned on, its contents are used to load the RotatedSprite.
 
=== priority ===
'''Type''': [[Types/string]]
 
'''Default''': "medium"
 
Possible values:
* "extra-high-no-scale"
* "extra-high"
* "high"
* "medium"
* "low"
* "very-low"
 
=== flags ===
'''Type''': [[Types/SpriteFlags]]


Used to specify the individual images in grid.
0 means that all the picture are in one horizontal line.
=== x ===
=== x ===
'''Type''': [[Types/uint32]]
'''Type''': [[Types/SpriteSizeType]]


'''Default''': 0
'''Default''': 0


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


=== y ===
=== y ===
'''Type''': [[Types/uint32]]
'''Type''': [[Types/SpriteSizeType]]


'''Default''': 0
'''Default''': 0


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


=== shift ===
=== shift ===
'''Type''': [[Types/vector]]
'''Type''': [[Types/vector]]


'''Default''': 0
'''Default''': {0, 0}
 
=== scale ===
=== scale ===
'''Type''': [[Types/double]]
'''Type''': [[Types/double]]
Line 56: Line 87:
'''Default''': 1
'''Default''': 1


Values different than 1 specify the scale of the picture on default zoom.
Values different than 1 specify the scale of the sprite on default zoom.
Scale 2 means that the picture will be 2 times bigger on screen (and more pixelated).
Scale 2 means that the picture will be 2 times bigger on screen (and more pixelated).
=== draw_as_shadow ===
'''Type''': [[Types/bool]]
'''Default''': false
=== apply_runtime_tint ===
'''Type''': [[Types/bool]]
'''Default''': false
=== tint ===
'''Type''': [[Types/Color]]
'''Default''': {r=1, g=1, b=1, a=1} (white)
=== blend_mode ===
'''Type''': [[Types/string]]
'''Default''': "normal"
Possible values:
* "normal"
* "additive"
* "additive-soft"
* "multiplicative"
* "overwrite"
=== load_in_minimal_mode ===
'''Type''': [[Types/bool]]
'''Default''': false
=== premul_alpha ===
'''Type''': [[Types/bool]]
'''Default''': true
Whether alpha should be premultiplied.


=== axially_symmetrical ===
=== axially_symmetrical ===
Line 65: Line 135:


When set to true, left the same picture is used for left/right direction, just flipped, this can save half of the space required, but is not usable once the picture contains shadows etc.
When set to true, left the same picture is used for left/right direction, just flipped, this can save half of the space required, but is not usable once the picture contains shadows etc.
=== back_equals_front ===
'''Type''': [[Types/bool]]
'''Default''': false
=== apply_projection ===
=== apply_projection ===
'''Type''': [[Types/bool]]
'''Type''': [[Types/bool]]
Line 71: Line 147:


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).
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).
=== line_length ===
'''Type''': [[Types/uint32]]
'''Defult''': 0
Used to specify the individual images in grid.
0 means that all the picture are in one horizontal line.
=== allow_low_quality_rotation ===
'''Type''': [[Types/bool]]
'''Default''': false
=== lines_per_file ===
'''Type''': [[Types/uint64]]
Mandatory if <code>"filenames"</code> exists.
=== slice ===
'''Type''': [[Types/SpriteSizeType]]
=== slice_x ===
'''Type''': [[Types/SpriteSizeType]]
=== slice_y ===
'''Type''': [[Types/SpriteSizeType]]
== Example ==
== Example ==
<syntaxhighlight lang="lua">pictures =
<syntaxhighlight lang="lua">pictures =

Revision as of 19:40, 23 August 2018

Basics

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

Mandatory properties

width

Type: Types/SpriteSizeType

Width of a single frame in pixels, from 0-8192.

height

Type: Types/SpriteSizeType

Height of a single frame in pixels, from 0-8192.

direction_count

Type: Types/uint16

Count of direction (frames) specified.

Optional properties

filename

Type: Types/FileName

Default: ""

Either this or "filenames" has to be non-empty.

filenames

Type: types/table of Types/FileName

Default: ""

Array of filenames. Either this or "filename" has to be non-empty.

layers

Type: Types/table of Types/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. Each item (RotatedSprite definition) in the array may also have the layers property.

If this property is present, all other properties are ignored and the mandatory properties do not have to be defined.

hr_version

Type: Types/RotatedSprite

If this property exists and high resolution sprites are turned on, its contents are used to load the RotatedSprite.

priority

Type: Types/string

Default: "medium"

Possible values:

  • "extra-high-no-scale"
  • "extra-high"
  • "high"
  • "medium"
  • "low"
  • "very-low"

flags

Type: Types/SpriteFlags

x

Type: Types/SpriteSizeType

Default: 0

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

y

Type: Types/SpriteSizeType

Default: 0

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

shift

Type: Types/vector

Default: {0, 0}

scale

Type: Types/double

Default: 1

Values different than 1 specify the scale of the sprite on default zoom. Scale 2 means that the picture will be 2 times bigger on screen (and more pixelated).

draw_as_shadow

Type: Types/bool

Default: false

apply_runtime_tint

Type: Types/bool

Default: false

tint

Type: Types/Color

Default: {r=1, g=1, b=1, a=1} (white)

blend_mode

Type: Types/string

Default: "normal"

Possible values:

  • "normal"
  • "additive"
  • "additive-soft"
  • "multiplicative"
  • "overwrite"

load_in_minimal_mode

Type: Types/bool

Default: false

premul_alpha

Type: Types/bool

Default: true

Whether alpha should be premultiplied.

axially_symmetrical

Type: Types/bool

Default: false

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

back_equals_front

Type: Types/bool

Default: false

apply_projection

Type: Types/bool

Default: true

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).

line_length

Type: Types/uint32

Defult: 0

Used to specify the individual images in grid. 0 means that all the picture are in one horizontal line.

allow_low_quality_rotation

Type: Types/bool

Default: false

lines_per_file

Type: Types/uint64

Mandatory if "filenames" exists.

slice

Type: Types/SpriteSizeType

slice_x

Type: Types/SpriteSizeType

slice_y

Type: Types/SpriteSizeType

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
          }
        }
      }
    },