Help with a mod: vanilla part control modification & GUI

Place to get help with not working mods / modding interface.
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Help with a mod: vanilla part control modification & GUI

Post by Bizobinator »

Hello!

So, I'm making a mod (1st foray into modding!) that, ideally, would allow the player to select a splitter & then change the ratio of items split between the two output lanes.

I have a fairly decent idea of how to do the logic/switching/stuff. But, I have a few questions & I was hoping I could get some help.

First, is there a way to modify the control.lua for the vanilla splitters? If so, how do I specify to overwrite that with my mod? Would it be better off just making separate items?

Secondly, I'd like to make it so that clicking on a given splitter (or custom splitter) opens a gui. How do I go about that?

Thanks guys!
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Help with a mod: vanilla part control modification & GUI

Post by Adil »

Bizobinator wrote:First, is there a way to modify the control.lua for the vanilla splitters?
Vanilla splitters don't have any control.lua, actually, no entity whatsoever does. Control.lua is generally associated to the instance of the game itself. The parameters of entities are defined in data.lua, any scripting is impossible to associate to them through there.
If you want to create a custom behavior, you'll have to keep track of all splitters not set to 50:50 and manually teleport items to their rightful positions.
Bizobinator wrote:Secondly, I'd like to make it so that clicking on a given splitter (or custom splitter) opens a gui. How do I go about that?
By using gui and gui_element and even more custom scripting. Different people come uo with different solutions here.
There's utility mod that handles the easier part - click detection. With gui drawing - you're on your own.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Post Reply

Return to “Modding help”