Prototype/Character: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(documented collision_mask default)
(0.16)
Line 1: Line 1:
==Basics==
==Basics==
Entity that you move around on the screen during the campaign and freeplay. Extends the Prototype/EntityWithHealth
Entity that you move around on the screen during the campaign and freeplay. Extends [[Prototype/EntityWithHealth]].
== Properties ==
== Mandatory properties ==
=== crafting_categories ===
Inherits all properties from [[Prototype/EntityWithHealth]].
'''Type''': [[Types/CraftingCategory]]


=== mining_categories ===
=== mining_speed ===
'''Type''': [[Types/MiningCategory]]
'''Type''': [[Types/double]]


=== idle_animation ===
=== running_speed ===
'''Type''': [[Types/RotatedAnimation]]
'''Type''': [[Types/double]]


=== idle_with_gun_animation ===
=== distance_per_frame ===
'''Type''': [[Types/RotatedAnimation]]
'''Type''': [[Types/double]]


=== running_animation ===
=== maximum_corner_sliding_distance ===
'''Type''': [[Types/RotatedAnimation]]
'''Type''': [[Types/double]]


=== running_sound_animation_positions (Since 0.8) ===
=== heartbeat ===
'''Type''': List of [[Types/float]]
'''Type''': [[Types/Sound]]


List of positions in the running animation when the walking sound is played.
The sound file played when the character's health is low.
    running_sound_animation_positions = {14, 29}
=== running_mask_animation ===
'''Type''': [[Types/RotatedAnimation]]


Currently not used.
=== eat ===
'''Type''': [[Types/Sound]]


=== mining_with_hands_animation ===
The sound file played when the character eats (fish for example).
'''Type''': [[Types/RotatedAnimation]]


=== mining_with_hands_particles_animation_positions ===
=== inventory_size ===
'''Type''': List of [[Types/float]]
'''Type''': [[Types/ItemStackIndex]]


List of positions in the mining with hand animation when the mining sound and mining particles are created.
=== build_distance ===
    mining_with_hands_particles_animation_positions = {29, 63}
'''Type''': [[Types/uint32]]


=== mining_with_tool_animation ===
=== drop_item_distance ===
'''Type''': [[Types/RotatedAnimation]]
'''Type''': [[Types/uint32]]


=== mining_with_tool_particles_animation_positions ===
=== reach_distance ===
'''Type''': List of [[Types/float]]
'''Type''': [[Types/uint32]]


List of positions in the mining with tool animation when the mining sound and mining particles are created.
=== reach_resource_distance ===
'''Type''': [[Types/double]]


=== running_aim ===
=== item_pickup_distance ===
'''Type''': [[Types/RotatedAnimation]]
'''Type''': [[Types/double]]


=== mining_speed ===
=== loot_pickup_distance ===
'''Type''': [[Types/double]]
'''Type''': [[Types/double]]


=== running_speed ===
=== ticks_to_keep_gun ===
'''Type''': [[Types/double]]
'''Type''': [[Types/uint32]]
 
=== ticks_to_keep_aiming_direction ===
'''Type''': [[Types/uint32]]


=== distance_per_frame ===
=== ticks_to_stay_in_combat ===
'''Type''': [[Types/double]]
'''Type''': [[Types/uint32]]


=== maximum_corner_sliding_distance ===
=== damage_hit_tint ===
'''Type''': [[Types/double]]
'''Type''': [[Types/Color]]


=== heartbeat ===
=== running_sound_animation_positions ===
'''Type''': [[Types/FileName]]
'''Type''': [[Types/table]] of [[Types/float]]


The sound file played when the character's health is low
List of positions in the running animation when the walking sound is played.
    running_sound_animation_positions = {14, 29}


=== eat ===
=== mining_with_hands_particles_animation_positions ===
'''Type''': [[Types/FileName]]
'''Type''': [[Types/table]] of [[Types/float]]


The sound file played when the character eats (fish for example)
List of positions in the mining with hand animation when the mining sound and mining particles are created.
    mining_with_hands_particles_animation_positions = {29, 63}


=== light ===
=== mining_with_tool_particles_animation_positions ===
'''Type''': [[Types/LightDefinition]]
'''Type''': [[Types/table]] of [[Types/float]]


