Crop Destruction

Your forum for all discussions around Modding.
lindbejb
Posts: 71
Joined: Tue Sep 01, 2015 10:32 pm

Crop Destruction

Post by lindbejb »

is it possible to modify the lua to destroy harvested crops too?
User avatar
aklein
Posts: 848
Joined: Mon Nov 28, 2016 8:04 pm

Re: Crop Destruction

Post by aklein »

harvested crops? Are you talking about driving over straw and grass/hay on the windrow? Are you talking about driving over a heap of something on the ground?
lindbejb
Posts: 71
Joined: Tue Sep 01, 2015 10:32 pm

Re: Crop Destruction

Post by lindbejb »

talking about the harvest stubble, would be nice to have that destroyed
User avatar
theSeb
Posts: 1517
Joined: Tue Mar 07, 2017 8:16 pm

Re: Crop Destruction

Post by theSeb »

Yes, it would be possible.
lindbejb
Posts: 71
Joined: Tue Sep 01, 2015 10:32 pm

Re: Crop Destruction

Post by lindbejb »

theSeb wrote:Yes, it would be possible.

can you show where to make the modifications, I don't understand Giants version as I did with the previous wheels lanes .lua from 15
User avatar
theSeb
Posts: 1517
Joined: Tue Mar 07, 2017 8:16 pm

Re: Crop Destruction

Post by theSeb »

lindbejb wrote:
theSeb wrote:Yes, it would be possible.

can you show where to make the modifications, I don't understand Giants version as I did with the previous wheels lanes .lua from 15
The function is destroyFruitArea and you would need to look at lines 139 to 148 in the latest version on modhub. This is where the selection is made on what fruit states the destruction will act upon.

I assume you have studied FruitUtil tables in the game? You will need to understand it.

Code: Select all

setDensityCompareParams(entry.preparingOutputId, "equal", 0);
setDensityMaskParams(entry.preparingOutputId, "between", 2, desc.maxPreparingGrowthState+1);
setDensityMaskedParallelogram(entry.preparingOutputId, x,z, widthX,widthZ, heightX,heightZ, 0, 1, entry.id, 0, g_currentMission.numFruitStateChannels, 1);
setDensityCompareParams(entry.preparingOutputId, "greater", -1);
setDensityMaskParams(entry.preparingOutputId, "greater", 0);
                
setDensityCompareParams(entry.id, "between", 2, desc.maxPreparingGrowthState+1);
setDensityParallelogram(entry.id, x,z, widthX,widthZ, heightX,heightZ, 0, g_currentMission.numFruitStateChannels, desc.cutState+1);
setDensityCompareParams(entry.id, "greater", -1);

lindbejb
Posts: 71
Joined: Tue Sep 01, 2015 10:32 pm

Re: Crop Destruction

Post by lindbejb »

in 15 the harvested state was usually stage 9, would I just change 2 to 9?
User avatar
theSeb
Posts: 1517
Joined: Tue Mar 07, 2017 8:16 pm

Re: Crop Destruction

Post by theSeb »

lindbejb wrote:in 15 the harvested state was usually stage 9, would I just change 2 to 9?
It depends on the crop, but for stuff like wheat, barley and rape it is 8. 9 would be withered

I highly recommend printing out g_currentMission.fruitUtil
lindbejb
Posts: 71
Joined: Tue Sep 01, 2015 10:32 pm

Re: Crop Destruction

Post by lindbejb »

theSeb wrote:
lindbejb wrote:in 15 the harvested state was usually stage 9, would I just change 2 to 9?
It depends on the crop, but for stuff like wheat, barley and rape it is 8. 9 would be withered

I highly recommend printing out g_currentMission.fruitUtil
tried an failed lol, guess I will stick to modeling
Post Reply