Schall Lamp Contrast


Replace the vanilla lamp graphics for higher contrast signal display. Vehicles no longer collide with lamps, so safe to drive over them! Also allows configuration on colour signals, including their priority. (Locale: English, Deutsch, 正體中文, 简体中文, Português Brasileiro)

Tweaks
21 days ago
0.16 - 2.0
3.15K
Circuit network

b [Solved] Lamp overlay; layer related?

4 years ago
(updated 4 years ago)

Just updated to the latest version of the mod (with the on/off modes using layers), and I'm seeing an overlay on the "on" mode for the lamp. Its as if the vanilla lamp is overlayed on top of the inlaid lamp square when the lamp is on. This only started after the last update of this mod; previously was working fine..

I'm using "black" lamp style, with a host of other mods; the only other mod I can think of that might adjust the lamp style is Krastorio2; haven't dug into its code to see if it may be interfering yet.. Can generate a list if needed to dig into compatibility issues

Not sure how to embed pictures in these comments (if even possible), so I've uploaded a picture to my steam account; should be public, let me know if you can't see it.. It shows lamp on vs lamp off:

https://steamuserimages-a.akamaihd.net/ugc/1039716264046996843/53BF75D7925D0460BB27EB8097C0BC0B552D85F9/

Not a big deal, but doesn't look pretty anymore, which makes me sad..

Regardless, keep up the good work!

4 years ago

I am using my own mods in my game, the lamps are working fine.

Your screenshot worth a thousand words. It is obvious that some mod(s) have overwritten picture_on of mine.
There is a very easy way to identify what mods may have done that. When highlight a placed lamp, the right entity tooltip has a blue line of text under the entity lamp. That line shows what mod(s) have changed the entity.

4 years ago

If that is the case, then it does appear to be Krastorio2 interfering with it.. Will have to dig into this a bit deeper..

Thanks for looking!

4 years ago

I think I may have found the issue with this problem. Bear with me, this might be a long one..

Krastorio2 doesn't modify the sprites for the small lamp; the only change it makes is to the glow size (which causes the inheritance entry in the game tooltip) and adds another entity with a type of "lamp". It doesn't change "picture_on" for the lamp anywhere.

In my debugging of this issue, the problem disappeared; in my various loads of mods, the image isn't appearing anymore, including the game save where it first appeared.. However, it doesn't mean that the bug isn't there; my current theory is that in loading of the mods, the order of the layers may have changed; without digging thru Factorio's code I can't tell..

The bug still exists however; the base game's sprite for picture_on still appears in the "small-lamp" entity's definition. In my digging, I threw some debug messages in the lamp.lua code that checked the small-lamp data object before and after the modifications, and discovered that this mod's "picture_on" doesn't repace the base mod's definition, it only added to it.

The base mod's definition looks like this:
https://github.com/wube/factorio-data/blob/2b18d0a4c4f186e27e83cbf6e9a9d3e3e130408d/base/prototypes/entity/demo-entities.lua#L4218

This mod's code for adding the "picture_on" sprite does not replace the "picture_on" entry; it just adds a "layers" entry to the dictionary (via "drlamp.picture_on.layers = ..."). The resulting JSON entry looks like this (snipped and beautified):

[code]
picture_on = {
filename = "base/graphics/entity/small-lamp/lamp-light.png",
priority = "high",
width = 46,
height = 40,
frame_count = 1,
axially_symmetrical = false,
direction_count = 1,
shift = {
0,
-0.21875
},
hr_version = {
filename = "base/graphics/entity/small-lamp/hr-lamp-light.png",
priority = "high",
width = 90,
height = 78,
frame_count = 1,
axially_symmetrical = false,
direction_count = 1,
shift = {
0,
-0.21875
},
scale = 0.5
},
layers = {
{
filename = "SchallLampContrast/graphics/entity/light-on.png",
priority = "high",
width = 90,
height = 78,
frame_count = 1,
axially_symmetrical = false,
direction_count = 1,
shift = {
0,
-0.21875
},
scale = 1
}
}
[/code]

Notice that the base game's image sprites still exist in the "picture_on" entry. This happens with just this mod loaded, no other mods installed. And the fault lies with the dot notation in "drlamp.picture_on.layers = ..."; doing so doesn't replace the "picture_on" entry, it just adds the "layers" entry to it. Fixing the "picture_on" entry by removing the base mod's entry for the small lamp would possibly stop those default lamp sprites from appearing again if the layer rendering changes. This can be done either by wiping the picture_on entry when redefining it:

[code]
picture_on = {
layers =
{
{
(...lamp contrast definition....)
}
}
}
[/code]

or not using layers entry (matching base game's picture_on entry):

[code]
picture_on = {
(...lamp contrast definition....)
}
[/code]

Let me know what you think..

4 years ago

bah, bbcode code blocks don't work.. :(

4 years ago

Setting glow size only should not affect the layers. Must be somewhere else.

In sprite consideration, the layers property have higher preference. So when this mod (or other mods) set something to layers, the game will read and use it. The direct sprite definitions will be ignored.
(That's why base game + this mod alone, without other mods' interference, the lamps do not take effect of the direct sprite definition. Removing that may "beautify" the final code, but is NOT the cause of the extra layer display.)

So does the problem exist when disabling Krastorio 2?
Does the problem exist when disabling Krastorio 2 and all other mods? (Just having this mod.)

This mod portal use Markdown syntax, not BBCode.
So you have to use "Greater-than-sign" to create blockquote, like this:
"Greater-than-sign" Example text

Example text

4 years ago

Good to know about the layer priority stuff.. :)

I know I had said that the problem disappeared, but its back again.. sigh

Disabling Krastorio2, problem still exists.. I'm going to go thru my mods, disabling one by one, and see if I can isolate the mod that might be the issue.. stay tuned..

4 years ago

Disabled all mods, except ShallLampContrast 0.18.1, and the issue still exists..

However.. Go into graphics settings, and setting sprite resolution to "Normal", and the overlay graphic disappears. Setting it to High and it appears again.. (note a restart will be necessary when switching)..

Could not having a hr_version = in the entity be the issue (or the hr_version still existing in the entry)?

4 years ago

Confirmed your observations. Wonder why the game have different priorities in "Normal" and "High" sprite resolutions...
Just released 0.18.2 that cleared those remnant definitions.
It is hard to keep compatibility to different mods...

New response