[2.0] Customise circuit connection dialog

Place to get help with not working mods / modding interface.
pindab0ter
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Nov 01, 2024 12:27 pm
Contact:

[2.0] Customise circuit connection dialog

Post by pindab0ter »

I'm working on updating and improving the
UPS Friendly Nixie Tube Display
mod. The Nixie Tubes are an extension of a Lamp, which means it inherits its circuit connection section as well.

What it looks like now
What it looks like now
Screenshot 2024-11-02 144708.png (62.42 KiB) Viewed 233 times

This is what I would like to achieve:
  • Remove the lamp specific section (Use colors/Color mapping/Color components/Packed RGB)
  • Keep the Enable/disable section
  • Add a section where you can select the signal which value you would like to display on the nixie tube(s)
If possible, I would like to also open that signal selection dialog when you click on it when no selection is made, much like you get a dialog when clicking on an assembler that doesn't have a recipe set.

Can anyone help me out with how to go about this? I'm a software engineer so I'm well at home with programming in general. I got the mod to a state where it works. I'm just not familiar with the Factorio API and how to approach this.

What parts of this go in the prototypes? What part is runtime behaviour? What are the relevant parts of the API? How would you approach this?
Dubstep Squirrel
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 30, 2024 8:32 pm
Contact:

Re: [2.0] Customise circuit connection dialog

Post by Dubstep Squirrel »

After giving the documentation a look, you can probably turn off color using LuaLampControlBehavior::use_colors. You would add this in the Runtime stage. For the nixie tube mod you linked, my best guess is adding the code in the control.lua file in "gizmatize_nixie" which appears to be the main onPlaceEntity function.
pindab0ter
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Nov 01, 2024 12:27 pm
Contact:

Re: [2.0] Customise circuit connection dialog

Post by pindab0ter »

Thank you for your suggestion. Unfortunately, that only unchecks the box, which is not what I'm looking for. In the meantime I've come across the Untitled GUI Guide that helped me out massively, as well as looking at how raiguard has done the custom GUI for the Infinity Accumulator.

TL;DR: You intercept the on_gui_opened event, detect if it's the entity you're interested in (in my case one of the Nixie Tubes) and then replace it with your own custom GUI.
Dubstep Squirrel
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 30, 2024 8:32 pm
Contact:

Re: [2.0] Customise circuit connection dialog

Post by Dubstep Squirrel »

Thanks Ill have a look at that, I probably need that too at some point.
Post Reply

Return to “Modding help”