So, you want to add electric wires to your game? Well maybe not exactly, but you may want to attatch a power source to a door or something, and have power states linked.
In basic form, this guide will show you how to create wiring systems similar to that of Terraria (only instead of pulses, the power states are constant).
The guide will not go into all possibilities of making the system completely effecient or usable for all purposes, but in it's current state it can show you how to link power sources to appliances, while being able to create and remove wires at runtime. You should be able to easily expand it from there.
This is based on a game I made for Ludum Dare once, when I first tried out wires. I have since made it much more efficient and reliable for this guide.