Custom Circuit Network Colors

by _-_-_

Lets you choose custom colors for the items formerly known as red and green wires.

Tweaks
1 year, 7 months ago
1.1
800
Circuit network

i My Branch - Code Cleanup, New Colors & Sprites

1 year, 10 months ago
(updated 1 year, 10 months ago)

Sharing my changes to v1.1.0

Don't have my git credentials on this machine, so I've uploaded the zip to my Dropbox; code can be reviewed from there. Feel free to use, modify, merge or ignore my version. This is my first time writing lua, but it seems very straight forward and I think I've made some valuable alterations that'll make this mod a little easier to maintain.

CHANGELOG | 2022/12/28
1. Simplified 'data.lua': compacted color arrays; redundancies eliminated via array iteration; line count reduced by 30.
2. New colors added: White, Black, Gray (darker), Orange, Pink, Purple, Lime (localized)
3. Modified sprites: increased brightness slightly; high-res shading touched up in Photoshop.
4. Keyword "elec" in "cc-elec-color" changed to "copper" (more efficient)

NOTES
1. The version number remains 1.1.0
2. Some colors written in full RGB for finer control; can be translated to shorthand (floats)
3. "Default" option check is handled by a "goto continue" statement to avoid additional indentation.
4. Settings have been thoroughly tested.

FILES MODIFIED
CustomCircuitColors/data.lua
CustomCircuitColors/settings.lua
CustomCircuitColors/locale/en/en.cfg
CustomCircuitColors/graphics/sprites/generic-wire.png
CustomCircuitColors/graphics/sprites/hr-generic-wire.png

DROPBOX (no login required) [Update 1 | 2022/12/29]
https://www.dropbox.com/s/eft6ffkyjbsdnlr/CustomCircuitColors_1.1.0.zip?dl=0

Thanks for the mod!

Edit:
It appears "en.cfg" cannot be previewed on Dropbox, so in case you plan on taking the more secure route of copy/pasting directly from the previews (rather than downloading files from a random Factorio thread,) I've created an unlisted Pastebin for the file -- everything else can be acquired from Dropbox previews. View here: https://pastebin.com/raw/WbuNf72u

1 year, 10 months ago

Oh wow, thanks! Perhaps I should have commented the code (I was more concerned with finishing the concept at the time), but the bg_lut is an x,y position on a spritesheet - not a color value. It's what the game uses for the background of the red/green signal displays when viewing a pole's tooltip. You may want to re-evaluate the choices with that in mind.

The only other note is that I wouldn't mix types of color definitions - if we're doing 0-255, I would recommend converting all the colors for consistency. Otherwise, looks good!

1 year, 10 months ago

but the bg_lut is an x,y position on a spritesheet - not a color value. It's what the game uses for the background of the red/green signal displays when viewing a pole's tooltip.

Thanks for pointing that out! I wasn't paying attention to that at all. I've created a custom 468x36 color lut for the mod and changed the "bg_lut" table to contain multipliers instead of xy coordinates; it's basically just a zero-index array, where the values are indices. Multiplying 36 by the multiplier gives the coordinate for x, which is all you need. Would have been even simpler if lua had a function for retrieving indices, but nope. Anyways, to update the lut simply append the png with your desired color, then update "bg_lut" with the new color according to its position in the color lut.

I'm including a link for the color lut's PS file below. Each "slot" is on a separate layer and coloring/shading is managed via the layer's blending options. Just increase image width by 36px, duplicate a slot layer, change its "Color Overlay" setting as needed and you should be good. Certain colors will require that you tinker with the layer's "Gradient Overlay" and "Bevel & Emboss" settings, otherwise the shading won't look right. If there's one thing I'd change right now it's the shading for some of the colors, but I want to get back to my SE save!

The only other note is that I wouldn't mix types of color definitions - if we're doing 0-255, I would recommend converting all the colors for consistency.

CONSISTENCY! That's the word I was looking for yesterday, not efficiency :p
But yes I agree. I didn't want to mess around with your colors for a pointless reason, but I've gone ahead and changed all colors to RGB values. Also, after digging around in the game's graphics directories I thought about maybe modifying the wire colors for each combinator. Of course a new sprite for each color combination would be pretty time consuming but some type of overlay system would be perfect. Would really make this mod pop.

Just a thought :)

CustomCircuitColors [Update 1 | 2022/12/29]
https://www.dropbox.com/s/eft6ffkyjbsdnlr/CustomCircuitColors_1.1.0.zip?dl=0

Color LUT PS File
https://www.dropbox.com/s/wz0v8bq8gp2wcwc/circuit-network-content-slot-lut.psd?dl=0

1 year, 10 months ago

I had looked at doing a mask for each combinator and power pole, but it was unfortunately beyond my mediocre photoshop skills - if you're unfamiliar, the game does have a quite robust sprite layer/mask system. Anyways, thanks for making those changes, I'll give it a test in-game and see about merging it in. I appreciate you taking the time

1 year, 10 months ago
(updated 1 year, 10 months ago)

Well I'm an artist by trade, so if you're up for coding it then I'd willing to make the masks for you. Just let me know and I'll start digging into it.

Edit: Should probably move "local lut_pos = {bg_lut[wire_setting] * 36, 0}" into the if statement. No point performing that calculation for copper cables.

1 year, 10 months ago

I've thrown it onto github (I really should get around to doing that for all my mods) and integrated your changes with some tweaks to fit within my own style. I darkened the spritesheet a little, as the more neon colors tend to make it hard to read some icons.

https://github.com/oorzkws/factorio-customcircuitcolors

If it has your approval I'll go ahead and push the changes to the portal. Also, if you end up making masks for the red/green parts that are attached to the base-game poles I would be happy to integrate those.

1 year, 10 months ago

Looks perfect; a lot cleaner too with that loop.

I'll get around to creating the masks for the poles soon, might even do some tests tonight. I now see where the layering is occurring in code and it looks simple enough. Shouldn't take me long to complete once I get to it. Also going to setup a dedicated github for mod work, so no more Dropbox.

I'll write back here when there's an update.

1 year, 10 months ago

Test works: https://i.imgur.com/QfsfsLb.png

To do:
Small Electric Pole
Medium Electric Pole
Big Electric Pole
Substation
Combinators
Power Switch
Circuit Connectors
Transport Belt Reader

New response