Prototype/ResourceEntity: Difference between revisions
(Changed links going to the redirect Types/uint to go to Types/uint32.) |
(separated properties into optional and mandatory) |
||
Line 1: | Line 1: | ||
== Basics == | == Basics == | ||
A mineable/gatherable entity. | A mineable/gatherable entity. Extends [[Prototype/Entity]]. | ||
== | |||
== Mandatory properties == | |||
This prototype inherits all the properties from [[Prototype/Entity]]. | |||
=== stages === | |||
'''Type''': [[Types/AnimationVariations]] | |||
Entity's graphics, using a graphic sheet, with variation and depletion. At least one stage must be defined. | |||
=== stage_counts === | |||
'''Type''': [[Types/table]] of [[Types/uint32]] | |||
Number of stages the animation has. | |||
== Optional properties == | |||
=== infinite === | === infinite === | ||
'''Type''': [[Types/bool]] | '''Type''': [[Types/bool]] | ||
Line 8: | Line 23: | ||
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]] | ||
Line 19: | Line 35: | ||
'''Default''': 0 | '''Default''': 0 | ||
Must be not 0 when <code>infinite = true</code>. | |||
=== normal === | === normal === | ||
Line 24: | Line 42: | ||
'''Default''': 1 | '''Default''': 1 | ||
Must be not 0 when <code>infinite = true</code>. | |||
=== infinite_depletion_amount === | === infinite_depletion_amount === | ||
Line 31: | Line 51: | ||
''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] | ''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] | ||
=== category === | === category === | ||
'''Type''': [[Types/string]] | '''Type''': [[Types/string]] | ||
'''Default''': basic-solid | '''Default''': "basic-solid" | ||
The category for the resource. Available categories in vanilla can be found here: [[Data.raw#resource-category]] | The category for the resource. Available categories in vanilla can be found here: [[Data.raw#resource-category]] | ||
Line 59: | Line 74: | ||
'''Type''': [[Types/AnimationVariations]] | '''Type''': [[Types/AnimationVariations]] | ||
=== effect_animation_period === | === effect_animation_period === | ||
'''Type''': [[Types/float]] | '''Type''': [[Types/float]] | ||
'''Default''': 0.0 | '''Default''': 0.0 | ||
=== effect_animation_period_deviation === | |||
=== effect_animation_period_deviation === | |||
'''Type''': [[Types/float]] | '''Type''': [[Types/float]] | ||
'''Default''': 0.0 | '''Default''': 0.0 | ||
=== effect_darkness_multiplier === | |||
=== effect_darkness_multiplier === | |||
'''Type''': [[Types/float]] | '''Type''': [[Types/float]] | ||
'''Default''': 1.0 | '''Default''': 1.0 | ||
=== min_effect_alpha === | === min_effect_alpha === | ||
'''Type''': [[Types/float]] | '''Type''': [[Types/float]] | ||
'''Default''': 0.0 | '''Default''': 0.0 | ||
=== max_effect_alpha === | === max_effect_alpha === | ||
'''Type''': [[Types/float]] | '''Type''': [[Types/float]] | ||
'''Default''': 1.0 | '''Default''': 1.0 | ||
=== tree_removal_probability === | === tree_removal_probability === | ||
'''Type''': [[Types/double]] | '''Type''': [[Types/double]] | ||
'''Default''': 0 | '''Default''': 0 | ||
Must be positive. | |||
=== tree_removal_max_distance === | === tree_removal_max_distance === | ||
'''Type''': [[Types/double]] | '''Type''': [[Types/double]] | ||
Line 88: | Line 111: | ||
'''Default''': 0 | '''Default''': 0 | ||
Must be positive when <code>tree_removal_probability</code> is set. | |||
== Example == | == Example == | ||
<syntaxhighlight lang="lua">{ | <syntaxhighlight lang="lua">{ | ||
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 = | |||
{ | { | ||
hardness = 1, | |||
mining_time = 1, | |||
results = | |||
{ | { | ||
type = "fluid", | { | ||
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 = | |||
{ | { | ||
order = "b", | |||
control = "crude-oil", | |||
sharpness = 0.99, | |||
max_probability = 0.02, | |||
richness_base = 240000, | |||
richness_multiplier = 300000, | |||
richness_multiplier_distance_bonus = 1500, | |||
coverage = 0.001 / 3, | |||
peaks = | |||
{ | { | ||
noise_layer = "crude-oil", | { | ||
noise_layer = "crude-oil", | |||
noise_octaves_difference = -0.5, | |||
noise_persistence = 0.4 | |||
} | |||
} | } | ||
}, | |||
stage_counts = {0}, | |||
stages = | |||
{ | { | ||
filename = "__base__/graphics/entity/crude-oil/crude-oil.png", | sheet = | ||
{ | |||
filename = "__base__/graphics/entity/crude-oil/crude-oil.png", | |||
priority = "extra-high", | |||
width = 75, | |||
height = 61, | |||
frame_count = 4, | |||
variation_count = 1 | |||
} | |||
}, | |||
},</syntaxhighlight> | map_color = {r=0.78, g=0.2, b=0.77}, | ||
map_grid = false | |||
},</syntaxhighlight> |
Revision as of 11:30, 25 June 2018
Basics
A mineable/gatherable entity. Extends Prototype/Entity.
Mandatory properties
This prototype inherits all the properties from Prototype/Entity.
stages
Type: Types/AnimationVariations
Entity's graphics, using a graphic sheet, with variation and depletion. At least one stage must be defined.
stage_counts
Type: Types/table of Types/uint32
Number of stages the animation has.
Optional 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/uint32
Default: 0
Must be not 0 when infinite = true
.
normal
Type: Types/uint32
Default: 1
Must be not 0 when infinite = true
.
infinite_depletion_amount
Type: Types/uint32
Default: 1
Every time an infinite-type resource "ticks" lower it's lowered by that amount. -- Rseding91
category
Type: Types/string
Default: "basic-solid"
The category for the resource. Available categories in vanilla can be found here: Data.raw#resource-category
map_grid
Type: Types/bool
Default: true
resource_patch_search_radius
Type: Types/uint32
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).
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
Must be positive.
tree_removal_max_distance
Type: Types/double
Default: 0
Must be positive when tree_removal_probability
is set.
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 =
{
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 =
{
order = "b",
control = "crude-oil",
sharpness = 0.99,
max_probability = 0.02,
richness_base = 240000,
richness_multiplier = 300000,
richness_multiplier_distance_bonus = 1500,
coverage = 0.001 / 3,
peaks =
{
{
noise_layer = "crude-oil",
noise_octaves_difference = -0.5,
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
},