A little help for a beginner ...

Your forum for all discussions around Modding.
LePousson
Posts: 14
Joined: Tue May 19, 2020 11:57 pm

A little help for a beginner ...

Post by LePousson »

Hi !

As a start for my "developer/modder carreer", i'm trying to modify existing mods to fit my needs, and I'm currently having a problem with a little sweeper for animal foods ...

No matter what I clean (wheat, grass, pigfdood ...) the sweeper contains MANURE. After looking a bit in the LUA script, I found this :

spec.workAreaParameters.forcedFillType = FillType.MANURE

Could someone tell me what to modify here so that the sweeper will contain what I'm cleaning (wheat or grass etc ...) ?

Thanks in advance !

LePousson
s8080t
Posts: 712
Joined: Wed Nov 20, 2019 9:26 pm

Re: A little help for a beginner ...

Post by s8080t »

Hi,
digging into existing mods and changing them to your needs is a very good approach. Keep it up!

I think you'd need to add logic to the script to read what you sweep (what the workArea picks up) and change the value of spec.workAreaParameters.forcedFillType accordingly.
Or maybe just drop the logic that changes the fill type to manure? This way, the sweeper should contain what it picks up :D
Languages: DE/EN
Plattform: PC
Meine Mods
Grünlandsuchti
IT-Spezialexperte
OpenSource-Verfechter
LePousson
Posts: 14
Joined: Tue May 19, 2020 11:57 pm

Re: A little help for a beginner ...

Post by LePousson »

s8080t wrote: Thu Jul 08, 2021 9:06 pm Hi,
digging into existing mods and changing them to your needs is a very good approach. Keep it up!

I think you'd need to add logic to the script to read what you sweep (what the workArea picks up) and change the value of spec.workAreaParameters.forcedFillType accordingly.
Or maybe just drop the logic that changes the fill type to manure? This way, the sweeper should contain what it picks up :D
Thanks for the kind words, I really appreciate :=)

As I just started a few days ago to dig into the LUA scripts, I don't have (yet) the necessary knowledge to be able to know what to do exactly :confusednew: :confusednew:

What would you do if you were me ?

LePousson
Eische
Posts: 3804
Joined: Thu Oct 18, 2018 5:17 pm

Re: A little help for a beginner ...

Post by Eische »

Can you provide a link to that mod or post the lua in question?
First idea would be to remove/comment this section so that the fill type will not enforced any longer.

But we need the full lua to check if this can be done without causing problems.
Playing on PC - Win10
Ryzen 3600
RX 5500XT
16GB Ram
How to post log file
How to upload pictures
Please report bugs for FS22 using the bugtracker
LePousson
Posts: 14
Joined: Tue May 19, 2020 11:57 pm

Re: A little help for a beginner ...

Post by LePousson »

Eische wrote: Fri Jul 09, 2021 11:21 am Can you provide a link to that mod or post the lua in question?
First idea would be to remove/comment this section so that the fill type will not enforced any longer.

But we need the full lua to check if this can be done without causing problems.
The mod is this one : https://www.farming-simulator.com/mod.p ... tle=fs2019

If someone can help, I'd really appreciate ;)

LePousson
LePousson
Posts: 14
Joined: Tue May 19, 2020 11:57 pm

Re: A little help for a beginner ...

Post by LePousson »

Anyone can help please ??
s8080t
Posts: 712
Joined: Wed Nov 20, 2019 9:26 pm

Re: A little help for a beginner ...

Post by s8080t »

If I get the script correctly, then the fillType is not converted to manure by default but only when it's an unsupported fillType.
As supported fillType, the mod-XML states the bulk category. You could add anything else in there, of course.

Code: Select all

        spec.workAreaParameters.forcedFillType = FillType.MANURE
...
        local supportedFillTypes = self:getFillUnitSupportedFillTypes(spec.fillUnitIndex)
        if supportedFillTypes ~= nil then
            for fillType, state in pairs(supportedFillTypes) do
                if state then
                    local liters = -DensityMapHeightUtil.tipToGroundAroundLine(self, -math.huge, fillType, lsx, lsy, lsz, lex, ley, lez, lineRadius, nil, nil, false, nil)
                    if liters > 0 then
                        if fillType ~= spec.workAreaParameters.forcedFillType then
                            liters = liters * SweeperBrush.PRODUCT_LOSS_MULTIPLIER
                        end

                        pickupLiters = pickupLiters + liters
                    end
                end
            end
        end
Languages: DE/EN
Plattform: PC
Meine Mods
Grünlandsuchti
IT-Spezialexperte
OpenSource-Verfechter
LePousson
Posts: 14
Joined: Tue May 19, 2020 11:57 pm

Re: A little help for a beginner ...

Post by LePousson »

s8080t wrote: Thu Jul 15, 2021 10:24 pm If I get the script correctly, then the fillType is not converted to manure by default but only when it's an unsupported fillType.
As supported fillType, the mod-XML states the bulk category. You could add anything else in there, of course.
Even when sweep WHEAT, GRASS or PIGFOOD, it converts it to MANURE. I can't understand why it behavesw like that :'(

Any idea ?

LePousson
Eische
Posts: 3804
Joined: Thu Oct 18, 2018 5:17 pm

Re: A little help for a beginner ...

Post by Eische »

What about completely ignoring the script?
Just delete the respective entry in the modDesc.xml changing this:

Code: Select all

    <specializations>
        <specialization name="sweeperBrush" className="SweeperBrush" filename="SweeperBrush.lua"/>
    </specializations>

    <vehicleTypes>
        <type name="tuchelSweep" className="Vehicle" parent="implement" filename="$dataS/scripts/vehicles/Vehicle.lua">
            <specialization name="fillUnit"/>
            <specialization name="fillVolume"/>
            <specialization name="dischargeable"/>
            <specialization name="groundReference"/>
            <specialization name="workArea"/>
            <specialization name="workParticles"/>
            <specialization name="turnOnVehicle"/>
            <specialization name="dynamicMountAttacher"/>
            <specialization name="sweeperBrush"/>
        </type>
    </vehicleTypes>
 
to this:

Code: Select all


    <vehicleTypes>
        <type name="tuchelSweep" className="Vehicle" parent="implement" filename="$dataS/scripts/vehicles/Vehicle.lua">
            <specialization name="fillUnit"/>
            <specialization name="fillVolume"/>
            <specialization name="dischargeable"/>
            <specialization name="groundReference"/>
            <specialization name="workArea"/>
            <specialization name="workParticles"/>
            <specialization name="turnOnVehicle"/>
            <specialization name="dynamicMountAttacher"/>
        </type>
    </vehicleTypes>
This should enable it to work as you want it to work.
Playing on PC - Win10
Ryzen 3600
RX 5500XT
16GB Ram
How to post log file
How to upload pictures
Please report bugs for FS22 using the bugtracker
s8080t
Posts: 712
Joined: Wed Nov 20, 2019 9:26 pm

Re: A little help for a beginner ...

Post by s8080t »

Eische wrote: Fri Jul 16, 2021 7:51 am What about completely ignoring the script?
The workAreas in the XML also need to be adjusted as they use functions from the sweeper script.

I also think this is a good way to go - use some other vehicleType that picks up stuff and just drops it into a fillVolume :>
Languages: DE/EN
Plattform: PC
Meine Mods
Grünlandsuchti
IT-Spezialexperte
OpenSource-Verfechter
Post Reply