Abandoned Ruins - Updated (core)

by Keysivi

This mod doesn't do anything by itself. You need to install ruin-set mods or no ruin will be spawned. It then can spawn randomly choosen ruins in the world. These ruins are destroyed fragments of bases, forts, small oases, and more. (Now co-authored with roland77)

Content
5 days ago
2.0
4.50K

b [CONSIDERATION] Got a ruin with water spawn on Vulcanus

7 months ago

I just got a small patch of water with some pipes and a fluid tank on Vulcanus. One of the main challenges on Vulcanus is the lack of water; maybe some ruins need to be blocked on different planets?

7 months ago

Unfortunately, I can't do anything about it yet. I don't have enough knowledge to write scripts myself...

And this will obviously require quite a lot of work on programming and writing a large number of possible conditions and filtering criteria... Which is most likely simply unrealistic and wrong

I updated this mod to Factorio 2.0 only because its author refused to do so. And third-party programmers helped me a lot with this.

That's why I separated a set of old ruins into a separate submod so that third-party modders and users could create their own ruin packages according to their own preferences...

I will make a request on the forum for help so that the ruins from the corresponding submod spawn only on Navius ​​and Gleb. If they help me, I will make the appropriate adjustments...

6 months ago

Unfortunately, I can't do anything about it yet. I don't have enough knowledge to write scripts myself...

And this will obviously require quite a lot of work on programming and writing a large number of possible conditions and filtering criteria... Which is most likely simply unrealistic and wrong

I updated this mod to Factorio 2.0 only because its author refused to do so. And third-party programmers helped me a lot with this.

That's why I separated a set of old ruins into a separate submod so that third-party modders and users could create their own ruin packages according to their own preferences...

I will make a request on the forum for help so that the ruins from the corresponding submod spawn only on Navius ​​and Gleb. If they help me, I will make the appropriate adjustments...

I found a way to make it only spawn on nauvis. I went into control.lua and under line 32 simply added:
["aquilo"] = true,
["fulgora"] = true,
["gleba"] = true,
["vulcanus"] = true,

Just remove or add planet names to make ruins spawn on them or not.

6 months ago

As they say: All ingenious is simple! Thanks for the advice! Unfortunately, this solution is not quite suitable. It is good as long as we have a set of basic ruins.

But it was originally assumed that other modders could also create their own ruins... Including for planets like Vulcanus.

The optimal solution was to make this function not in the main ruins mod, but in each ruins submod separately.

That is, you need to register a similar function specifically in this submod https://mods.factorio.com/mod/AbandonedRuins-base

Since other submods will have to be created on its basis

a month ago

Hmm, I also still want some ruins appaear outside Nauvis. Yes, this mod breaks that challenge of not having liquid water but in form of ice in the Fulgora remains around. I might have an idea on how we can fix this:

  • If it is Nauvis, spawn water tile
  • If it is Fulgora, spawn heavy oil tile
  • If it is Vulcanus, spawn lava tile
  • If ...

And so on with other planets. Yet this feels very static. Some planet mods might want to do the same, not having water as a challenge. I can check if there is an option in data structures to distinguish between water and other "ocean" tiles.

a month ago

Ah, here is one: water_tile_type_names. I need to look further into this, it might be the right approach (non-static checks).

a month ago
(updated a month ago)

I would like to clarify that there can be many filtration parameters. Not just water. Each planet has its own exclusive elements that are not found on other planets, but can appear in new ruins packs. Not to mention that there are a large number of planets and surfaces from mods, with their own exclusive elements. And these can be not only landscape elements, but also buildings.

I'm afraid that if we go this route, it will be too complicated and cumbersome.

I would suggest giving users and developers of ruins packs the opportunity to choose which ruins
should be generated on which planets and surfaces.

That is, to add filtration not to the main core of the mod. But to add it as an option directly to the ruins pack template. And as a filtration, write down - on which planets and surfaces this ruins pack can be generated, and on which it cannot.

And if you want to put in more effort, you can add planet and surface selection to the ruins pack template as additional settings for users.

a month ago
(updated a month ago)

The list of allowed "planets" - they are surfaces in Factorio - can be added at a per-ruin basis.

