Prototype/Character: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
(documented collision_mask default)
Line 107: Line 107:
Added in 0.11.17
Added in 0.11.17


== Differing defaults ==
collision_mask defaults to <code>{ "player-layer", "train-layer", "consider-tile-transitions"}</code> and not the [[Prototype/Entity]] default.


== Example ==
== Example ==

Revision as of 13:54, 14 January 2018

Basics

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

Properties

crafting_categories

Type: Types/CraftingCategory

mining_categories

Type: Types/MiningCategory

idle_animation

Type: Types/RotatedAnimation

idle_with_gun_animation

Type: Types/RotatedAnimation

running_animation

Type: Types/RotatedAnimation

running_sound_animation_positions (Since 0.8)

Type: List of Types/float

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

   running_sound_animation_positions = {14, 29}

running_mask_animation

Type: Types/RotatedAnimation

Currently not used.

mining_with_hands_animation

Type: Types/RotatedAnimation

mining_with_hands_particles_animation_positions

Type: List 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_animation

Type: Types/RotatedAnimation

mining_with_tool_particles_animation_positions

Type: List of Types/float

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

running_aim

Type: Types/RotatedAnimation

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/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

build_distance

Type: Types/uint

Added in 0.11.17

drop_item_distance

Type: Types/uint

Added in 0.11.17

reach_distance

Type: Types/uint

Added in 0.11.17

reach_resource_distance

Type: Types/double

Added in 0.11.17

ticks_to_keep_gun

Type: Types/uint

Added in 0.11.17

ticks_to_keep_aiming_direction

Type: Types/uint

Added in 0.11.17

Differing defaults

collision_mask defaults to { "player-layer", "train-layer", "consider-tile-transitions"} 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}
 },