Page 1 of 1

Allow other wires to behave like copper-cable

Posted: Wed Feb 03, 2021 11:12 am
by Anachrony
I ran into an issue with my mod where I wanted to make the wire behave like copper-cable for the sake of electrical connections. After looking at the copper wire prototype, I thought the magic must be wire_count, but apparently it's not, and that's also set on red and green wire. I'm not looking to change how it's rendered or anything, but it seems a little uncharacteristic to require that one and only one item can have this ability and it must be called copper-cable. There are many mods with different types of wire beyond copper. In mine, copper is not unlocked until the end game, after launching rockets. It appears that my only option will be to override the localised_name and icon for copper-cable to appear to be one of my lower tech wire types, then search and replace all uses of that wire with copper-cable, and add a migration for previous releases. But even then I have to choose only one type of wire to have this behavior, remember the hacky name in future recipes, and FNEI search will now not be able to find the item if people look up the in game name.

Would it be possible to add some way to prototype an item to behave like copper cable for the sake of forming electrical connections? I'm not concerned about changing the graphics for how it's rendered. You do not get copper cable back when you remove an electrical connection, so there'd be no need to have it pick what wire item to give back if there were more than one option.

Re: Allow other wires to behave like copper-cable

Posted: Wed Feb 03, 2021 11:24 am
by ss_Baum
https://wiki.factorio.com/Prototype/Item.
That has a wire-count. But I don't know what will happen, if you set this to one.

Re: Allow other wires to behave like copper-cable

Posted: Wed Feb 03, 2021 11:41 am
by Anachrony
ss_Baum wrote: Wed Feb 03, 2021 11:24 amThat has a wire-count. But I don't know what will happen, if you set this to one.
I mentioned wire_count in my post. As far as I can tell that field does nothing and just recognizes copper-cable by name. green-wire and red-wire also set that field to 1, but all 3 behave differently, and any other item that sets it does nothing. I think a reasonable interface would be if any item sets wire_count to a positive number it behaves like copper-cable, with the exception of red-wire and green-wire, which remain hardcoded.

Re: Allow other wires to behave like copper-cable

Posted: Wed Feb 03, 2021 12:58 pm
by ss_Baum
Did you set the connection points before trying it?
Just an idea.

Re: Allow other wires to behave like copper-cable

Posted: Wed Feb 03, 2021 1:14 pm
by bormand
ss_Baum wrote: Wed Feb 03, 2021 12:58 pm Did you set the connection points before trying it?
Connection points are hardcoded to "copper", "red" and "green". So, wire item names are hardcoded too, I think. All their properties are similar, they differ mostly in name.