https://lua-api.factorio.com/latest/Con ... cification
Have you seen what that does? Try false and only adding the resource to your map_gen_settings.autoplace_controls when you're making your surface to see if that'd enable it
Noise expressions are the pseudo-math that pushes the buttons on the noise-expression calculator to make it give you back a value, which the engine turns into a yes/no/richness/etc. I've noticed there is another step, probably part of the deterministic noise/random process, which actually decides if the probability of the value is "enough" to turn it into an is/isnt. Not sure where that is, but the probability function returns a value, and it IS NOT that over some value like 1 makes something, and less than that to 0 doesn't. Negative values don't make stuff, so that's a reliable cut-off, and likewise, over 1 seems to be a 100% guarantee. In-between 0 and 1, no idea.
I was playing with noise expressions, and some don't like variables:
Edit: had wrong code section
Code: Select all
data:extend{
{
type = "noise-expression",
name = "evat",
intended_property = "elevation",
expression = {
type = "if-else-chain",
arguments = {
{
arguments = {
x = {
--literal_value = -120,
--type = "literal-number"
type = "variable",
variable_name = "x"
},
{
literal_value = 20,
type = "literal-number"
}
},
--literal_value = true,
function_name = "add",
type = "function-application"
},
{
literal_value = -100,
type = "literal-number"
},
{
literal_value = 100,
type = "literal-number"
}
}
}
}
}
end
If you do that, you get an error, but if you comment the variable part and put in the literal number, it works fine. I don't know if I had made a mistake, but it looks like that code should work, but it doesn't. I tried the noise.define_noise_expression function, and putting x for the first value to clamp also throws an error, while a number doesn't.
I think intended property refers to the properties in these:
https://lua-api.factorio.com/latest/Con ... enSettings
property_expression_names :: dictionary string → string: Overrides for tile property value generators. Values either name a NamedNoiseExpression or can be literal numbers, stored as strings (e.g. "5"). All other controls can be overridden by a property expression names. Notable properties:
moisture - a value between 0 and 1 that determines whether a tile becomes sandy (low moisture) or grassy (high moisture).
aux - a value between 0 and 1 that determines whether low-moisture tiles become sand or red desert.
temperature - provides a value (vaguely representing degrees Celsius, varying between -20 and 50) that is used (together with moisture and aux) as part of tree and decorative placement.
elevation - tiles values less than zero become water. Cliffs are placed along certain contours according to CliffPlacementSettings.
cliffiness - determines whether (when >0.5) or not (when <0.5) a cliff will be placed at an otherwise suitable (according to CliffPlacementSettings) location.
enemy-base-intensity - a number that is referenced by both enemy-base-frequency and enemy-base-radius. i.e. if this is overridden, enemy base frequency and size will both be affected and do something reasonable. By default, this expression returns a value proportional to distance from any starting point, clamped at about 7.
enemy-base-frequency - a number representing average number of enemy bases per tile for a region, by default in terms of enemy-base-intensity.
enemy-base-radius - a number representing the radius of an enemy base, if one were to be placed on the given tile, by default proportional to a constant plus enemy-base-intensity.
Looking there, there might be something VERY USEFUL!
All other MapGenSettings feed into named noise expressions, and therefore placement can be overridden by including the name of a property in this dictionary. The probability and richness functions for placing specific tiles, entities, and decoratives can be overridden by including an entry named {tile|entity|decorative}:(prototype name):{probability|richness}.
Code: Select all
local surface = game.player.surface
local mgs = surface.map_gen_settings
mgs.property_expression_names["tile:grass1:probability"] = "my-alternate-grass1-probability"
surface.map_gen_settings = mgs
We could try setting the default resource's probability expression to one that does nothing if default_enabled doesn't work in a useful (to us) way, and then try entity:myresource:probability to whatever noise expression we want (either or both probability/richness)
Edit: see code section, had wrong stuff copied