DeckerMMIV / FS13_SoilManagement

A mod for Farming Simulator 2013 that adds additional abilities of field and soil management
7 stars 8 forks source link

mapwise parameter definition #17

Open upsidedownLS13 opened 10 years ago

upsidedownLS13 commented 10 years ago

Just a suggestion, but I think it would help a lot.

Can you make the gameplay parameters of your mod dependend on a table in g_currentMission?

To illustrate what I mean, lets call it g_currentMission.fmcSoilModParameters = {}

Now I can optionally set fields within the loadMap01Finished()-function of my map. If they are ~=nil they are taken with priority. This way a mapper could e.g. set fmcGrowthControl.disableWithering without touching your code and without influencing other maps - even if they are loaded after the first one.

besides things like fmcGrowthControl.disableWithering; fmcGrowthControl.reduceWindrows etc I am also thinking of two important parameters that are hardcoded at the moment:

Lets say you define g_currentMission.fmcSoilModParameters.growthDays for the current map and also change the fmcGrowthControl:hourChanged function something like this:

function fmcGrowthControl:hourChanged()
     if  not fmcGrowthControl.active -- Must not already be running
     and g_currentMission.environment.currentHour == 0 -- midnight hour
     and (g_currentMission.environment.currentDay + 1) ~= fmcGrowthControl.lastUpdateDay 
     and (g_currentMission.environment.currentDay + 1) > (fmcGrowthControl.lastUpdateDay + Utils.getNoNil(g_currentMission.fmcSoilModParameters.growthDays,0))
    then
        fmcGrowthControl.canActivate = true
    end
end

and maybe a similar change to accomodate for the slowdown in weed growth:

function fmcGrowthControl:minuteChanged()
     if fmcGrowthControl.weedCounter == nil then
        fmcGrowthControl.weedCounter = 0;
    end;
    fmcGrowthControl.weedCounter = fmcGrowthControl.weedCounter + 1;
    if fmcGrowthControl.weedCounter > Utils.getNoNil(g_currentMission.fmcSoilModParameters.growthDays,0) then
        fmcGrowthControl.weedCounter = 0;
        fmcGrowthControl.weedPropagation = true;                
    end;
end

Just an idea, but I think a lot of folks&mapper would appreciate a feature like this.

DeckerMMIV commented 10 years ago

With @53903fb98e157677e9ecbfd8beded271d547867d I added something similar, where the parameters are stored in the careerSavegame.XML file, so the hosting-player could then change the values and re-load the savegame.

If you use that revision (or later) of the mod, start a game and save, then look in careerSavegame.XML to see the parameters.

But yes, I could add a possibility for the map-author to "set the initial value of the parameters" when starting a new career/savegame.

The "slowdown in weed growth" I have not heard of before? Are some complaining that the weed plants propagate too much/fast? - If so, please create a new issue for it.

upsidedownLS13 commented 10 years ago

The weed propagation issue is a direct response to your statement here: http://fs-uk.com/forum/index.php?topic=161700.msg1086560#msg1086560

The propagation of weed will happen every in-game minute - though it will not grow - so it may happen that if the 'growth cycle' is delayed say 5 in-game days, there will be 5 times as many weed plants growing, if no herbicide have been sprayed.

This is why I coupled it to the longer growth period introduced in the sketched hourChange function. Nonwithstanding it could be implemented as an independend parameter though.

And

But yes, I could add a possibility for the map-author to "set the initial value of the parameters" when starting a new career/savegame.

this would be greatly appreciated I think :+1: