ItemEntity from TransportLine

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Neel
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Sep 10, 2016 11:26 am
Contact:

ItemEntity from TransportLine

Post by Neel »

Currently TransportLine only gives item name and counts, I need to access the health too. Trying to find entities also skip the items on transport lines. So I can't get this info in any way, however the health exists, and is available if an inserter or player picks up the item from the belt.

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: ItemEntity from TransportLine

Post by Afforess »

Neel wrote:Currently TransportLine only gives item name and counts, I need to access the health too. Trying to find entities also skip the items on transport lines. So I can't get this info in any way, however the health exists, and is available if an inserter or player picks up the item from the belt.
TransportLines don't carry ItemEntities (or they haven't since 0.11), as I understand it's an emulated facsimile that is not really an entity. It sounds like the health field does need to be exposed somehow though.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: ItemEntity from TransportLine

Post by Rseding91 »

Ah yes, there was a bug fix in one of the recent versions of 0.14 that means I can now make a wrapper around LuaItemStack that will point at a item on belt. Or, at least I think I can :)

So, perhaps for 0.15 that will be added in.
If you want to get ahold of me I'm almost always on Discord.

Neel
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Sep 10, 2016 11:26 am
Contact:

Re: ItemEntity from TransportLine

Post by Neel »

Rseding91 wrote:So, perhaps for 0.15 that will be added in.
Looking forward to it! <3

Neel
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Sep 10, 2016 11:26 am
Contact:

Re: ItemEntity from TransportLine

Post by Neel »

Any possibility this might come out in a 14.x version soon? I wanted to try some experimental ideas with stacks on belt.

The nice thing about health is that it's a double, so, can be used as an additional kind of type, or ID, or all kinds of crazy things. :)

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: ItemEntity from TransportLine

Post by Rseding91 »

Neel wrote:Any possibility this might come out in a 14.x version soon? I wanted to try some experimental ideas with stacks on belt.

The nice thing about health is that it's a double, so, can be used as an additional kind of type, or ID, or all kinds of crazy things. :)
No, also health isn't unique to an item. If 2 items have the same health the game will stack them. Also health is not a double: it's a float.
If you want to get ahold of me I'm almost always on Discord.

Neel
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Sep 10, 2016 11:26 am
Contact:

Re: ItemEntity from TransportLine

Post by Neel »

Sorry didn't phrase that right. I am aware that items with same health stack, and that's fine for my use case. Factorissimo uses it as id in a creative way, and I want to do something similar. Thanks for the correction on float vs double. 32 bits good enough for me. :)

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: ItemEntity from TransportLine

Post by aubergine18 »

There are plans to change the way it works in 0.15 according to the recent #FF: viewtopic.php?f=38&t=34319

It would be better to use some alternate approach, for example...

When the entity is mind, use the pre_mined events to swap it with a different entity (not sure if this is feasible if a robot is mining, although there's prototype flag to prevent robots mining a specific kind of entity)... Anyway, maybe a blueprint or something, that you can give a custom name or value to. I've not tried, but it should be possible to create custom blueprint prototype in your data.lua, so you can give it proper icon, name and description - the user will not be aware that it's a blueprint if done properly.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Post Reply

Return to “Modding interface requests”