Prototype/Character: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "==Basics== Entity that you move around on the screen during the campaign and freeplay. Extends the Prototype/EntityWithHealth == Properties == === crafting_categories === '''T...")
 
(Removed old prototype docs)
 
(26 intermediate revisions by 8 users not shown)
Line 1: Line 1:
==Basics==
<div class="stub"><p>'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/prototypes/CharacterPrototype.html https://lua-api.factorio.com/latest/prototypes/CharacterPrototype.html]
Entity that you move around on the screen during the campaign and freeplay. Extends the Prototype/EntityWithHealth
== Properties ==
=== crafting_categories ===
'''Type''': [[Types/CraftingCategory]]


=== idle_animation ===
</p><p>This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div>
'''Type''': [[Types/Animation]]
 
=== idle_with_gun_animation ===
'''Type''': [[Types/Animation]]
 
=== running_animation ===
'''Type''': [[Types/Animation]]
 
=== running_mask_animation ===
'''Type''': [[Types/Animation]]?
 
=== mining_with_hands_animation ===
'''Type''': [[Types/Animation]]
 
=== mining_with_tool_animation ===
'''Type''': [[Types/Animation]]
 
=== running_aim ===
'''Type''': [[Types/Animation]]
 
=== mining_speed ===
'''Type''': [[Types/double]]?
 
=== running_speed ===
'''Type''': [[Types/double]]?
 
=== distance_per_frame ===
'''Type''': [[Types/double]]?
 
=== maximum_corner_sliding_distance ===
'''Type''': [[Types/double]]?
 
=== mine_with_hands_frames_per_tick ===
'''Type''': [[Types/double]]?
 
=== mine_with_tool_frames_per_tick ===
'''Type''': [[Types/double]]?
 
=== idle_frames_per_tick ===
'''Type''': [[Types/double]]?
 
=== idle_with_gun_frames_per_tick ===
'''Type''': [[Types/double]]?
 
=== heartbeat ===
'''Type''': [[Types/FileName]]
The sound file played when the character's health is low
 
=== eat ===
'''Type''': [[Types/FileName]]
The sound file played when the character eats (fish for example)
 
=== light ===
'''Type''': [[Types/LightDefinition]]
 
=== inventory_size ===
'''Type''': [[Types/InventorySize]]
The size of the character's inventory
 
=== mining_with_hands_particles_animation_positions ===
'''Type''': ?
 
=== mining_with_tool_particles_animation_positions ===
'''Type''': ?
 
Count of ticks to preserve the animation even when the discharging ends.
== 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"},
    inventory_size = 60,
    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_frames_per_tick = 1,
    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}
    },
    idle_with_gun_frames_per_tick = 1,
    light = {intensity = 0.4, size = 25},
    mine_with_hands_frames_per_tick = 1,
    mine_with_tool_frames_per_tick = 1,
    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}
    },
  },

Latest revision as of 14:32, 25 October 2024

The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/prototypes/CharacterPrototype.html

This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.