=== inventory_size ===
List of positions in the mining with tool animation when the mining sound and mining particles are created.
'''Type''': [[Types/InventorySize]]
    mining_with_tool_particles_animation_positions = {28}


The size of the character's inventory
=== animations ===
'''Type''': [[Types/table]] of [[Types/CharacterArmorAnimation]]


=== build_distance ===
== Optional properties ==
'''Type''': [[Types/uint]]


Added in 0.11.17
=== crafting_categories ===
'''Type''': [[Types/table]] of [[Types/string]]


=== drop_item_distance ===
Names of the crafting categories the player can craft recipes from.
'''Type''': [[Types/uint]]


Added in 0.11.17
=== mining_categories  ===
'''Type''': [[Types/table]] of [[Types/string]]


=== reach_distance ===
Names of the resource categories the player can mine resources from.
'''Type''': [[Types/uint]]


Added in 0.11.17
=== light ===
'''Type''': [[Types/LightDefinition]]


=== reach_resource_distance ===
=== enter_vehicle_distance ===
'''Type''': [[Types/double]]
'''Type''': [[Types/double]]


Added in 0.11.17
'''Default''': 3.0
 
Must be positive.
 
=== respawn_time ===
'''Type''': [[Types/uint32]]


=== ticks_to_keep_gun ===
'''Default''': 10
'''Type''': [[Types/uint]]


Added in 0.11.17
Time in seconds. Must be positive


=== ticks_to_keep_aiming_direction ===
=== character_corpse ===
'''Type''': [[Types/uint]]
'''Type''': [[Types/string]]


Added in 0.11.17
Name of the character corpse that is spawned whend this character dies.


== Differing defaults ==
== Differing defaults ==


collision_mask defaults to <code>{ "player-layer", "train-layer", "consider-tile-transitions"}</code> and not the [[Prototype/Entity]] default.
collision_mask defaults to <code>{ "player-layer", "train-layer", "consider-tile-transitions"}</code> and not the [[Prototype/Entity]] default.
== Example ==
    {
    type = "player",
    name = "player",
    icon = "__base__/graphics/icons/player.png",
    flags = {"pushable", "placeable-player", "placeable-off-grid", "breaths-air"},
    max_health = 100,
    healing_per_tick = 0.01,
    collision_box = {{-0.2, -0.2}, {0.2, 0.2}},
    selection_box = {{-0.2, -0.2}, {0.2, 0.2}},
    crafting_categories = {"crafting"},
    mining_categories = {"mining"},
    inventory_size = 60,
    build_distance = 6,
    drop_item_distance = 6,
    reach_distance = 6,
    reach_resource_distance = 2.7,
    ticks_to_keep_gun = 600,
    ticks_to_keep_aiming_direction = 100,
    running_speed = 0.15,
    distance_per_frame = 0.13,
    maximum_corner_sliding_distance = 0.7,
    eat =
    {
      {
        filename = "__base__/sound/eat.wav",
        volume = 1
      }
    },
    heartbeat =
    {
      {
        filename = "__base__/sound/heartbeat.ogg",
        volume = 1.5
      }
    },
    idle_animation =
    {
      priority = "medium",
      frame_width = 48,
      frame_height = 66,
      direction_count = 5,
      frame_count = 120,
      stripes =
      {
        {
          filename = "__base__/graphics/entity/player/character-idle-1.png",
          width_in_frames = 40
        },
        {
          filename = "__base__/graphics/entity/player/character-idle-2.png",
          width_in_frames = 40
        },
        {
          filename = "__base__/graphics/entity/player/character-idle-3.png",
          width_in_frames = 40
        }
      },
      shift = {0, -0.6}
    },
    idle_with_gun_animation =
    {
      priority = "medium",
      frame_width = 48,
      frame_height = 66,
      direction_count = 5,
      frame_count = 120,
      stripes =
      {
        {
          filename = "__base__/graphics/entity/player/character-idle-with-gun-1.png",
          width_in_frames = 40
        },
        {
          filename = "__base__/graphics/entity/player/character-idle-with-gun-2.png",
          width_in_frames = 40
        },
        {
          filename = "__base__/graphics/entity/player/character-idle-with-gun-3.png",
          width_in_frames = 40
        }
      },
      shift = {0, -0.6}
    },
    light = {intensity = 0.4, size = 25},
    mining_speed = 0.01,
    mining_with_hands_animation =
    {
      priority = "medium",
      frame_width = 48,
      frame_height = 66,
      direction_count = 5,
      frame_count = 80,
      stripes =
      {
        {
          filename = "__base__/graphics/entity/player/character-mine-with-hands-1.png",
          width_in_frames = 40
        },
        {
          filename = "__base__/graphics/entity/player/character-mine-with-hands-2.png",
          width_in_frames = 40
        }
      },
      shift = {0, -0.6}
    },
    mining_with_hands_particles_animation_positions = {29, 63},
    mining_with_tool_animation =
    {
      priority = "medium",
      frame_width = 64,
      frame_height = 88,
      direction_count = 5,
      frame_count = 48,
      stripes =
      {
        {
          filename = "__base__/graphics/entity/player/character-mine-with-tool-1.png",
          width_in_frames = 24
        },
        {
          filename = "__base__/graphics/entity/player/character-mine-with-tool-2.png",
          width_in_frames = 24
        }
      },
      shift = {0, -0.6}
    },
    mining_with_tool_particles_animation_positions = {28},
    running_aim =
    {
      filename = "__base__/graphics/entity/player/character-clothes-run-aim.png",
      priority = "medium",
      frame_width = 58,
      frame_height = 72,
      frame_count = 30,
      direction_count = 18,
      shift = {0, -0.6}
    },
    running_animation =
    {
      filename = "__base__/graphics/entity/player/character-clothes-run.png",
      priority = "medium",
      frame_width = 48,
      frame_height = 66,
      frame_count = 30,
      direction_count = 5,
      shift = {0, -0.6}
    },
    running_mask_animation =
    {
      filename = "__base__/graphics/entity/player/character-clothes-run-mask.png",
      priority = "medium",
      frame_width = 48,
      frame_height = 66,
      frame_count = 30,
      direction_count = 5,
      shift = {0, -0.6}
    },
    running_sound_animation_positions = {14, 29}
  },

