Allow force color to be locked/set

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Mar 22, 2020 2:30 am

Allow force color to be locked/set

Post by aaron311 »


This could quite possibly be a bad/terrible idea™ but here goes...

Issue summary:
I'd like to have a way to programmatically set/override a force's color. Or, if that's not possible/easy/advisable, lock it from alteration due to the first player in the force changing.

At present, a force's "color" appears to be automatically equivalent to the color of the first player member of the force. While this default behavior seems to make sense, there are ways to (ab)use multiple forces in the game such that players switch around to different forces temporarily. When this happens, you get a sort of "light show" where the entity colors in your base keep changing whenever player 1 moves. This can seem buggy/distracting.

Use case:
I'm experimenting with creating a mod that temporarily relocates the player to an alternative (but allied) force along with any entities that have construction requests within the player's roboport range. This effectively allows the player to hit a toggle and make his local roboport service the requests in his immediate vicinity despite possibly the nearby stationary network already trying to service those requests.

Edit: If you want to see what I mean, look for "Tactical Construction" on the mod portal and use it in a multiplayer game. If the first player toggles it on and off you'll see the base colors change around :-)

Thank you for your consideration.

Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Jul 21, 2021 11:01 am

Re: Allow force color to be locked/set

Post by Heinermann »

+1 on this. All the entities in my new script-controlled force are black and there doesn't appear to be a way to change it.

Posts: 48
Joined: Tue Dec 01, 2020 6:57 pm

Re: Allow force color to be locked/set

Post by KeepResearchinSpoons »

force.default_color to have rw state we could use to set colors of turrets, and the like.

OR, better yet,
a color attribute to a all the turrets :> If nil default to the "force color".

This alone would allow this kind of stuff to go for groups of "discovered" turrets.
Turns out you can't do this in mp reliably :> Or even in sp for destinct groups :>

Unless you spam dummy offline players in lan into the map beforehand. For each slot of "turret groups" you want to use.
Feels gross? Yesh it does. Very much so.
You need to escape those dummies to not delete them with player-cleaning on soft-resets? You guessed it.
Is sharing the script to spam-login "dummy-players" over the defined list of names into the headless considered against the terms of use? Probably so.
I won't show you how it is done to prevent the possible harm for both of our parties.

But well, the force.color nil to default to force.players[1].color should be just an easy getter override?
PLEASE, let us fade turret colors around like an old Dracula "bloody-red to black" pulsing cape!
We do want either Force.color or turret.color, pretty please?
Would just be awesome.
(3.38 MiB) Downloaded 38 times

Post Reply

Return to “Modding interface requests”