Something Wrong with Reactor Glow

Place to get help with not working mods / modding interface.
Adamo
Filter Inserter
Filter Inserter
Posts: 481
Joined: Sat May 24, 2014 7:00 am
Contact:

Something Wrong with Reactor Glow

Post by Adamo »

Hey All,

Something weird seems to be going on with the logic involving the reactor lights and fuel glow color. Here's what I can tell you:

With use_fuel_glow_color set to true,

if the fuel has no glow color, the default_fuel_glow_color appears to be applied to the working_light_picture tint, but the default_fuel_glow_color is not applied to the light (which defaults to white).

If the fuel has a glow color, the glow color of the fuel appears to be applied to both the working_light_picture and the light.

In either case, changing the shift, size, or intensity of the light seems to make no difference.

With use_fuel_glow_color set to false, all of these same things happen. So it appears this boolean doesn't work.

Here is the relevant code so you can be sure I didn't make any mistakes. The intensity and size are set to extremely low values because I kept making them smaller to be sure I wasn't just not seeing the change.

Code: Select all

local reactor_item = data.raw.item["nuclear-reactor"]
local reactor = data.raw.reactor["nuclear-reactor"]
-- ~ 50 W/m^2/sr/um for blackbody at 1275K at 0.68 um
-- = 0.005 W/cm^2/sr/um at 1275K at 0.68 um
reactor_item.icon = 
	"__adamo-nuclear__/graphics/icons/nuclear-reactor.png"
reactor.light.size = 0.1
reactor.light.shift = {-1.7,0.4}
reactor.light.intensity = 0.01
reactor.light.color = {r = 0.6,g = 0.08,b = 0.005,a = 0.5}
local reactor_coolant_tint = {r = 0.5,g = 0.05,b = 0.005,a = 0.8}
reactor.working_light_picture = {
	filename =
		"__base__/graphics/entity/nuclear-reactor/"
		.."reactor-lights-grayscale.png",
	width = 160,
	height = 160,
	shift = { -0.03125, -0.1875 },
	blend_mode = "additive",
	--tint = reactor_coolant_tint,
	apply_runtime_tint = true,
	hr_version =
	{
		filename =
			"__base__/graphics/entity/nuclear-reactor/"
			.."hr-reactor-lights-grayscale.png",
		width = 320,
		height = 320,
		scale = 0.5,
		shift = { -0.03125, -0.1875 },
		blend_mode = "additive",
		--tint = reactor_coolant_tint,
		apply_runtime_tint = true
	}
}
reactor.default_fuel_glow_color = reactor_coolant_tint
reactor.use_fuel_glow_color = false
Edit: On some further exploration, I've found that the light property on the reactor does work, and the larger light that I couldn't get rid may be coming from light_flicker on the energy_source, since this defaults to white and I think to the size of the entity? I am checking that out, now.

More Edit: OK, after extensive testing, the issues with the size, intensity, and shift of the light were from not also changing the light_flicker property. So that's taken care of. But the main issues I reported remain.

Edit Further: I changed how I'm approaching the prototype. With the new code, which I'll include below, the use_fuel_glow_color boolean *does* work as expected. So, I don't know what is wrong or different about how the system treats my first approach, but it seems to work with this approach. Not sure what else to say about that. At the very least, it seems to be working for the application I wanted, now.

Code: Select all

reactor_item.icon = 
	"__adamo-nuclear__/graphics/icons/nuclear-reactor.png"
local reactor_coolant_color = {r = 0.8,g = 0.05,b = 0.005,a = 1}
local reactor_coolant_glow_color = {r = 0.4,g = 0.05,b = 0.005,a = 0.7}
reactor.light.type = "oriented"
reactor.light.picture = {
	filename =
		"__adamo-nuclear__/graphics/entity/"
		.."reactor-lights-glow.png",
	flags = {"light"},
	width = 160,
	height = 160,
	blend_mode = "additive",
}
reactor.light.rotation_shift = 0
reactor.light.size = 1
reactor.light.shift = { -0.03125, -0.1875 }
reactor.light.intensity = 1
reactor.light.color = reactor_coolant_glow_color
reactor.energy_source.light_flicker = {}
reactor.energy_source.light_flicker.color = {r = 0,g = 0,b = 1,a = 1}
reactor.energy_source.light_flicker.minimum_intensity = 1
reactor.energy_source.light_flicker.maximum_intensity = 1
reactor.energy_source.light_flicker.minimum_light_size = 0
reactor.energy_source.light_flicker.light_intensity_to_size_coefficient = 0
reactor.working_light_picture = {
	filename =
		"__base__/graphics/entity/nuclear-reactor/"
		.."reactor-lights-grayscale.png",
	width = 160,
	height = 160,
	shift = { -0.03125, -0.1875 },
	blend_mode = "additive",
	apply_runtime_tint = true,
	hr_version =
	{
		filename =
			"__base__/graphics/entity/nuclear-reactor/"
			.."hr-reactor-lights-grayscale.png",
		width = 320,
		height = 320,
		scale = 0.5,
		shift = { -0.03125, -0.1875 },
		blend_mode = "additive",
		--tint = reactor_coolant_color,
		apply_runtime_tint = true
	}
}
reactor.default_fuel_glow_color = reactor_coolant_glow_color
reactor.use_fuel_glow_color = false
[\code]
posila
Former Staff
Former Staff
Posts: 5448
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Something Wrong with Reactor Glow

Post by posila »

It does work.

Code: Select all

-local reactor_item = data.raw.item["nuclear-reactor"]
local reactor = data.raw.reactor["nuclear-reactor"]
local uranium_fuel_cell = data.raw.item["uranium-fuel-cell"]
-- fuel glow color is red
uranium_fuel_cell.fuel_glow_color = { 1, 0, 0, 1 }

-- ~ 50 W/m^2/sr/um for blackbody at 1275K at 0.68 um
-- = 0.005 W/cm^2/sr/um at 1275K at 0.68 um
-- reactor_item.icon = "__adamo-nuclear__/graphics/icons/nuclear-reactor.png"
reactor.light.size = 5
reactor.light.shift = {-1.7,0.4}
reactor.light.intensity = 1

local reactor_coolant_tint = {r = 0, g = 0, b = 1, a = 1}
reactor.light.color = reactor_coolant_tint

reactor.working_light_picture = {
	filename = "__base__/graphics/entity/nuclear-reactor/reactor-lights-grayscale.png",
	width = 160,
	height = 160,
	shift = { -0.03125, -0.1875 },
	blend_mode = "additive",
	--tint = reactor_coolant_tint,
	apply_runtime_tint = true,
	hr_version =
	{
		filename = "__base__/graphics/entity/nuclear-reactor/hr-reactor-lights-grayscale.png",
		width = 320,
		height = 320,
		scale = 0.5,
		shift = { -0.03125, -0.1875 },
		blend_mode = "additive",
		--tint = reactor_coolant_tint,
		apply_runtime_tint = true
	}
}

reactor.default_fuel_glow_color = reactor_coolant_tint
-- default glow color is blue
reactor.use_fuel_glow_color = false

-- disable burner light; we can't make it 0 intensity, because intensity controls reactor lights also,
-- and setting color to black doesn't work either because energy source ALWAYS takes fuel_glow_color if set
reactor.energy_source.light_flicker = { light_intensity_to_size_coefficient = 0, minimum_light_size = 0 }
use_fuel_glow_color = false vs use_fuel_glow_color = true(Blue = default_fuel_glow_color; Red = uranium fuel glow)
reactor.png
reactor.png (202.63 KiB) Viewed 862 times
Problem you are running into is probably that energy source's light flicker always uses fuel_glow_color if item has it set and it is much stronger than any of the other lights you are adding
Post Reply

Return to “Modding help”