TrainsSignalSender deprecated

by Hermios

Associate signals to a train

Content
4 years ago
0.15.10 - 0.18
11
Transportation

b Crash with Factorio 0.18.13

4 years ago

Hi! The latest upgrade of Factorio broke your mod again. Clicking on a locomotive in automatic mode brought me this:

Error while running event TrainsSignalSender::on_gui_opened (ID 83)
Unknown style logistic_button_slot
stack traceback:
    __HermiosLibs__/guiLibs.lua:154: in function 'addToGui'
    __HermiosLibs__/guiLibs.lua:184: in function 'addToGui'
    __HermiosLibs__/guiLibs.lua:178: in function 'addToGui'
    __HermiosLibs__/guiLibs.lua:124: in function 'InitOpeningGui'
    __HermiosLibs__/controlLib.lua:173: in function <__HermiosLibs__/controlLib.lua:148>

(Guess I should check now if my mods are concerned as well. They've been loading alright so far, but so did yours…)

4 years ago

Hoi
Arf, they changed styles... Ok. I check this week end. (If you use styles, you will definitely have a crash)
THanks for this
Niko

4 years ago

Hi, Niko! Thanks for looking into it. By the way, Autodrive has a GUI, and I've found the "style" property in the code (the owner created the GUI, I'm just collaborating), but it didn't crash yet. I've run into another crash though which appeared quite randomly (it happened occasionally after the update, but I couldn't reliably reproduce it). Hopefully, it is fixed now. :-D

3 years ago

Unfortunately, I've had a look at the error again and found out what's wrong. (Well, it's at least unfortunate for the users of my mods, because I don't have a reason not to play any more, so I won't have time to maintain my mods. :-D)

Anyway, to fix the crash, you need to edit the file guiLibs.lua from HermiosLibs_0.2.0:

function InitGuiLibs(init)
if init then
    global.LuaGuiElementsData=global.LuaGuiElementsData or {}
end
RemoveButton=LuaGuiObject:new {type="button",name="removeButton",caption="X",style="logistic_button_slot",onAction=OnRemove}
AddButton=LuaGuiObject:new {type="button",name="addButton",caption="+",style="logistic_button_slot",onAction=OnAdd}
end

The style name must be changed from "logistic_button_slot" to "logistic_slot_button" for both buttons -- that should be enough!

3 years ago

Hi Pi-C
Did you try your solution? Many thanks anyway for this, this will avoid me to spare time on research :)
Niko

3 years ago

Hi, Niko! I loaded my game (that always worked), and clicked on a locomotive (that would reliably result in a crash). Both your signaĺs' GUI and the vanilla train GUI opened successfully, I could add new signals and remove existing ones, or change their value. So I guess it works now. :-)

New response