Page 1 of 1

[MOD 0.16] Switch Button

Posted: Thu Jan 25, 2018 5:55 pm
by GalactusX31
This is my first "contact" with the world of factories and the creation of MOD's.

The mod adds a simple switch, with a single configurable logic signal, which changes its status graph from OFF to ON and emits the configured signal.

if anyone has any suggestions to make this little mod, be something bigger, tell me in the post how to improve it, thank you.

https://mods.factorio.com/mod/Switch_Button

Re: [MOD 0.16] Switch Button

Posted: Tue Jan 30, 2018 6:46 pm
by Zomis
In my opinion, mods shouldn't aim to be big. A mod should do what it is meant to do and do it well.

I tested your mod and at first I thought it was a bug that I clicked on it but it didn't output any signal, it would be more intuitive to me if when you click on it you get the option to choose the signal, or at least that when it doesn't have a signal configured already you can click on it to configure what signal it should output.

I think this mod will work well together with my mod Visual Signals.

Congratulations on your first mod. Good job!

Re: [MOD 0.16] Switch Button

Posted: Tue Jan 30, 2018 8:52 pm
by GalactusX31
Thank you to report this problem, I still do not understand how to build mods well, but I am learning a lot thanks to the advice given to me, and the examples that people show me with their creations. I think that putting the standard configuration from the mod to true, can solve the first impression.

I'm going to try to figure out how to change the "graphic" state of the switch, even if it does not have any configured logical signal or any connected wire.

Re: [MOD 0.16] Switch Button

Posted: Fri Feb 02, 2018 10:19 am
by eradicator
I looked at your code and you should probably use can_reach_entity or reach_distance instead of hardcoding "15" to be compatible with mods/technology that increases the players reach.

Also personally i think i would have just abused the fact that non-square entities (arithmetic combinator, etc) can only have two rotation states instead of adding a custom hotkey. But that's just a detail :D.

Re: [MOD 0.16] Switch Button

Posted: Fri Feb 02, 2018 4:14 pm
by GalactusX31
I could do that ... if someone show/teaches me how to do it, because, when I try to know something and I ask for help, I only receive the same answer again and again ... "learn to program in LUA" ...

Anyway, I will try to find information on how to do what you said, and put it into operation in my mod, thanks for the suggestions, they are well appreciated :)

Re: [MOD 0.16] Switch Button

Posted: Fri Feb 02, 2018 10:55 pm
by eradicator
Can't look at the code right now but i remember you had something that calculated the distance between the player and the combinator similar to: "if distance < 15 then". So instead you just write something like "if player.can_reach(combinator) then" where player is the player object you got from the event and combinator the combinator entity.

And "learning" does help :P. I certainly don't have the time to give everybody a step-by-step solution to all their questions as much as i'd like to do that ^^.

Re: [MOD 0.16] Switch Button

Posted: Sat Mar 17, 2018 9:47 am
by GalactusX31
a new version has been released, feel free to expose your suggestions or criticisms

Changes in 0.1.6
- Polishing the code to be more readable and efficient.
- Added the option under "mod settings", to allow or not to show the the virtual signal configured by pressing "ALT" key.

Re: [MOD 0.16] Switch Button

Posted: Fri Aug 02, 2019 5:40 pm
by Sorda
Hi, I like this mod, but I don’t like the fact that changing the state (on or off) does not appear on the appearance of the button (it worked once, but now it’s always in the default view for some reason).