I have been able to reproduce this one and I know the cause.
I've been trying out this mod today and I've noticed that every time I load the game, none of the effects are in effect...
So I delved into the code, and in the control.lua file it had:
script.on_event(defines.events.on_research_finished, function(event)
local research = event.research
local force = research.force
local name = research.name
if name == "basiccraftspeed-1" then force.manual_crafting_speed_modifier = force.manual_crafting_speed_modifier+0.1 end
if name == "basiccraftspeed-2" then force.manual_crafting_speed_modifier = force.manual_crafting_speed_modifier+0.1 end
...
This... is entirely wrong, specifically it is modifying the force values directly. You should be using research effects.
First let me explain why this is wrong. By modifying the effects directly then any time any mod configuration is changed (a mod setting changed, a mod updated, a mod added/removed, as I've been doing today to test mods and gameplay for my server) and that mod does anything to research effects (specifically calling reset_technology_effects
, as quite a few mods do to resynch research), then any custom changes to the effects are wiped out and resynched back with research effects.
Second, to explain why research effects should be used. As you see right now a research has a description, but it has no little squares saying exactly what it does, where if you look at, say, an inserter stack upgrade you see the little square (with the vanilla plus icon) saying that it performs an effect, specifically it adjusts the inserter stack capacity by +1. Those kind of effects would work for any adjustable effect. Thus by using research effects you will get those little squares saying what happens. Second, and the big reason, any time the research effects are resynched then everything will 'just work' without suddenly vanishing.
I 'think' everything this mod does is usable in that way, if it is not then you can continue your current style, except instead of setting the effect straight, you should also record what your current effect modification is in your global storage, then on every 'configuration change' hook (and I think one other but I cannot recall off hand, you need to be very careful about this part) then apply those effects again but be careful as those callbacks can be called back multiple times (so you'd probably want to set a 'dirty' flag on your global store and apply the modifications again on the next game tick). However this method also breaks if absolutely no mod calls reset_technology_effects
on a configuration change (and whatever that other hook is...), so if you need to go this route then I'd say you yourself call reset_technology_effects
on configuration change, on game load, on new game, on basically every time where it really makes sense, then set your dirty flag and apply the updates on the next game tick (never change effects in the same tick that reset_technology_effects
is run because another mod will likely be doing it in the same tick after you too, thus resetting your work), and even then there are still corner cases where your current method will not work even after all these fixes, such as if it is called out-of-band (like reset_technology_effects
being called during normal gameplay, like if an admin calls it or so).