Community Forum

How to read information about crop/ground status

Forum Overview >> Scripting

Created20.01.2019 20:19

Stephan Schlosser (Balu_) 20.01.2019 20:19

I am currently trying to write a mod which would need access to the current growthState, groundState (cultivated, sprayed etc.).
Basically the same information that is available for the player in the Map view.

But I have been searching for methods to get these infos now for a few days without real success.

What I have tried:
FSDensityMapUtil.getFruitArea() at least returns me some density value, but I am still uncertain about the exact meaning of it and especially about the two parameters at the end: boolean allowPreparing, boolean useMinForageState
So any explanation on how to process the return values is highly appreciated.
For example if I wanted to calculate in percent how much of a field is currently sown, cultivated etc., how could i do that.

Information available:
field.getFieldStatusPartitions() I assume returns the field partitions I can use to feed the above mentioned method to check a whole field for a certain crop.

In FS17 there were more methods available in the engine as far as I can read in other/older mods. What I would have liked to access:
-setDensityReturnValueShift(id, -1);
-setDensityCompareParams(id, "between", desc.minHarvestingGrowthState+1, desc.maxHarvestingGrowthState+1);
-getDensityParallelogram(g_currentMission.fruitsList[1].id, field.x0, field.z0, field.widthX, field.widthZ, field.heightX, field.heightZ, 1, 4);

but all these methods report nil. I guess that would be the way to receive information about a field, right?
Or is the information the Map in the menu displays somewhere available? I couldn't find it yet. And always using DebugUtil.printTableRecursively(), hoping that most of it was actually dumped in the log and restarting the game each time, really is getting on my nerves :D

Anyone who could point me in the right direction?
Thank you very much!

Bilbo Beutlin (BBeutlin) 21.01.2019 00:46
Just an idea where to go:
In General->FieldInfoDisplay is used FSDensityMapUtil.getFieldStatusAsync()
For the table contents see Utils->FSDensityMapUtil

Stephan Schlosser (Balu_) 21.01.2019 12:42
that looks interesting. Now I just have to find out what kind of parameters the
FSDensityMapUtil.getFieldStatusAsync() or
methods require.
I will try some combinations this evening. And what do you mean by table contents at Utils->FSDensityMapUtil?
There is no information about these methods there. Or am I missing something? The methods exist but are not documented.

Thank you very much!

Stephan Schlosser (Balu_) 21.01.2019 13:04

FieldInfoDisplay.onFieldDataUpdateFinished = Utils.appendedFunction(FieldInfoDisplay.onFieldDataUpdateFinished, MyMod.onFieldDataUpdateFinished);

I was able to interject my own method to catch the data send to the FieldInfoDisplay and this is exactly the information I was looking for!
Thank you again!
But the problem remains that I will have to be able to select for which field I want the info instead of receiving it just for the one, FieldInfoDisplay is querying.

Best regard,

Note: Log in to post. Create a new account here.