scale_entity_info_icon not in docs, and shifting info icon?
scale_entity_info_icon not in docs, and shifting info icon?
I'm using scale_entity_info_icon = true in my entities (makes the recipe icon bigger for my giant 17x17 assembly machines), which appears to be missing from the documentation (I can't find it in on either lua-api.factorio.com or in the wiki under entity prototypes, so maybe it is missing from those?).
Also, the results is a little low on the entity, is there a way for me to shift the info_icon? I'd like to shift the icon up a bit so it is more centered. I can't find that in the docs either, but maybe it is missing (or just in a place I'm not looking?) for the same reason as the scale flag is.
Also, the results is a little low on the entity, is there a way for me to shift the info_icon? I'd like to shift the icon up a bit so it is more centered. I can't find that in the docs either, but maybe it is missing (or just in a place I'm not looking?) for the same reason as the scale flag is.
Re: scale_entity_info_icon not in docs, and shifting info icon?
It's documented here: https://wiki.factorio.com/Prototype/Cra ... _info_icon
There is no property for that.
There is no property for that.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
- eradicator
- Smart Inserter

- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: scale_entity_info_icon not in docs, and shifting info icon?
If the icon is centered on (0,0) of the collision box as i suspect (or at least relative to it), you could hackily work around it by decentering your collision_box. I.e {{-9,-9},{8,8}}. But you'd have to write a migration to compensate on all existing factories.Avacado wrote:Also, the results is a little low on the entity, is there a way for me to shift the info_icon? I'd like to shift the icon up a bit so it is more centered. I can't find that in the docs either, but maybe it is missing (or just in a place I'm not looking?) for the same reason as the scale flag is.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: scale_entity_info_icon not in docs, and shifting info icon?
Why would you need a migration? The game can migrate bounding box changes just fine without migration, for example the boiler size change in 0.15 or the turret size change in some old version.eradicator wrote:If the icon is centered on (0,0) of the collision box as i suspect (or at least relative to it), you could hackily work around it by decentering your collision_box. I.e {{-9,-9},{8,8}}. But you'd have to write a migration to compensate on all existing factories.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
- eradicator
- Smart Inserter

- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: scale_entity_info_icon not in docs, and shifting info icon?
Because you'd need to correct the position of all entities. Otherwise they'd be in the wrong place. As the "position" (= center) doesn't change, while the bounding box does.Bilka wrote:Why would you need a migration? The game can migrate bounding box changes just fine without migration, for example the boiler size change in 0.15 or the turret size change in some old version.eradicator wrote:If the icon is centered on (0,0) of the collision box as i suspect (or at least relative to it), you could hackily work around it by decentering your collision_box. I.e {{-9,-9},{8,8}}. But you'd have to write a migration to compensate on all existing factories.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: scale_entity_info_icon not in docs, and shifting info icon?
@Bilka,
Crafting machine wasn't one of the places I manually looked (though in retrospect it maybe should've been), and when I searched "info_icon" on the wiki it returned no results, though now I see if I search the entire thing "scale_entity_info_icon" I do get results. Why is this field only on the wiki and not lua-api.factorio.com?
@eradicator,
I tried adjusting all the boxes (collision_box, selection_box, and drawing_box), none of them moved the icon, so I think it must be basing the position off of parts of .animation or something else. I did find module_info_icon_shift, but I don't think there is an equivalent shift for the recipe info icon. Maybe if I add some blank space to the bottom of the images that are being used I can change the center, if that is what it is actually based on.
Crafting machine wasn't one of the places I manually looked (though in retrospect it maybe should've been), and when I searched "info_icon" on the wiki it returned no results, though now I see if I search the entire thing "scale_entity_info_icon" I do get results. Why is this field only on the wiki and not lua-api.factorio.com?
@eradicator,
I tried adjusting all the boxes (collision_box, selection_box, and drawing_box), none of them moved the icon, so I think it must be basing the position off of parts of .animation or something else. I did find module_info_icon_shift, but I don't think there is an equivalent shift for the recipe info icon. Maybe if I add some blank space to the bottom of the images that are being used I can change the center, if that is what it is actually based on.
Re: scale_entity_info_icon not in docs, and shifting info icon?
Because it's a prototype property and lua-api.factorio.com does not document the prototypes.Avacado wrote:Crafting machine wasn't one of the places I manually looked (though in retrospect it maybe should've been), and when I searched "info_icon" on the wiki it returned no results, though now I see if I search the entire thing "scale_entity_info_icon" I do get results. Why is this field only on the wiki and not lua-api.factorio.com?
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
- eradicator
- Smart Inserter

- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: scale_entity_info_icon not in docs, and shifting info icon?
The usual pattern.
@Avacado:
Err, no it's based off the position of the entity, just like i expected.
- Some modder posts a question of the forum.
- I speculate about a possible solution.
- Some modder answer that solution didn't work.
- I don't believe and try it myself. And it works.
@Avacado:
Err, no it's based off the position of the entity, just like i expected.
Code: Select all
data.raw['assembling-machine']['assembling-machine-1'].collision_box =
{ {x = 0,y = 0}, {x = 2.9,y = 2.9}}
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: scale_entity_info_icon not in docs, and shifting info icon?
@eradicator
Yeah, you're right, I misread it as centered in the center of the collision box, and my experiments reflected that (I, for example, changing the -y to half the value, which didn't move the icon), but the visual explained it really well. That also explains the need for migration, which I also didn't follow, but yeah, actually moving the 0,0 point would need migration. Thank you for your help and my apologies for not reading your original more carefully.
That doesn't move the icon relative to the entity sprite, which is why I stated that it was in .animation, since that is where I would have to make a change to move the icon relative to the entity sprite, but what you stated was still correct.
Yeah, you're right, I misread it as centered in the center of the collision box, and my experiments reflected that (I, for example, changing the -y to half the value, which didn't move the icon), but the visual explained it really well. That also explains the need for migration, which I also didn't follow, but yeah, actually moving the 0,0 point would need migration. Thank you for your help and my apologies for not reading your original more carefully.
That doesn't move the icon relative to the entity sprite, which is why I stated that it was in .animation, since that is where I would have to make a change to move the icon relative to the entity sprite, but what you stated was still correct.
Last edited by Avacado on Fri Jul 20, 2018 3:02 pm, edited 1 time in total.
- eradicator
- Smart Inserter

- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: scale_entity_info_icon not in docs, and shifting info icon?
Hope you get it to work. Fourtunately find_entities_filtered has a whole-surface mode, and teleporting machines is a thing these days.
Edit why would you need to change the animation? You just .shift={x,y} that down too.
Edit why would you need to change the animation? You just .shift={x,y} that down too.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- eradicator
- Smart Inserter

- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: scale_entity_info_icon not in docs, and shifting info icon?
Code: Select all
local this = data.raw['assembling-machine']['assembling-machine-1']
this.collision_box = {left_top = {x = -8.9/2,y = -3},right_bottom = {x = 8.9/2,y = 5.9} }
this.scale_entity_info_icon = true
for k,v in pairs(this.animation.layers) do
v.shift = util.by_pixel(0, 48*1)
v.scale = 3/2
v.hr_version.shift = util.by_pixel(0, 48*1)
v.hr_version.scale = 3/2
endAuthor of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

