draw_text offset

Place to get help with not working mods / modding interface.
User avatar
SLywnow
Inserter
Inserter
Posts: 39
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

draw_text offset

Post 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
Bilka
Factorio Staff
Factorio Staff
Posts: 3314
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: draw_text offset

Post 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"
}
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
User avatar
SLywnow
Inserter
Inserter
Posts: 39
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

Re: draw_text offset

Post 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
Post Reply

Return to “Modding help”