I propose this change:
- no key spawn_on_surfaces provided = All surfaces are accepted except storage.excluded_surfaces
- if key spawn_on_surfaces is provided, check if current surface is listed and true, storage.excluded_surfaces is ignored then

That is the most flexible way. And you are right about replacing water->heavy oil on Fulgora etc. The information the game is lacking is a ocean_tile = "water", e.g. for Nauvis. Then I could perfectly compare that key with "water" and if it mismatches, replace it with the provided tile type.

Now I only need to provide a simple API for developers to allow ruins with water being spawned on their planets/moons, too.

a month ago
(updated a month ago)

storage.excluded_surfaces is ALWAYS respected, a mod developer can always exclude his "planet/moon" from it

This is completely backwards. The global exclusion must only apply to ruins that don't specify a given planet as allowed to spawn on.
A ruin would only specify an allowed planet if the ruin was adapted to a planet that should disallow generic ruins.
I also believe there should be a special allowed_surfaces key for when a ruin is adapted for specific planet(s) but also fine to use on Nauvis and Co (planets that don't exclude generic ruins).

a month ago
(updated a month ago)

Yes, sorry. No sleep here ... 😂😂😂

EDIT: Updated my proposed changes.

a month ago
(updated a month ago)

We need to consider 3 types of ruins:
1. Generic ruins for surfaces without limitations applied
2. Ruins specific to a planet(s), when spawned on different planets e.g Nauvis it would be nonsensical or over powered or even break something
3. Ruins that are adjusted to specific planet(s) but work fine on planets that don't apply limitations. E.g when there is a planet that wants to ban using certain standard entities on it, a ruin honoring that (without containing anything unapplicable on other planets) would still be fine on Nauvis.

a month ago

I think it would be best to also add boolean only_on_allowed_surfaces. If not set or false the ruin will also spawn where generic ruins do.

a month ago
(updated a month ago)

I don't understand what you mean by all this? Can you please show some code? storage.excluded_surfaces is checked in on_chunk_generated (where no individual ruin is being checked) while spawn_on_surfaces is a per-ruin key (it goes into e.g. ruins/small/fishHole.lua where a lot of water tiles are used.

My proposal also allows the other way around: Spawn on all surfaces (not on internals in storage.excluded_surfaces e.g.) and exclusively on a surface. Exclusive spawning means that no other ruins will spawn there but also the exclusive ruin-set's ruins will not spawn on any other surfaces.

The check my code will do is this:

if storage.exclusive_ruinset[event.surface.name] ~= nil and ruinset_name ~= storage.exclusive_ruinset[event.surface.name] then
  -- Surface has exclusive ruinset registered and the current ruin-set's name isn't matching with it.
  return
end
a month ago

Example situation:
Vulcanus is added to storage.excluded_surfaces.
Some modder looks through 'base' ruin set and decides that 'SOS' ruin would fit on Vulcanus, so they want to make it spawn on Vulcanus without stopping 'SOS' from spawning on all other surfaces.

a month ago
(updated a month ago)

ruinset_name ~= storage.exclusive_ruinset[event.surface.name]

There is only one ruin set in use at a time vs multiple surfaces. This would only work on exactly one surface.

a month ago
(updated a month ago)

What I'm proposing is:
adding optional table spawn_on_surfaces and optional boolean only_on_specified_surfaces to per ruin format
moving surface check to spawn_ruin().

a month ago

I'm not getting what you want here? There is already a remote-call function spawn_exclusively_on(surface_name, ruinset_name) which registers the whole ruin-set mod as an exclusive ruin-set to a surface.

For example:
- You can create a ruin-set mod for planet Fulgora as it contains entities (e.g. rocks, other ruins, machines) you only want to be spawned on Fulgora
- then just invoke that remote-call function and only your ruin-set will spawn on Fulgora and nowhere else

I guess what you means is such an option on a per-ruin basis? I guess this makes the code more complicated as the whole ruin-sets must be scanned prior spawning them or else you have ruins spawned on an exclusive planet you don't want there. And you can let your ruins (per-ruin basis) spawn on specific planets only while allowing other ruins to spawn as well. That is provided by spawn_on_surfaces key.

a month ago

A better solution here is to create two mods:
- one that holds the exclusive ruins and invokes spawn_exclusively_on()
- and the other mod with all non-exclusive ("regular") ruins which still can have the spawn_on_surfaces key being used

New response