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...")
 
(Updated styling of prototype doc migration note)
 
(25 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 ===
{{Prototype parent|Prototype/EntityWithOwner}}
'''Type''': [[Types/Animation]]?
Entity that you move around on the screen during the campaign and freeplay.


=== mining_with_hands_animation ===
{{Prototype TOC|character}}
'''Type''': [[Types/Animation]]


=== mining_with_tool_animation ===
== Mandatory properties ==
'''Type''': [[Types/Animation]]
Inherits all properties from [[Prototype/EntityWithOwner]].


=== running_aim ===
{{Prototype property|mining_speed|[[Types/double|double]]}}
'''Type''': [[Types/Animation]]


=== mining_speed ===
{{Prototype property|running_speed|[[Types/double|double]]}}
'''Type''': [[Types/double]]?


=== running_speed ===
{{Prototype property|distance_per_frame|[[Types/double|double]]}}
'''Type''': [[Types/double]]?


=== distance_per_frame ===
{{Prototype property|maximum_corner_sliding_distance|[[Types/double|double]]}}
'''Type''': [[Types/double]]?


=== maximum_corner_sliding_distance ===
{{Prototype property|heartbeat|[[Types/Sound|Sound]]}}
'''Type''': [[Types/double]]?
The sound file played when the character's health is low.


=== mine_with_hands_frames_per_tick ===
{{Prototype property|eat|[[Types/Sound|Sound]]}}
'''Type''': [[Types/double]]?
The sound file played when the character eats (fish for example).


=== mine_with_tool_frames_per_tick ===
{{Prototype property|inventory_size|[[Types/ItemStackIndex|ItemStackIndex]]}}
'''Type''': [[Types/double]]?
Number of slots in the main inventory. May be 0.


=== idle_frames_per_tick ===
{{Prototype property|build_distance|[[Types/uint32|uint32]]}}
'''Type''': [[Types/double]]?


=== idle_with_gun_frames_per_tick ===
{{Prototype property|drop_item_distance|[[Types/uint32|uint32]]}}
'''Type''': [[Types/double]]?


=== heartbeat ===
{{Prototype property|reach_distance|[[Types/uint32|uint32]]}}
'''Type''': [[Types/FileName]]
The sound file played when the character's health is low


=== eat ===
{{Prototype property|reach_resource_distance|[[Types/double|double]]}}
'''Type''': [[Types/FileName]]
The sound file played when the character eats (fish for example)


=== light ===
{{Prototype property|item_pickup_distance|[[Types/double|double]]}}
'''Type''': [[Types/LightDefinition]]


=== inventory_size ===
{{Prototype property|loot_pickup_distance|[[Types/double|double]]}}
'''Type''': [[Types/InventorySize]]
The size of the character's inventory


=== mining_with_hands_particles_animation_positions ===
{{Prototype property|ticks_to_keep_gun|[[Types/uint32|uint32]]}}
'''Type''': ?


=== mining_with_tool_particles_animation_positions ===
{{Prototype property|ticks_to_keep_aiming_direction|[[Types/uint32|uint32]]}}
'''Type''': ?


Count of ticks to preserve the animation even when the discharging ends.
{{Prototype property|ticks_to_stay_in_combat|[[Types/uint32|uint32]]}}
== Example ==
 
    {
{{Prototype property|damage_hit_tint|[[Types/Color|Color]]}}
    type = "player",
 
    name = "player",
{{Prototype property|running_sound_animation_positions|[[Types/table|table]] of [[Types/float|float]]}}
    icon = "__base__/graphics/icons/player.png",
List of positions in the running animation when the walking sound is played.
    flags = {"pushable", "placeable-player", "placeable-off-grid", "breaths-air"},
     running_sound_animation_positions = {14, 29}
    max_health = 100,
 
    healing_per_tick = 0.01,
{{Prototype property|mining_with_tool_particles_animation_positions|[[Types/table|table]] of [[Types/float|float]]}}
    collision_box = {{-0.2, -0.2}, {0.2, 0.2}},
List of positions in the mining with tool animation when the mining sound and mining particles are created.
    selection_box = {{-0.2, -0.2}, {0.2, 0.2}},
    mining_with_tool_particles_animation_positions = {28}
    crafting_categories = {"crafting"},
 
    inventory_size = 60,
{{Prototype property|animations|[[Types/table|table]] of [[Types/CharacterArmorAnimation|CharacterArmorAnimation]]}}
    running_speed = 0.15,
 
     distance_per_frame = 0.13,
== Optional properties ==
    maximum_corner_sliding_distance = 0.7,
 
    eat =
{{Prototype property|crafting_categories|[[Types/table|table]] of [[Types/string|string]]|empty table|optional=true}}
    {
Names of the crafting categories the character can craft recipes from. The built-in categories can be found [[Data.raw#recipe-category|here]]. See also [[Prototype/RecipeCategory]].
      {
 
        filename = "__base__/sound/eat.wav",
{{Prototype property|mining_categories |[[Types/table|table]] of [[Types/string|string]]|empty table|optional=true}}
        volume = 1
Names of the resource categories the character can mine resources from.
      }
 
    },
{{Prototype property|light|[[Types/LightDefinition|LightDefinition]]|optional=true}}
    heartbeat =
 
    {
{{Prototype property|enter_vehicle_distance|[[Types/double|double]]|3.0|optional=true}}
      {
Must be >= 0.
        filename = "__base__/sound/heartbeat.ogg",
 
        volume = 1.5
{{Prototype property|tool_attack_distance|[[Types/double|double]]|1.5|optional=true}}
      }
 
    },
{{Prototype property|respawn_time|[[Types/uint32|uint32]]|10|optional=true}}
    idle_animation =
Time in seconds. Must be positive
    {
 
      priority = "medium",
{{Prototype property|has_belt_immunity|[[Types/bool|bool]]|false|optional=true}}
      frame_width = 48,
Whether this character is moved by belts when standing on them.
      frame_height = 66,
 
      direction_count = 5,
{{Prototype property|character_corpse|[[Types/string|string]]|optional=true}}
      frame_count = 120,
Name of the character corpse that is spawned when this character dies.
      stripes =
 
      {
{{Prototype property|footstep_particle_triggers|[[Types/FootstepTriggerEffectList|FootstepTriggerEffectList]]|optional=true}}
        {
Triggered every tick of the running animation.
          filename = "__base__/graphics/entity/player/character-idle-1.png",
 
          width_in_frames = 40
{{Prototype property|synced_footstep_particle_triggers|[[Types/FootstepTriggerEffectList|FootstepTriggerEffectList]]|optional=true}}
        },
Triggered when the running animation ([[#animations]]) rolls over the frames defined in <code>right_footprint_frames</code> and <code>left_footprint_frames</code>.
        {
 
          filename = "__base__/graphics/entity/player/character-idle-2.png",
{{Prototype property|footprint_particles|[[Types/table|table]] of [[Types/FootprintParticle|FootprintParticle]]|optional=true}}
          width_in_frames = 40
Array of footprint particles. Triggered when the running animation ([[#animations]]) rolls over the frames defined in <code>right_footprint_frames</code> and <code>left_footprint_frames</code>.
        },
 
        {
{{Prototype property|left_footprint_offset|[[Types/vector|vector]]|optional=true}}
          filename = "__base__/graphics/entity/player/character-idle-3.png",
Offset from the center of the entity for the left footprint. Used by <code>footprint_particles</code>.
          width_in_frames = 40
 
        }
{{Prototype property|right_footprint_offset|[[Types/vector|vector]]|optional=true}}
      },
Offset from the center of the entity for the right footprint. Used by <code>footprint_particles</code>.
      shift = {0, -0.6}
 
    },
{{Prototype property|right_footprint_frames|[[Types/table|table]] of [[Types/float|float]]|optional=true}}
    idle_frames_per_tick = 1,
An array of [[Types/float|float]]. The frames in the running animation ([[#animations]]) where the right foot touches the ground.
    idle_with_gun_animation =
 
    {
{{Prototype property|left_footprint_frames|[[Types/table|table]] of [[Types/float|float]]|optional=true}}
      priority = "medium",
An array of [[Types/float|float]]. The frames in the running animation ([[#animations]]) where the left foot touches the ground.
      frame_width = 48,
 
      frame_height = 66,
{{Prototype property|tool_attack_result|[[Types/Trigger|Trigger]]|optional=true}}
      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 10:42, 21 September 2023

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.


Prototype definitions » PrototypeBase » Prototype/Entity » Prototype/EntityWithHealth » Prototype/EntityWithOwner » Prototype/Character


Entity that you move around on the screen during the campaign and freeplay.


Prototype/Character — character
animations::table of CharacterArmorAnimation
build_distance::uint32
damage_hit_tint::Color
distance_per_frame::double
drop_item_distance::uint32
eat::Sound
heartbeat::Sound
inventory_size::ItemStackIndex
item_pickup_distance::double
loot_pickup_distance::double
maximum_corner_sliding_distance::double
mining_speed::double
mining_with_tool_particles_animation_positions::table of float
reach_distance::uint32
reach_resource_distance::double
running_sound_animation_positions::table of float
running_speed::double
ticks_to_keep_aiming_direction::uint32
ticks_to_keep_gun::uint32
ticks_to_stay_in_combat::uint32
character_corpse::string (optional)
crafting_categories::table of string (optional)
enter_vehicle_distance::double (optional)
footprint_particles::table of FootprintParticle (optional)
footstep_particle_triggers::FootstepTriggerEffectList (optional)
has_belt_immunity::bool (optional)
left_footprint_frames::table of float (optional)
left_footprint_offset::vector (optional)
light::LightDefinition (optional)
mining_categories::table of string (optional)
respawn_time::uint32 (optional)
right_footprint_frames::table of float (optional)
right_footprint_offset::vector (optional)
synced_footstep_particle_triggers::FootstepTriggerEffectList (optional)
tool_attack_distance::double (optional)
tool_attack_result::Trigger (optional)
Inherited from Prototype/EntityWithOwner
allow_run_time_change_of_is_military_target::bool (optional)
is_military_target::bool (optional)
Inherited from Prototype/EntityWithHealth
alert_when_damaged::bool (optional)
attack_reaction::AttackReaction (optional)
corpse::string or table of strings (optional)
create_ghost_on_death::bool (optional)
damaged_trigger_effect::TriggerEffect (optional)
dying_explosion::ExplosionDefinition or table of ExplosionDefinition (optional)
dying_trigger_effect::TriggerEffect (optional)
healing_per_tick::float (optional)
hide_resistances::bool (optional)
integration_patch::Sprite4Way (optional)
integration_patch_render_layer::RenderLayer (optional)
loot::Loot (optional)
max_health::float (optional)
random_corpse_variation::bool (optional)
repair_sound::Sound (optional)
repair_speed_modifier::float (optional)
resistances::Resistances (optional)
Inherited from Prototype/Entity
icons, icon, icon_size (IconSpecification)::IconSpecification
additional_pastable_entities::table of string (optional)
alert_icon_scale::float (optional)
alert_icon_shift::vector (optional)
allow_copy_paste::bool (optional)
autoplace::AutoplaceSpecification (optional)
build_base_evolution_requirement::double (optional)
build_grid_size::uint8 (optional)
build_sound::Sound (optional)
close_sound::Sound (optional)
collision_box::BoundingBox (optional)
collision_mask::CollisionMask (optional)
created_effect::Trigger (optional)
created_smoke::CreateTrivialSmokeEffectItem (optional)
drawing_box::BoundingBox (optional)
emissions_per_second::double (optional)
enemy_map_color::Color (optional)
fast_replaceable_group::string (optional)
flags::EntityPrototypeFlags (optional)
friendly_map_color::Color (optional)
hit_visualization_box::BoundingBox (optional)
map_color::Color (optional)
map_generator_bounding_box::BoundingBox (optional)
minable::MinableProperties (optional)
mined_sound::Sound (optional)
mining_sound::Sound (optional)
next_upgrade::string (optional)
open_sound::Sound (optional)
placeable_by::ItemToPlace or table of ItemToPlace (optional)
protected_from_tile_building::bool (optional)
radius_visualisation_specification::RadiusVisualisationSpecification (optional)
remains_when_mined::string or table of string (optional)
remove_decoratives::string (optional)
rotated_sound::Sound (optional)
selectable_in_game::bool (optional)
selection_box::BoundingBox (optional)
selection_priority::uint8 (optional)
shooting_cursor_size::double (optional)
sticker_box::BoundingBox (optional)
subgroup::string (optional)
tile_height::uint32 (optional)
tile_width::uint32 (optional)
trigger_target_mask::TriggerTargetMask (optional)
vehicle_impact_sound::Sound (optional)
water_reflection::WaterReflectionDefinition (optional)
working_sound::WorkingSound (optional)
Inherited from PrototypeBase
name::string
type::string
localised_description::LocalisedString (optional)
localised_name::LocalisedString (optional)
order::Order (optional)

Mandatory properties

Inherits all properties from Prototype/EntityWithOwner.

mining_speed

Type: double

running_speed

Type: double

distance_per_frame

Type: double

maximum_corner_sliding_distance

Type: double

heartbeat

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

eat

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

inventory_size

Type: ItemStackIndex
Number of slots in the main inventory. May be 0.

build_distance

Type: uint32

drop_item_distance

Type: uint32

reach_distance

Type: uint32

reach_resource_distance

Type: double

item_pickup_distance

Type: double

loot_pickup_distance

Type: double

ticks_to_keep_gun

Type: uint32

ticks_to_keep_aiming_direction

Type: uint32

ticks_to_stay_in_combat

Type: uint32

damage_hit_tint

Type: Color

running_sound_animation_positions

Type: table of float
List of positions in the running animation when the walking sound is played.

   running_sound_animation_positions = {14, 29}

mining_with_tool_particles_animation_positions

Type: table of 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: table of CharacterArmorAnimation

Optional properties

crafting_categories

Type: table of string
Default: empty table
Names of the crafting categories the character can craft recipes from. The built-in categories can be found here. See also Prototype/RecipeCategory.

mining_categories

Type: table of string
Default: empty table
Names of the resource categories the character can mine resources from.

light

Type: LightDefinition

enter_vehicle_distance

Type: double
Default: 3.0
Must be >= 0.

tool_attack_distance

Type: double
Default: 1.5

respawn_time

Type: uint32
Default: 10
Time in seconds. Must be positive

has_belt_immunity

Type: bool
Default: false
Whether this character is moved by belts when standing on them.

character_corpse

Type: string
Name of the character corpse that is spawned when this character dies.

footstep_particle_triggers

Type: FootstepTriggerEffectList
Triggered every tick of the running animation.

synced_footstep_particle_triggers

Type: FootstepTriggerEffectList
Triggered when the running animation (#animations) rolls over the frames defined in right_footprint_frames and left_footprint_frames.

footprint_particles

Type: table of FootprintParticle
Array of footprint particles. Triggered when the running animation (#animations) rolls over the frames defined in right_footprint_frames and left_footprint_frames.

left_footprint_offset

Type: vector
Offset from the center of the entity for the left footprint. Used by footprint_particles.

right_footprint_offset

Type: vector
Offset from the center of the entity for the right footprint. Used by footprint_particles.

right_footprint_frames

Type: table of float
An array of float. The frames in the running animation (#animations) where the right foot touches the ground.

left_footprint_frames

Type: table of float
An array of float. The frames in the running animation (#animations) where the left foot touches the ground.

tool_attack_result

Type: Trigger