Factorio Prototype DocsVersion 2.0.19

ResourceEntityPrototype 'resource' changedExample code

A mineable/gatherable entity.

Inherits from EntityPrototype « Prototype « PrototypeBase

Properties

stages optional :: AnimationVariations

Entity's graphics, using a graphic sheet, with variation and depletion. [...]

Entity's graphics, using a graphic sheet, with variation and depletion. [...]

stage_counts :: array[uint32]

Number of stages the animation has.

Number of stages the animation has.

infinite optional :: bool

If the ore is infinitely minable, or if it will eventually run out of resource.

If the ore is infinitely minable, or if it will eventually run out of resource.

highlight optional :: bool

If the resource should be highlighted when holding a mining drill that can mine it (holding a pumpjack highlights crude-oil in the base game).

If the resource should be highlighted when holding a mining drill that can mine it (holding a pumpjack highlights crude-oil in the base game).

randomize_visual_position optional :: bool

Whether there should be a slight offset to graphics of the resource. [...]

Whether there should be a slight offset to graphics of the resource. [...]

map_grid optional :: bool

Whether the resource should have a grid pattern on the map instead of a solid map color.

Whether the resource should have a grid pattern on the map instead of a solid map color.

draw_stateless_visualisation_under_buildingnew optional :: bool
minimum optional :: uint32

Must be not 0 when infinite = true.

Must be not 0 when infinite = true.

normal optional :: uint32

Must be not 0 when infinite = true.

Must be not 0 when infinite = true.

infinite_depletion_amount optional :: uint32

Every time an infinite-type resource "ticks" lower it's lowered by that amount. [...]

Every time an infinite-type resource "ticks" lower it's lowered by that amount. [...]

resource_patch_search_radius optional :: uint32

When hovering over this resource in the map view: How far to search for other resource patches of this type to display as one (summing amount, white outline).

When hovering over this resource in the map view: How far to search for other resource patches of this type to display as one (summing amount, white outline).

category optional :: ResourceCategoryID

The category for the resource. [...]

The category for the resource. [...]

walking_sound optional :: Sound

Sound played when the player walks over this resource.

Sound played when the player walks over this resource.

driving_soundnew optional :: InterruptibleSound

Sound played when a CarPrototype drives over this resource.

Sound played when a CarPrototype drives over this resource.

stages_effect optional :: AnimationVariations

An effect that can be overlaid above the normal ore graphics. [...]

An effect that can be overlaid above the normal ore graphics. [...]

effect_animation_period optional :: float

How long it takes stages_effect to go from min_effect_alpha to max_effect_alpha.

How long it takes stages_effect to go from min_effect_alpha to max_effect_alpha.

effect_animation_period_deviation optional :: float

How much effect_animation_period can deviate from its original value. [...]

How much effect_animation_period can deviate from its original value. [...]

effect_darkness_multiplier optional :: float

How much the surface darkness should affect the alpha of stages_effect.

How much the surface darkness should affect the alpha of stages_effect.

min_effect_alpha optional :: float

Minimal alpha value of stages_effect.

Minimal alpha value of stages_effect.

max_effect_alpha optional :: float

Maximal alpha value of stages_effect.

Maximal alpha value of stages_effect.

tree_removal_probability optional :: double

Must be greater than or equal to 0.

Must be greater than or equal to 0.

cliff_removal_probability optional :: double

Must be greater than or equal to 0.

Must be greater than or equal to 0.

tree_removal_max_distance optional :: double

Must be positive when tree_removal_probability is set.

Must be positive when tree_removal_probability is set.

mining_visualisation_tint optional :: Color

Defaults to the resources map color if left unset and map color is set, otherwise defaults to white if left unset.

Defaults to the resources map color if left unset and map color is set, otherwise defaults to white if left unset.

Inherited from EntityPrototype
icons optional :: array[IconData]

This will be used in the electric network statistics, editor building selection, and the bonus gui. [...]

This will be used in the electric network statistics, editor building selection, and the bonus gui. [...]

icon optional :: FileName

Path to the icon file. [...]

Path to the icon file. [...]

icon_size optional :: SpriteSizeType

The size of the square icon, in pixels. [...]

The size of the square icon, in pixels. [...]