Revision as of 12:31, 23 May 2018

Basics

Entity that you move around on the screen during the campaign and freeplay. Extends Prototype/EntityWithHealth.

Mandatory properties

Inherits all properties from Prototype/EntityWithHealth.

mining_speed

Type: Types/double

running_speed

Type: Types/double

distance_per_frame

Type: Types/double

maximum_corner_sliding_distance

Type: Types/double

heartbeat

Type: Types/Sound

The sound file played when the character's health is low.

eat

Type: Types/Sound

The sound file played when the character eats (fish for example).

inventory_size

Type: Types/ItemStackIndex

build_distance

Type: Types/uint32

drop_item_distance

Type: Types/uint32

reach_distance

Type: Types/uint32

reach_resource_distance

Type: Types/double

item_pickup_distance

Type: Types/double

loot_pickup_distance

Type: Types/double

ticks_to_keep_gun

Type: Types/uint32

ticks_to_keep_aiming_direction

Type: Types/uint32

ticks_to_stay_in_combat

Type: Types/uint32

damage_hit_tint

Type: Types/Color

running_sound_animation_positions

Type: Types/table of Types/float

List of positions in the running animation when the walking sound is played.

   running_sound_animation_positions = {14, 29}

mining_with_hands_particles_animation_positions

Type: Types/table of Types/float

List of positions in the mining with hand animation when the mining sound and mining particles are created.

   mining_with_hands_particles_animation_positions = {29, 63}

mining_with_tool_particles_animation_positions

Type: Types/table of Types/float

List of positions in the mining with tool animation when the mining sound and mining particles are created.

   mining_with_tool_particles_animation_positions = {28}

animations

Type: Types/table of Types/CharacterArmorAnimation

Optional properties

crafting_categories

Type: Types/table of Types/string

Names of the crafting categories the player can craft recipes from.

mining_categories

Type: Types/table of Types/string

Names of the resource categories the player can mine resources from.

light

Type: Types/LightDefinition

enter_vehicle_distance

Type: Types/double

Default: 3.0

Must be positive.

respawn_time

Type: Types/uint32

Default: 10

Time in seconds. Must be positive

character_corpse

Type: Types/string

Name of the character corpse that is spawned whend this character dies.

Differing defaults

collision_mask defaults to { "player-layer", "train-layer", "consider-tile-transitions"} and not the Prototype/Entity default.