Page 1 of 1

draw_text offset

Posted: Thu Nov 14, 2024 7:55 pm
by SLywnow
I rewriting old mod to 2.0 and looks like this not works anymore:

Code: Select all

storage.generators_text[entity.unit_number] = rendering.draw_text{
	text  = storage.dysonsphere, 
	scale = 1,
	color = {255,239,161},
	surface = entity.surface, 
	target = entity,
	only_in_alt_mode =true,
	draw_on_ground =false,
	alignment = "center",
	target_offset = {0, -2.55}
}
Text draws, but not offsetting

Re: draw_text offset

Posted: Thu Nov 14, 2024 7:59 pm
by Bilka
The offset is part of the target specification now: https://lua-api.factorio.com/latest/con ... Table.html

So this should work:

Code: Select all

storage.generators_text[entity.unit_number] = rendering.draw_text{
	text  = storage.dysonsphere, 
	scale = 1,
	color = {255,239,161},
	surface = entity.surface, 
	target = {entity = entity, offset = {0, -2.55}},
	only_in_alt_mode =true,
	draw_on_ground =false,
	alignment = "center"
}

Re: draw_text offset

Posted: Thu Nov 14, 2024 8:06 pm
by SLywnow
Bilka wrote: Thu Nov 14, 2024 7:59 pm The offset is part of the target specification now: https://lua-api.factorio.com/latest/con ... Table.html
Thanks! Can you change link in api to this, because current is confusing a bit