collision_box optional :: BoundingBox

Specification of the entity collision boundaries. [...]

Specification of the entity collision boundaries. [...]

collision_maskchanged optional :: CollisionMaskConnector

Defaults to the mask from UtilityConstants::default_collision_masks when indexed by the entity type.

Defaults to the mask from UtilityConstants::default_collision_masks when indexed by the entity type.

map_generator_bounding_box optional :: BoundingBox

Used instead of the collision box during map generation. [...]

Used instead of the collision box during map generation. [...]

selection_box optional :: BoundingBox

Specification of the entity selection area. [...]

Specification of the entity selection area. [...]

drawing_box_vertical_extensionnew optional :: double

Specification of extra vertical space needed to see the whole entity in GUIs. [...]

Specification of extra vertical space needed to see the whole entity in GUIs. [...]

sticker_box optional :: BoundingBox

Used to set the area of the entity that can have stickers on it, currently only used for units to specify the area where the green slow down stickers can appear.

Used to set the area of the entity that can have stickers on it, currently only used for units to specify the area where the green slow down stickers can appear.

hit_visualization_box optional :: BoundingBox

Where beams should hit the entity. [...]

Where beams should hit the entity. [...]

trigger_target_mask optional :: TriggerTargetMask
flags optional :: EntityPrototypeFlags
tile_buildability_rulesnew optional :: array[TileBuildabilityRule]
minable optional :: MinableProperties

The item given to the player when they mine the entity and other properties relevant to mining this entity.

The item given to the player when they mine the entity and other properties relevant to mining this entity.

surface_conditionsnew optional :: array[SurfaceCondition]
deconstruction_alternativenew optional :: EntityID

Used to merge multiple entities into one entry in the deconstruction planner.

Used to merge multiple entities into one entry in the deconstruction planner.

selection_priority optional :: uint8

The entity with the higher number is selectable before the entity with the lower number.

The entity with the higher number is selectable before the entity with the lower number.

build_grid_size optional :: uint8

Supported values are 1 (for 1x1 grid) and 2 (for 2x2 grid, like rails). [...]

Supported values are 1 (for 1x1 grid) and 2 (for 2x2 grid, like rails). [...]

remove_decorativeschanged optional :: "automatic" or "true" or "false"

Whether this entity should remove decoratives that collide with it when this entity is built. [...]

Whether this entity should remove decoratives that collide with it when this entity is built. [...]

emissions_per_secondchanged optional :: dictionary[AirbornePollutantID → double]

Amount of emissions created (positive number) or cleaned (negative number) every second by the entity. [...]

Amount of emissions created (positive number) or cleaned (negative number) every second by the entity. [...]

shooting_cursor_sizechanged optional :: double

The cursor size used when shooting at this entity.

The cursor size used when shooting at this entity.

created_smoke optional :: CreateTrivialSmokeEffectItem

The smoke that is shown when the entity is placed.

The smoke that is shown when the entity is placed.

working_sound optional :: WorkingSound

Will also work on entities that don't actually do work.

Will also work on entities that don't actually do work.

created_effect optional :: Trigger

The effect/trigger that happens when the entity is placed.

The effect/trigger that happens when the entity is placed.

build_sound optional :: Sound
mined_sound optional :: Sound
mining_sound optional :: Sound
rotated_sound optional :: Sound
impact_categorynew optional :: string

Name of a ImpactCategory.

Name of a ImpactCategory.

open_sound optional :: Sound
close_sound optional :: Sound
placeable_position_visualizationnew optional :: Sprite
radius_visualisation_specification optional :: RadiusVisualisationSpecification
stateless_visualisationnew optional :: StatelessVisualisations
build_base_evolution_requirement optional :: double
alert_icon_shift optional :: Vector
alert_icon_scale optional :: float
fast_replaceable_group optional :: string

This allows you to replace an entity that's already placed, with a different one in your inventory. [...]

This allows you to replace an entity that's already placed, with a different one in your inventory. [...]

next_upgrade optional :: EntityID

Name of the entity that will be automatically selected as the upgrade of this entity when using the upgrade planner without configuration. [...]

Name of the entity that will be automatically selected as the upgrade of this entity when using the upgrade planner without configuration. [...]

