Page 1 of 1

Limit ruin spawning to individual planets

Posted: Tue Jan 28, 2025 7:23 pm
by Keysivi
At one time, I created a fork for the updated for Factorio 2.0 mod The Ruins Mod https://mods.factorio.com/mod/Abandoned ... dated_fork

For more flexibility, I separated the ruins from this mod into a separate submod The Ruins Mod - Base (Time) https://mods.factorio.com/mod/AbandonedRuins-base

Unfortunately, a small problem emerged when, for example, on Vulcanus, where there is no water, ruins with water began to spawn, which completely breaks the entire narrative of the game.

Since I am a lousy programmer - I need help to limit the spawn of ruins from the mod The Ruins Mod - Base (Time) https://mods.factorio.com/mod/AbandonedRuins-base to only two planets Navius ​​and Gleba...

Or, on the contrary - to prohibit the spawn of ruins from this mod on specific planets, for example Vulcanus...

The archive with the mod is attached to the message.

I will be very grateful for help!

Thank you!

Re: Limit ruin spawning to individual planets

Posted: Thu Jan 30, 2025 9:38 am
by Natha
WIthout looking into your code, you could check the planet's map_gen_settings.autoplace_settings if the water tile will be generated there:
https://github.com/wube/factorio-data/b ... ap-gen.lua

Re: Limit ruin spawning to individual planets

Posted: Mon Feb 10, 2025 10:41 am
by Keysivi
Natha wrote: Thu Jan 30, 2025 9:38 am WIthout looking into your code, you could check the planet's map_gen_settings.autoplace_settings if the water tile will be generated there:
https://github.com/wube/factorio-data/b ... ap-gen.lua
Thanks for the advice! But this is not what is needed. Water is only a private problem with one specific submod.

But if new submods appear, then completely different logical problems may arise there.

Therefore, the optimal option is to set the condition for the spawn of ruins in each separate submod: the name of a specific planet.

-----------------------------------------

In the correspondence https://mods.factorio.com/mod/Abandoned ... 29d61c2808 A solution was found that already exists in the base mod:

Code: Select all

local function init()
  util.set_enemy_force_cease_fire(util.get_enemy_force(), not settings.global["AbandonedRuins-enemy-not-cease-fire"].value)
  spawn_chances()
  if storage.spawn_ruins == nil then
    storage.spawn_ruins = true
  end
  storage.ruin_queue = storage.ruin_queue or {}
  if not storage.excluded_surfaces then
    storage.excluded_surfaces = {
      ["beltlayer"] = true,
      ["pipelayer"] = true,
      ["Factory floor"] = true, -- factorissimo
      ["ControlRoom"] = true -- mobile factory
    }
  end
end

script.on_init(init)
script.on_configuration_changed(init)
script.on_event(defines.events.on_runtime_mod_setting_changed, init)
But it works for all submods at the same time.

But in our case, we need to register this condition in each separate submod.

But I don't know how to transfer the above solution to a separate submod...

-----------------------------------------

Just in case, the control.lua files of the main mod are attached, where there is the above function and control.lua of the separate ruins submod, where you need to write something similar