Prototype/Unit: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "==Basics== Entity with energy that attacks player based on pollution value. Extends the Prototype/EntityWithHealth == Usage in base== *[[Enemies|small, medium, and big bit...")
 
(Removed old prototype docs)
 
(19 intermediate revisions by 5 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/UnitPrototype.html https://lua-api.factorio.com/latest/prototypes/UnitPrototype.html]
Entity with energy that attacks player based on pollution value. Extends the [[Prototype/EntityWithHealth]]
== Usage in base==
*[[Enemies|small, medium, and big biters]]
== Properties ==
=== run_animation ===
'''Type''': [[Types/Animation]]


=== attack_parameters ===
</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/AttackParameters]]
 
=== movement_speed ===
'''Type''': [[Types/double]]?
 
=== distance_per_frame ===
'''Type''': [[Types/double]]?
 
=== dying_sound ===
'''Type''': [[Types/FileName]]
The sound file to play when entity dies
 
=== pollution_to_join_attack ===
'''Type''': [[Types/double]]
Pollution level required before entity will leave it's spawner and attack the source of the pollution.
 
=== distraction_cooldown ===
'''Type''': [[Types/Tick]]
 
Count of ticks to preserve the animation even when the discharging ends.
== Example ==
    {
    type = "unit",
    name = "small-biter",
    icon = "__base__/graphics/icons/creeper.png",
    flags = {"placeable-player", "placeable-enemy", "placeable-off-grid", "breaths-air"},
    max_health = 15,
    healing_per_tick = 0.01,
    collision_box = {{-0.2, -0.2}, {0.2, 0.2}},
    selection_box = {{-0.4, -0.7}, {0.7, 0.4}},
    attack_parameters =
    {
      range = 0.5,
      cooldown = 35,
      ammo_category = "melee",
      ammo_type = make_unit_melee_ammo_type(6),
      animation =
      {
        filename = "__base__/graphics/entity/small-biter/small-biter-attack.png",
        frame_width = 139,
        frame_height = 93,
        frame_count = 11,
        direction_count = 16,
        axially_symmetrical = false,
        shift = {0.84375, -0.3125}
      }
    },
    movement_speed = 0.2,
    distance_per_frame = 0.1,
    pollution_to_join_attack = 200,
    distraction_cooldown = 300,
    corpse = "small-biter-corpse",
    dying_sound =
    {
      {
        filename = "__base__/sound/creeper-death-1.wav",
        volume = 0.7
      },
      {
        filename = "__base__/sound/creeper-death-2.wav",
        volume = 0.7
      },
      {
        filename = "__base__/sound/creeper-death-3.wav",
        volume = 0.7
      },
      {
        filename = "__base__/sound/creeper-death-4.wav",
        volume = 0.7
      }
    },
    run_animation =
    {
      filename = "__base__/graphics/entity/small-biter/small-biter-run.png",
      still_frame = 4,
      frame_width = 86,
      frame_height = 59,
      frame_count = 16,
      direction_count = 16,
      shift = {0.359375, -0.15625},
      axially_symmetrical = false
    }
  }

Latest revision as of 14:33, 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/UnitPrototype.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.