protected_from_tile_building optional :: bool

When this is true, this entity prototype should be included during tile collision checks with tiles that have TilePrototype::check_collision_with_entities set to true.

When this is true, this entity prototype should be included during tile collision checks with tiles that have TilePrototype::check_collision_with_entities set to true.

heating_energynew optional :: Energy
allow_copy_paste optional :: bool
selectable_in_game optional :: bool
placeable_by optional :: ItemToPlace or array[ItemToPlace]

Item that when placed creates this entity. [...]

Item that when placed creates this entity. [...]

remains_when_mined optional :: EntityID or array[EntityID]

The entity that remains when this one is mined, deconstructed or fast-replaced. [...]

The entity that remains when this one is mined, deconstructed or fast-replaced. [...]

additional_pastable_entities optional :: array[EntityID]

Names of the entity prototypes this entity prototype can be pasted on to in addition to the standard supported types. [...]

Names of the entity prototypes this entity prototype can be pasted on to in addition to the standard supported types. [...]

tile_widthchanged optional :: int32

Used to determine how the center of the entity should be positioned when building (unless the off-grid flag is specified). [...]

Used to determine how the center of the entity should be positioned when building (unless the off-grid flag is specified). [...]

tile_heightchanged optional :: int32
diagonal_tile_grid_sizenew optional :: TilePosition
autoplace optional :: AutoplaceSpecification

Used to specify the rules for placing this entity during map generation.

Used to specify the rules for placing this entity during map generation.

map_color optional :: Color
friendly_map_color optional :: Color
enemy_map_color optional :: Color
water_reflection optional :: WaterReflectionDefinition

May also be defined inside graphics_set instead of directly in the entity prototype. [...]

May also be defined inside graphics_set instead of directly in the entity prototype. [...]

ambient_sounds_groupnew optional :: EntityID
ambient_soundsnew optional :: WorldAmbientSoundDefinition or array[WorldAmbientSoundDefinition]
icon_draw_specificationnew optional :: IconDrawSpecification

Used to specify where and how should be the alt-mode icons of entities should be drawn.

Used to specify where and how should be the alt-mode icons of entities should be drawn.

icons_positioningnew optional :: array[IconSequencePositioning]

Inherited from Prototype
factoriopedia_alternative optional :: string

The ID type corresponding to the prototype that inherits from this. [...]

The ID type corresponding to the prototype that inherits from this. [...]

Inherited from PrototypeBase
type :: string

Specifies the kind of prototype this is. [...]

Specifies the kind of prototype this is. [...]

name :: string

Unique textual identification of the prototype. [...]

Unique textual identification of the prototype. [...]

order optional :: Order

Used to order prototypes in inventory, recipes and GUIs. [...]

Used to order prototypes in inventory, recipes and GUIs. [...]

localised_name optional :: LocalisedString

Overwrites the name set in the locale file. [...]

Overwrites the name set in the locale file. [...]

localised_description optional :: LocalisedString

Overwrites the description set in the locale file. [...]

Overwrites the description set in the locale file. [...]

factoriopedia_descriptionnew optional :: LocalisedString

Provides additional description used in factoriopedia.

Provides additional description used in factoriopedia.

subgroupnew optional :: ItemSubGroupID

The name of an ItemSubGroup.

The name of an ItemSubGroup.

hiddennew optional :: bool
hidden_in_factoriopedianew optional :: bool
parameternew optional :: bool

Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.

Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.

factoriopedia_simulationnew optional :: SimulationDefinition

The simulation shown when looking at this prototype in the Factoriopedia GUI.

The simulation shown when looking at this prototype in the Factoriopedia GUI.

Properties

stages :: AnimationVariations optional

Entity's graphics, using a graphic sheet, with variation and depletion. At least one stage must be defined.

When using AnimationVariations::sheet, frame_count is the amount of frames per row in the spritesheet. variation_count is the amount of rows in the spritesheet. Each row in the spritesheet is one stage of the animation.

stage_counts :: array[uint32]

Number of stages the animation has.

infinite :: bool optional

Default: false

If the ore is infinitely minable, or if it will eventually run out of resource.

highlight :: bool optional

Default: false

