Time to sleep


This Factorio mod allows you to sleep at night Multiplayer ready

Utilities
2 years ago
1.1
508

b [fixed] compatibility

2 years ago

In the mod all gui elements in screen are destroyed, which breaks other mods with things in screen. One should only destroy gui elements you know are yours.

But one example: https://i.imgur.com/eP5hvXn.jpeg

2 years ago
(updated 2 years ago)

I have some tweaks which should fix it on your side, but it won't help any mods that don't rebuild their GUI every on_configuration_changed:

1) changed destroy_gui to destroy_main_gui on many lines
2) changed the name on line 32 to name="TTS_main"..index,

3)Changed the last function to:
function destroy_main_gui(screen)
  for num,elm in pairs(screen.children) do
    if string.find(elm.name, "TTS_main") then
      elm.destroy()
    end
  end
end

2 years ago

Forgot to add: if someone has a sleep gui open, this fix won't delete that sleep gui. I'm in the Factorio #mod-making room a lot, as well are other people who can offer advice.

2 years ago

This fixes seems to help out but when somebody uses this Mod + Milestones ones read through this thread please: https://mods.factorio.com/mod/Milestones/discussion/62fd06d6663e048f964062bd

THere are two commands in the mod which helped me out.

2 years ago
(updated 2 years ago)

I have some tweaks which should fix it on your side, but it won't help any mods that don't rebuild their GUI every on_configuration_changed:

1) changed destroy_gui to destroy_main_gui on many lines
2) changed the name on line 32 to name="TTS_main"..index,

3)Changed the last function to:
function destroy_main_gui(screen)
  for num,elm in pairs(screen.children) do
    if string.find(elm.name, "TTS_main") then
      elm.destroy()
    end
  end
end

Thanks for the support, I'm pretty new at modding and I didn't realize that this could be a problem until I ran into it. Anyway I fixed destroying only elements of this mod, as you suggested.

This thread has been locked.