Finding the industry is at the moment solved, now it's getting interesting. Reading stored items in stock works almost 100%, but when an unknown vehicle delivers items to the factory it should be read in the game script. My thought was at the first moment "easy", but no. The stored value is reduced by the production while vehicles are unloading. That means it is tricky not to miss any items as these values are increasing and decreasing at the same time. Looking on Consumption though seems to be better as this value is ending on the same value as the cargo amount was on the vehicle, but how to get it?
I have also tested to read production by using produced = game.interface.getIndustryProduction(EntityId)
For industries that are producing something the code works, but I get only "zero" in production on industry that doesn't produce anything, like an export industry.
Reading Production from this Industry (that doesn't produce anything) I only get = 0, it should have been 25 like it will be if read production on a producing industry.
Now I opened the TransportFever2.exe in Notepad++ to see if there could be something else to read and I searched for "getIndustry" This is what I found:
getIndustryProduction getIndustryProductionLimit getIndustryShipping getIndustryTransportRating
Looking around this place in the code of TransportFever2, gave nothing.
For me it looks like the game doesn't do right when there is an only consuming industry. None of these four values are usable.
I have spent some time to try to find how to read the Consumptions values. I used eis_os API inspector and I can't find any useful data. Is there a way to read these Consumption data?
edit:
In one of the vanilla campaign (03) I found a code to get itemsConsumed
local c = game.interface.getEntity(game.interface.getEntity(params.glasgow_steelmill).simBuildings[1]).itemsConsumed
changing the steelmill entityiD to my factory is giving me an address to a table. I wish to learn how to look into a table to get the names of the data to be read. I guess that the API will have some function in the console.