If the resource should be highlighted when holding a mining drill that can mine it (holding a pumpjack highlights crude-oil in the base game).

randomize_visual_position :: bool optional

Default: true

Whether there should be a slight offset to graphics of the resource. Used to make patches a little less uniform in appearance.

map_grid :: bool optional

Default: true

Whether the resource should have a grid pattern on the map instead of a solid map color.

draw_stateless_visualisation_under_building :: bool optional new

Default: true

minimum :: uint32 optional

Default: 0

Must be not 0 when infinite = true.

normal :: uint32 optional

Default: 1

Must be not 0 when infinite = true.

infinite_depletion_amount :: uint32 optional

Default: 1

Every time an infinite-type resource "ticks" lower it's lowered by that amount. -- Rseding91

resource_patch_search_radius :: uint32 optional

Default: 3

When hovering over this resource in the map view: How far to search for other resource patches of this type to display as one (summing amount, white outline).

category :: ResourceCategoryID optional

Default: "basic-solid"

The category for the resource. Available categories in vanilla can be found here.

walking_sound :: Sound optional

Sound played when the player walks over this resource.

driving_sound :: InterruptibleSound optional new

Sound played when a CarPrototype drives over this resource.

stages_effect :: AnimationVariations optional

An effect that can be overlaid above the normal ore graphics. Used in the base game to make uranium ore glow.

effect_animation_period :: float optional

Default: 0.0

How long it takes stages_effect to go from min_effect_alpha to max_effect_alpha.

effect_animation_period_deviation :: float optional

Default: 0.0

How much effect_animation_period can deviate from its original value. Used to make the stages effect alpha change look less uniform.

effect_darkness_multiplier :: float optional

Default: 1.0

How much the surface darkness should affect the alpha of stages_effect.

min_effect_alpha :: float optional

Default: 0.0

Minimal alpha value of stages_effect.

max_effect_alpha :: float optional

Default: 1.0

Maximal alpha value of stages_effect.

tree_removal_probability :: double optional

Default: 0

Must be greater than or equal to 0.

cliff_removal_probability :: double optional

Default: 1.0

Must be greater than or equal to 0.

tree_removal_max_distance :: double optional

Default: 0

Must be positive when tree_removal_probability is set.

mining_visualisation_tint :: Color optional

Defaults to the resources map color if left unset and map color is set, otherwise defaults to white if left unset.

Example

{
  type = "resource",
  name = "crude-oil",
  icon = "__base__/graphics/icons/crude-oil.png",
  icon_size = 32,
  flags = {"placeable-neutral"},
  category = "basic-fluid",
  order="a-b-a",
  infinite = true,
  highlight = true,
  minimum = 60000,
  normal = 300000,
  infinite_depletion_amount = 10,
  resource_patch_search_radius = 12,
  tree_removal_probability = 0.7,
  tree_removal_max_distance = 32 * 32,
  minable =
  {
    mining_time = 1,
    results =
    {
      {
        type = "fluid",
        name = "crude-oil",
        amount_min = 10,
        amount_max = 10,
        probability = 1
      }
    }
  },
  collision_box = {{ -1.4, -1.4}, {1.4, 1.4}},
  selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
  autoplace = resource_autoplace.resource_autoplace_settings{
    name = "crude-oil",
    order = "c", -- Other resources are "b"; oil won't get placed if something else is already there.
    base_density = 8.2,
    base_spots_per_km2 = 1.8,
    random_probability = 1/48,
    random_spot_size_minimum = 1,
    random_spot_size_maximum = 1, -- don't randomize spot size
    additional_richness = 220000, -- this increases the total everywhere, so base_density needs to be decreased to compensate
    has_starting_area_placement = false,
    resource_index = resource_autoplace.resource_indexes["crude-oil"],
    regular_rq_factor_multiplier = 1
  },
  stage_counts = {0},
  stages =
  {
    sheet =
    {
      filename = "__base__/graphics/entity/crude-oil/crude-oil.png",
      priority = "extra-high",
      width = 75,
      height = 61,
      frame_count = 4,
      variation_count = 1
    }
  },
  map_color = {r=0.78, g=0.2, b=0.77},
  map_grid = false
}

Prototypes

Types

Defines