Reload mod(s)

Things that we aren't going to implement
Post Reply
ForFoxAche
Burner Inserter
Burner Inserter
Posts: 19
Joined: Tue Aug 19, 2014 12:47 pm
Contact:

Reload mod(s)

Post by ForFoxAche »

Control.lua is loaded whenever you start a game, but "static" things like recipes and items don't reload until you restart the game.

It takes me about 14 seconds to start Factorio, 2 of those are spent loading mods and the rest is just loading sprites. So even if there's a button to reload every single mod it would still save a bunch of time.

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: Reload mod(s)

Post by cube »

Reloading mods during runtime is definitely on a long range todo list, but it is more complicated than you say. Basically everything in factorio is a mod. Menu apperance, for example. And all sprites come from mods. So if you reloaded mods you would also have to reload all graphics (some tricks could be used to speed this up, but generally everything has to be reloaded). This is doable, but not simple.

User avatar
MagicLegend
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Tue Dec 30, 2014 6:17 pm
Contact:

Re: Reload mod(s)

Post by MagicLegend »

But it would be superduper useful for every modder. Having to restart the game every time you redone the shadows of your object is a real nuisance...
Very good at pressing buttons.

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: Reload mod(s)

Post by StanFear »

what about reloading one single mod ?

reloading mods is usefull to test WIP mods, but as far as I know, when a modification is made, it is not on all mods

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Reload mod(s)

Post by kovarex »

As you would have to reload the graphics anyway, it wouldn't save any time.

If you are testing just the scripting of the mod, you don't need to restart the game (I believe).

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Reload mod(s)

Post by Rseding91 »

kovarex wrote:As you would have to reload the graphics anyway, it wouldn't save any time.

If you are testing just the scripting of the mod, you don't need to restart the game (I believe).
Correct. Control.lua is re-loaded every time a game is loaded. That's 90% of what needs constant adjusting while modding.
If you want to get ahold of me I'm almost always on Discord.

Maharaja
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Mar 15, 2016 3:45 pm
Contact:

Re: Reload mod(s)

Post by Maharaja »

yeah i think a /modreload <modname> will be nice to have for development off mods

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Reload mod(s)

Post by Rseding91 »

Maharaja wrote:yeah i think a /modreload <modname> will be nice to have for development off mods
It's not possible unless the mod adds no prototypes and then at that point it's not needed.

The result of one mod loading changes the result of the next so you can't "hot reload" one mod without reloading all of them and at that point it's identical to restarting the game.
If you want to get ahold of me I'm almost always on Discord.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Reload mod(s)

Post by sparr »

Rseding91 wrote:
kovarex wrote:As you would have to reload the graphics anyway, it wouldn't save any time.

If you are testing just the scripting of the mod, you don't need to restart the game (I believe).
Correct. Control.lua is re-loaded every time a game is loaded. That's 90% of what needs constant adjusting while modding.
Is this information still current? Everything prior to that comment in this thread was from 2 years ago. I am not currently able to make control.lua changes take effect in game without restarting the game.

I am also not able to get un-zipped mods to work in 0.15 (not sure if they worked in 0.14 either).

What is the correct workflow to be able to update control.lua in a mod without having to exit all the way out of factorio to reload it?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Reload mod(s)

Post by Rseding91 »

sparr wrote:
Rseding91 wrote:
kovarex wrote:As you would have to reload the graphics anyway, it wouldn't save any time.

If you are testing just the scripting of the mod, you don't need to restart the game (I believe).
Correct. Control.lua is re-loaded every time a game is loaded. That's 90% of what needs constant adjusting while modding.
Is this information still current? Everything prior to that comment in this thread was from 2 years ago. I am not currently able to make control.lua changes take effect in game without restarting the game.

I am also not able to get un-zipped mods to work in 0.15 (not sure if they worked in 0.14 either).

What is the correct workflow to be able to update control.lua in a mod without having to exit all the way out of factorio to reload it?
Yes it's still correct. I use un-zipped mods all the time to test bugs/desyncs/develop mod code.

Control.lua is re-loaded every time you load a save file.
If you want to get ahold of me I'm almost always on Discord.

ignatio
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Mon Jun 27, 2016 3:59 pm
Contact:

Re: Reload mod(s)

Post by ignatio »

Apologies for necro'ing an old thread, but since this is the top search hit for "factorio reload mod" and is in "Won't implement", I thought it worth pointing out that there is a function to simplify mod reloading. From the LuaGameScript docs:

reload_mods()
Forces a reload of all mods.

Note: This will act like saving and loading from the mod(s) perspective.
Note: This will do nothing if run in multiplayer.
Note: This disables the replay if replay is enabled.

So "/c game.reload_mods()" does the trick, as far as I'm concerned.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Reload mod(s)

Post by Rseding91 »

ignatio wrote:
Sat May 04, 2019 2:11 pm
Apologies for necro'ing an old thread, but since this is the top search hit for "factorio reload mod" and is in "Won't implement", I thought it worth pointing out that there is a function to simplify mod reloading. From the LuaGameScript docs:

reload_mods()
Forces a reload of all mods.

Note: This will act like saving and loading from the mod(s) perspective.
Note: This will do nothing if run in multiplayer.
Note: This disables the replay if replay is enabled.

So "/c game.reload_mods()" does the trick, as far as I'm concerned.
That's just reloading control.lua - not reloading data.lua or anything in that stage.
If you want to get ahold of me I'm almost always on Discord.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Reload mod(s)

Post by sparr »

kovarex wrote:
Thu Apr 09, 2015 9:45 am
As you would have to reload the graphics anyway, it wouldn't save any time.
If you are playing via Steam, the built in game relaunch functionality (used when there is a mod load error, or mods are updated) skips the steam cloud sync step, which can take many seconds sometimes. Those seconds would be saved with a relaunch button.

Post Reply

Return to “Won't implement”