[Request/Suggestion] horizontal/vertical_window_light for pipe pictures definition

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

[Request/Suggestion] horizontal/vertical_window_light for pipe pictures definition

Post by Deadlock989 »

In 1.1 we got the ability to make anything related to a Sprite or Animation definition glow in the dark, which was just awesome, even with the render layer limitations of lights. For me it has made more of a positive difference to how I see and play Factorio than anything since splitter priorities, with the dark GUI and icon revamps for 1.0 being a close second.

I know of several mods (cough) which have molten metals. Because pipes can only be filtered by a single fluid (and specific temperatures of fluid can only be filtered if a specific fluid is also filtered), we have to use a generic pipe definition for any pipes "designed" to carry multiple molten metals. Given all the amazing effects we can achieve with lighting now, I feel like pipes have been left behind a bit. Currently we can have crafting machine animations with all manner of glowing stuff sloshing around but when that "same stuff" appears in the pipes, it looks like cold orange plastic.

The fluid flow sprites in pipes depend on render layers / draw orders to work, and the fluid background is the only part of the pictures definition that picks up on the fluid's tinting scheme, so my first thought was that you couldn't make hot pipes glow, because the rectangular flow sprites would just shine through. Then I realised that all you have to do is add a dead simple window mask on top of the main fluid sprite - just a simple white shape masked off by anything that isn't glass in the pipe sprite and given a few pixels of feathering - turn draw_as_light on for it, and presto, the window glows at night, lighting up whatever colour of fluid is "inside" or the window "background" itself if the flow is below maximum. For example, without the mask on the top, with it on the bottom - this mock up is actual game screenshots that took me less than 5 minutes to put in place, and could probably look better with more care taken (e.g. lighting up the surface around the window a little):

hot-pipes.jpg
hot-pipes.jpg (94.71 KiB) Viewed 496 times

The extra layer:
pipe-glow-hw.png
pipe-glow-hw.png (1.23 KiB) Viewed 496 times

So it could be as simple as adding two optional Sprite definitions to the pipe.pictures table:

Code: Select all

horizontal_window_light (Sprite)
vertical_window_light (Sprite)
These would fit in fairly naturally with the window pipe definitions because they are already broken into several different sprites for a single windowed pipe variant (the flow sprites, fluid background, window background, pipe body etc.) The only difference is that they would need to be optional and currently all of the elements in the pictures table are compulsory (unrelated side note: it would be nice if some of them weren't, like the window variant itself and the flow sprites).

Because these glow patches would be intended for use with draw_as_light (i.e. not draw_as_glow) they don't make any difference at all under full lighting so there is no need for any parameter to control their use by time of day. However, since we can't stop people using cooler fluids in the same pipes, there needs to be some control over whether the flow glows for any particular fluid or not. I can think of several ways of doing that: it could be a property of the fluid, but my first feeling is that it's more natural to have it as an optional property of the pipe, and also make it related to temperature. e.g.

Code: Select all

window_glow_temperature_minimum (double)


That could cover both bases - if there is no fluid in the pipe at all then the temperature wouldn't technically be over that maximum so the glow also wouldn't be drawn. Otherwise, having it on the fluid (e.g. "glow_in_pipes = true" or whatever) could be useful for glowing fluids that aren't technically hot e.g. radioactive gases, plasma, etc. - but it might be less useful for folks who make more use of fluid/gas temperatures for crafting mechanics, I'm not sure because I don't really go there. Someone else can probably think of a better way of doing this, the only requirement I have is that you can somehow ensure that some fluids glow and some don't. It wouldn't affect vanilla or existing mods at all unless they've put the right sprites in place anyway.

I realise there is no use for this in vanilla since it has largely moved away from fluid temperature mechanics. But if there is a low FPS/UPS impact way this could be done, it would be great.
Image

Post Reply

Return to “Modding interface requests”