[MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Mon Aug 17, 2015 5:07 pm
by GopherAtl
Autowire
Info:
Adds a gui that lets you select which wires will be connected automatically when placing any electric power poles. Automatically connecting red/green requires you have the wires in your inventory, while copper are still free, as normally.
Name: Autowire
Description: Adds ability to auto-connect red and green wires when placing electric poles, or disable connecting copper.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Long Description
Long Description
Something I threw together when I got tired of connecting up lots of red and green wires between separated outposts. The "autowire" button will appear in the top-left; clicking it toggles a panel that opens to it's right with checkboxes for copper, red, and green. Check or uncheck items to enable or disable auto-connection of that type of wire/cable when placing new power poles.
Auto-connecting red and green wires will still cost wire, which will be taken from your inventory, otherwise none will be placed; copper is still free, as always.
Version history
Version history
0.1.3 2015-8-18: fixed bug that caused gui not to appear when loading an old save file after adding the mod and resulted in a crash on placing poles.
0.1.2 2015-8-18: gui tweaked, now more compact, and on top instead of left, so works better with other mods' guis
0.1.1 2015-8-17: minor update, now supports anything based on electric-pole, and supports a list of exceptions in config.lua
0.1.0 2015-8-17: Initial version released into wild for testing by people-who-aren't-me
Planned Features
Planned Features
I got nothin'. I'm open to suggestions...
Use in Mod Packs
Use in Mod Packs
Go ahead. You don't need to ask. You're free to include it in any mod pack either as-is, or with changed recipes/graphics, or whatever. Comments to this thread linking the mod pack are encouraged/appreciated, as it helps me keep track of who's using the mod, but that's it.
post format notes
Hopefully the format is satisfactory, if any automatic parsing systems have a problem with anything let me know.
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Mon Aug 17, 2015 5:09 pm
by GopherAtl
Threw this together partly to relive myself of the tedium of running along stringing red and green wires when I'm playing with large-scale circuit networks that connect distant outposts, and partly to try my hand at the factorio modding api's gui systems.
I tried to make it support multiplayer, but have not yet been able to test that, so if you do test it, please report the results XD
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Mon Aug 17, 2015 5:50 pm
by Adil
GopherAtl wrote:way to auto-detect other mods' added power poles?
Just in case. All but the most exotic modded poles should have type=="electric-pole".
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Mon Aug 17, 2015 5:56 pm
by GopherAtl
Adil wrote:
GopherAtl wrote:way to auto-detect other mods' added power poles?
Just in case. All but the most exotic modded poles should have type=="electric-pole".
:facepalm: I am the derp for not thinking of that at the time XD
Though after thinking about it, some mods might add poles that have their own customized wiring behaviors? in which case, a way to at least make an exception might be wise. A table of exceptions in the config file should work, though.
:edit: and now it does. 0.1.1 released, it now has a config.lua with an (initially empty) array "wire_exceptions," anything not named in that array of type electric-pole will be auto-wired.
If anyone knows of any mods off-hand that have power poles that should be excepted from autowiring behavior for whatever reason, let me know and I'll add them to the default wire_exceptions list.
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 9:22 am
by hitzu
Great mod! Thank you
I can suggest another way to implement auto wiring without any additional GUI. Making it work on large distances so the player connects the first and the last power pole and all intermediate poles would be connected automatically by a shortest way if possible.
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 12:16 pm
by Alexs
Unfortunately the mod is not working with me. Perhaps a problem with the mod: better electric pole? with me also no GUI is displayed ... your idea is clever. Sorry, Translated with Google
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 1:17 pm
by GopherAtl
hitzu wrote:Great mod! Thank you
I can suggest another way to implement auto wiring without any additional GUI. Making it work on large distances so the player connects the first and the last power pole and all intermediate poles would be connected automatically by a shortest way if possible.
while I can see the utility if that feature, you're basically asking me to implement pathfinding and graph traversal on what could be a truly massive scale, it's doable, even doable in a way that doesn't bog the game down while it processes, but it's not something I can implement trivially.
Alexs wrote:Unfortunately the mod is not working with me. Perhaps a problem with the mod: better electric pole? with me also no GUI is displayed ... your idea is clever. Sorry, Translated with Google
I don't know why no gui is displayed. Interactions with better electric pole are possible, but that shouldn't affect the gui. I will test the two together later today when I get a chance.
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 2:08 pm
by GopherAtl
@Alexs Just tested it with the unofficial update of "Better Electric Pole" here, by lishget, as the original version by elmi has not been updated to 0.12.x, and it seems to work fine, no problems
So I'm not sure what's happening for you.
Can you tell me what version of the game you're playing, and list all the mods you're using? Are all the latest versions?
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 2:23 pm
by Alexs
Thank you for the fast reaction. I have just tested the small electricity pylon. he has the same problem. So it is not at the other mod. the message is the following:
Error while running event handler:
--autowire--/control.lua 58: attempt to index Local "settings" (a nil value)
...
Edit: I have just turned off all mods except for color-coding. still the same error. Factoriop has stood up to date. Alledings the 64-bit version ... a problem?
.
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 2:26 pm
by GopherAtl
Alexs wrote:Thank you for the fast reaction. I have just tested the small electricity pylon. he has the same problem. So it is not at the other mod. the message is the following:
Error while running event handler:
--autowire--/control.lua 58: attempt to index Local "settings" (a nil value)
....
hmm. Are you sure you're running the latest version, autowire_0.1.2? How are you placing the poles? Is this in single-player?
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 2:39 pm
by Alexs
I have just turned off all mods except for color-coding. still the same error. Factoriop has stood up to date. Alledings the 64-bit version ... a problem?
yes - singleplayer ...
NEWS: when I start a new game with all mods, I have the gui.
how can I save the old save game?
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 2:42 pm
by GopherAtl
Alexs wrote:I have just turned off all mods except for color-coding. still the same error. Factoriop has stood up to date. Alledings the 64-bit version ... a problem?
yes - singleplayer ...
Hmm. I run a 64-bit version too, so that wouldn't be it. Will test with color-coding now, not used that mod before, some strange interaction may be happening...
:edit: Aha! I found the problem. Nothing to do with color-coding; the recent versions don't work when added to an already-existing save, after I changed it to make it properly support multi-player.
Will work on a fix now, hopefully won't take long.
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 2:48 pm
by Alexs
.. when I start a new game with all mods, I have the gui.
how can I save the old save game?
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 2:50 pm
by GopherAtl
Alexs wrote:.. when I start a new game with all mods, I have the gui.
how can I save the old save game?
gimme just a minute, found and fixing the problem now!
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 3:08 pm
by Alexs
great! I look forward to the new version. The Nixie tubes are very good! thanks for the quick troubleshooting. wow! concentrated expertise! Thanks for the work.
Re: [MOD 0.12.x] Autowire - configurable automated pole wiring
Posted: Tue Aug 18, 2015 3:14 pm
by GopherAtl
Hrm. A proper fix is going to take a bit of figuring, not sure why it's not working now.
So this isn't a proper release, just a temporary patch.
Load this version and then place any kind of electric pole, and the gui should be added. It will work properly from there. (see attachment to this post)
:edit: Scratch that, found the problem and fix almost immediately after this post XD packing up a proper 0.1.3 release with the fix now which will properly handle being added to existing saves. Will update the OP and this post with links when I'm done (within 2 minutes) and remove the attachment here at that time.