Resource Spawner Overhaul

by orzelek
Overhauls resource spawning system.
10 days ago
0.14 - 0.17
925026

g New resource

- 5 months ago

Could you add the following to your mod ...
function filltermalConfig(config)
config["termal"] = {
type="resource-liquid",
minimum_amount=250000,
allotment=70,
spawns_per_region={min=1, max=1},
richness={min=250000, max=400000}, -- richness per resource spawn
size={min=1, max=1},
starting={richness=350000, size=1, probability=1},
multi_resource_chance=0.20,
}
end
This is a new resource, a geothermal source is being created, on which a geothermal generator can be placed.

- 5 months ago

I can but two things:
1. In version for 0.17 when it's updated.
2. I really need a mod name to test it and add guard based on it :D

- 5 months ago

Geothermal generator - I do not think that the mod will be popular, it is rather for myself.
In factorio 0.17, the fluids will change, so yes it will be necessary to redo it.
I added in my files
rso-mod_3.8.3 \ resourceconfigs \ mainconfig.lua
require ("resourceconfigs.geothermalgen")
if game.active_mods ["geothermalgen"] then
filltermalConfig (config)
end
rso-mod_3.8.3 \ resourceconfigs \ geothermalgen.lua
function filltermalConfig (config)
config ["termal"] = {
type = "resource-liquid",
minimum_amount = 250000,
allotment = 70,
spawns_per_region = {min = 1, max = 1},
richness = {min = 250000, max = 400000}, - richness per resource spawn
size = {min = 1, max = 1},
starting = {richness = 350000, size = 1, probability = 1},
multi_resource_chance = 0.20,
}
end

But you can not hurry at all, I found mistakes in my wonder-mode, and I don’t know how to solve it, it turns out in the starting area, the resource is constantly updated, becoming infinite.
All because of the call here of this event.
events.on_chunk_generated
but how to make the event triggered only once, I did not find.

- 5 months ago

Does your mod handle on_chunk_generated in some way?
RSO tends to have compatibility problems with mods that also operate on ores during that event. And RSO itself will not spawn resource twice (at least it shouldn't).

- 5 months ago

Unfortunately, I don’t know any programming language, I just look, think, change, analyze. The Lua textbook came to me not long ago, and that knowledge is not enough.

With the on_chunk_generated event, as I did not try to create a condition so that it happened only once, it did not work out.
The on_chunk_generated event generated a resource in the same place all the time, it turned into infinite, I refused it

Yesterday night sat crossing technology migration with the on_research_finished event
Added technology and now, when studying it, a resource appears in the starting area once. This is for those who play in the old save.
For a new game, the resource is generated like any other, you can select the settings in the settings as in any other.

script.on_event(defines.events.on_research_finished, function(event)
function reapply_research(force, research)
if force.technologies[research] and force.technologies[research].researched then
for ,effect in pairs(force.technologies[research].effects) do
local spawns_per_region={min=1, max=1}
local position = spawns_per_region
local area = {{ -2.8, -2.8}, {2.8, 2.8}}
local surface = game.surfaces[1].create_entity{ name = "termal", position = position, force=game.forces.player}
regen(event.area, event.surface)
end
force.print({"info.termal"})
end
end
for
, force in pairs(game.forces) do
force.reset_technologies()
force.reset_recipes()
for _,research in pairs({"termal"}) do
reapply_research(force, research)
end
end
end)

the regen function "regen (event.area, event.surface)" - gives the resource type, name, quantity, etc.
In general, it turned out.

- 5 months ago

I'd recommend going to forums with this and asking there.
It's much easier to discuss stuff there.

- 5 months ago

But I am absolutely not friends with English.
With the RSO, when added, it works fine, as it should. Without adding when enabled, the RSO mode creating a game does not add a resource because it does not find it in its files, it says about it in the message.
Initially, the idea of fashion was to temporarily give the opportunity at the beginning and middle of the game to generate more energy. If you study the technology, in any case, a resource will appear on the starting area, which is enough for 16 hours of real time if used intensively.

- 5 months ago

I'm sorry but you lost me there I think.
I have no idea what are you trying to do and RSO mod forums are not a place for coding help - thats what game forums are for.

- 5 months ago

Sorry, I was not going to bother you, if it happened, it was not from evil, but rather under the impression of recent events.

- 5 months ago
(updated 5 months ago)

I looked at your mod and it seems that you don't need RSO ore generation.
You are generating your resources yourself - you just need to disable base game ores. You can take a look at prototypes\prototype_utils.lua function resetRichness to see how it needs to be done in 0.17.
I've also added your resource names to ignore list in RSO so that it won't show errors about configs for them missing.

- 5 months ago

Yes, I agree, especially since there are problems with version 0.17. This is a desync of the maps and a mysterious error loading the save, after removing the mod. I informed people about known problems, a mod in a suspended state I would not recommend using it.