[MOD 0.16] Switch Button

Topics and discussion about specific mods
Post Reply
User avatar
GalactusX31
Inserter
Inserter
Posts: 28
Joined: Thu Jul 20, 2017 11:27 am
Contact:

[MOD 0.16] Switch Button

Post 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

Zomis
Inserter
Inserter
Posts: 31
Joined: Fri Apr 21, 2017 7:01 pm
Contact:

Re: [MOD 0.16] Switch Button

Post 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!

User avatar
GalactusX31
Inserter
Inserter
Posts: 28
Joined: Thu Jul 20, 2017 11:27 am
Contact:

Re: [MOD 0.16] Switch Button

Post 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.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.16] Switch Button

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
GalactusX31
Inserter
Inserter
Posts: 28
Joined: Thu Jul 20, 2017 11:27 am
Contact:

Re: [MOD 0.16] Switch Button

Post 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 :)

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.16] Switch Button

Post 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 ^^.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
GalactusX31
Inserter
Inserter
Posts: 28
Joined: Thu Jul 20, 2017 11:27 am
Contact:

Re: [MOD 0.16] Switch Button

Post 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.

Sorda
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu Jul 04, 2019 7:05 am
Contact:

Re: [MOD 0.16] Switch Button

Post 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).

Post Reply

Return to “Mods”