Prototype/ResourceEntity: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
(0.16)
Line 1: Line 1:
==Basics==
== Basics ==
A mineable/gatherable entity. An extension of [[Prototype/Entity]].
A mineable/gatherable entity. An extension of [[Prototype/Entity]].
==Properties==
== Properties ==
===category===
=== infinite ===
'''Type''': [[Types/string]]
'''Type''': [[Types/bool]]


The category for the resource.
'''Default''': false
  category = "basic-fluid"
===infinite===
'''Type''': [[Types/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===
=== highlight ===
'''Type''': [[Types/bool]]
'''Type''': [[Types/bool]]


If the ore appears on the map overview separately from large ore veins, or not. Default is False.
'''Default''': false


===minimum===
If the ore appears on the map overview separately from large ore veins, or not.
 
=== minimum ===
'''Type''': [[Types/uint]]
'''Type''': [[Types/uint]]


===normal===
'''Default''': 0
 
=== normal ===
'''Type''': [[Types/uint]]
'''Type''': [[Types/uint]]


===infinite_depletion_amount===
'''Default''': 1
 
=== infinite_depletion_amount ===
'''Type''': [[Types/uint]]
'''Type''': [[Types/uint]]


''Every time an infinite-type resource "ticks" lower it's lowered by that amount. If not given, it defaults to 1.'' -- [https://forums.factorio.com/viewtopic.php?t=47093&p=271243#p271115 Rseding91]
'''Default''': 1
 
''Every time an infinite-type resource "ticks" lower it's lowered by that amount.'' -- [https://forums.factorio.com/viewtopic.php?t=47093&p=271243#p271115 Rseding91]
 
=== stages ===
'''Type''': [[Types/AnimationVariations]]


===resource_patch_search_radius===
Entity's graphics, using a graphic sheet, with variation and depletion.
 
=== category ===
'''Type''': [[Types/string]]
 
'''Default''': basic-solid
 
The category for the resource. Avaible categories in vanilla can be found here: [[Data.raw#resource-category]]
 
=== map_grid ===
'''Type''': [[Types/bool]]
 
'''Default''': true
 
=== resource_patch_search_radius ===
'''Type''': [[Types/uint]]
'''Type''': [[Types/uint]]
===autoplace===
'''Type''': [[Types/AutoplaceSpecification]]


If -and how- the ore spawns automatically, and randomly.
'''Default''': 3
===map_color===
'''Type''': [[Types/color]]


The color of the ore, on the map.
=== stages_effect ===
'''Type''': [[Types/AnimationVariations]]


  map_color = {r=0, g=1, b=1} --This is Cyan.
=== effect_animation_period ===
===map_grid===
'''Type''': [[Types/float]]
'''Type''': [[Types/bool]]
 
'''Default''': 0.0
=== effect_animation_period_deviation ===
'''Type''': [[Types/float]]
 
'''Default''': 0.0
=== effect_darkness_multiplier ===
'''Type''': [[Types/float]]
 
'''Default''': 1.0
=== min_effect_alpha ===
'''Type''': [[Types/float]]
 
'''Default''': 0.0
=== max_effect_alpha ===
'''Type''': [[Types/float]]
 
'''Default''': 1.0
=== tree_removal_probability ===
'''Type''': [[Types/double]]
 
'''Default''': 0
=== tree_removal_max_distance ===
'''Type''': [[Types/double]]


===stage_counts===
'''Default''': 0
'''Type''': [[Types/table]]


see: [[Types/Stages]]
=== stage_counts ===
===stages===
'''Type''': [[Types/table]] of [[Types/uint]]
'''Type''': [[Types/Stages]]


Entity's graphics, using a graphic sheet, with variation and depletion.
Number of stages the animation has.


==example==
== Example ==
<syntaxhighlight lang="lua">{
  {
  type = "resource",
  name = "crude-oil",
  icon = "__base__/graphics/icons/crude-oil.png",
  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,
  minable =
   {
   {
    hardness = 1,
    mining_time = 1,
    results =
     {
     {
    type = "resource",
    name = "crude-oil",
    icon = "__base__/graphics/icons/crude-oil.png",
    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,
    minable =
    {
      hardness = 1,
      mining_time = 1,
      results =
       {
       {
         {
         type = "fluid",
          type = "fluid",
        name = "crude-oil",
          name = "crude-oil",
        amount_min = 10,
          amount_min = 10,
        amount_max = 10,
          amount_max = 10,
        probability = 1
          probability = 1
        }
       }
       }
     },
     }
    collision_box = {{ -1.4, -1.4}, {1.4, 1.4}},
  },
    selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
  collision_box = {{ -1.4, -1.4}, {1.4, 1.4}},
     autoplace =
  selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
  autoplace =
  {
    control = "crude-oil",
    sharpness = 0.99,
    max_probability = 0.02,
    richness_base = 240000,
    richness_multiplier = 300000,
    richness_multiplier_distance_bonus = 3000,
    coverage = 0.02, -- Cover on average 2% of surface area.
     peaks =
     {
     {
      control = "crude-oil",
      sharpness = 0.99,
      max_probability = 0.02,
      richness_base = 240000,
      richness_multiplier = 300000,
      richness_multiplier_distance_bonus = 3000,
      coverage = 0.02, -- Cover on average 2% of surface area.
      peaks =
       {
       {
         {
         noise_layer = "crude-oil",
          noise_layer = "crude-oil",
        noise_octaves_difference = -1,
          noise_octaves_difference = -1,
        noise_persistence = 0.4,
          noise_persistence = 0.4,
        }
       }
       }
     },
     }
    stage_counts = {0},
  },
     stages =
  stage_counts = {0},
  stages =
  {
     sheet =
     {
     {
       sheet =
       filename = "__base__/graphics/entity/crude-oil/crude-oil.png",
      {
      priority = "extra-high",
        filename = "__base__/graphics/entity/crude-oil/crude-oil.png",
      width = 75,
        priority = "extra-high",
      height = 61,
        width = 75,
      frame_count = 4,
        height = 61,
      variation_count = 1
        frame_count = 4,
     }
        variation_count = 1
      }
     },
    map_color = {r=0.78, g=0.2, b=0.77},
    map_grid = false
   },
   },
  map_color = {r=0.78, g=0.2, b=0.77},
  map_grid = false
},</syntaxhighlight>

Revision as of 10:46, 1 January 2018

Basics

A mineable/gatherable entity. An extension of Prototype/Entity.

Properties

infinite

Type: Types/bool

Default: false

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

highlight

Type: Types/bool

Default: false

If the ore appears on the map overview separately from large ore veins, or not.

minimum

Type: Types/uint

Default: 0

normal

Type: Types/uint

Default: 1

infinite_depletion_amount

Type: Types/uint

Default: 1

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

stages

Type: Types/AnimationVariations

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

category

Type: Types/string

Default: basic-solid

The category for the resource. Avaible categories in vanilla can be found here: Data.raw#resource-category

map_grid

Type: Types/bool

Default: true

resource_patch_search_radius

Type: Types/uint

Default: 3

stages_effect

Type: Types/AnimationVariations

effect_animation_period

Type: Types/float

Default: 0.0

effect_animation_period_deviation

Type: Types/float

Default: 0.0

effect_darkness_multiplier

Type: Types/float

Default: 1.0

min_effect_alpha

Type: Types/float

Default: 0.0

max_effect_alpha

Type: Types/float

Default: 1.0

tree_removal_probability

Type: Types/double

Default: 0

tree_removal_max_distance

Type: Types/double

Default: 0

stage_counts

Type: Types/table of Types/uint

Number of stages the animation has.

Example

{
  {
  type = "resource",
  name = "crude-oil",
  icon = "__base__/graphics/icons/crude-oil.png",
  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,
  minable =
  {
    hardness = 1,
    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 =
  {
    control = "crude-oil",
    sharpness = 0.99,
    max_probability = 0.02,
    richness_base = 240000,
    richness_multiplier = 300000,
    richness_multiplier_distance_bonus = 3000,
    coverage = 0.02, -- Cover on average 2% of surface area.
    peaks =
    {
      {
        noise_layer = "crude-oil",
        noise_octaves_difference = -1,
        noise_persistence = 0.4,
      }
    }
  },
  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
},