Limit ruin spawning to individual planets

Place to get help with not working mods / modding interface.
Keysivi
Fast Inserter
Fast Inserter
Posts: 110
Joined: Mon Feb 07, 2022 5:29 pm
Contact:

Limit ruin spawning to individual planets

Post 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!
Attachments
AbandonedRuins-base_0.0.1.zip
(118.8 KiB) Downloaded 24 times
Natha
Filter Inserter
Filter Inserter
Posts: 259
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: Limit ruin spawning to individual planets

Post 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
Keysivi
Fast Inserter
Fast Inserter
Posts: 110
Joined: Mon Feb 07, 2022 5:29 pm
Contact:

Re: Limit ruin spawning to individual planets

Post 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
Attachments
control(AbandonedRuins-base).lua
There is a solution
(9.91 KiB) Downloaded 14 times
control(AbandonedRuins_updated_fork).lua
Need to add a solution
(9.8 KiB) Downloaded 12 times
Post Reply

Return to “Modding help”