Health of item on belt

Place to get help with not working mods / modding interface.
Neel
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Sep 10, 2016 11:26 am
Contact:

Health of item on belt

Post by Neel »

Items on belt have health. When picked up or inserted into a chest, it shows up. But the TransportLine API only shows contents with names and counts. What is the easiest way to get the health?

As a side note, is it possible to connect an underground belt input with another output manually by using code? Currently, the Entity.neighbours show the other member of the pair, but it is read only.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Health of item on belt

Post by aubergine18 »

1. You can only access that info once you have removed item from belt (as then you have an ItemEntity object which has the properties you're looking for)

2. Underground belts and pipes automatically connect to orphans within range that are facing in the right direction. So just placing the other end in right place & direction will create the link.

If you were thinking of underground junctions... as far as I know there's no way to do that sort of thing currently - as you found, the .neighbours array is read only.
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.
Neel
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Sep 10, 2016 11:26 am
Contact:

Re: Health of item on belt

Post by Neel »

Thanks aubergine18.

1. Yeah, I'm looking for that info immediately from a reference to the belt entity, which has .transport_line.get_contents() with no health info. Can't really get them off the belt. Calling remove() just voids the item giving me only a count to work with.
2. Wanted to wire up one down belt with an up belt that's not in range or in straight line. Probably not possible as well.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Health of item on belt

Post by aubergine18 »

Neel wrote:2. Wanted to wire up one down belt with an up belt that's not in range or in straight line. Probably not possible as well.
Take a look at Factorissimo mod and see how that handles the belts/pipes between those outside and inside the factory, that might give a possible solution to your requirement. https://github.com/MagmaMcFry/Factorissimo
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 help”