Jump to content

Spring has inverted atmosphere moisture rate progress


hoxi
  • Pending

This applies to both weather.lua and caveweather.lua, and though the issue originates from Don't Starve, not Don't Starve Together, the code is definitely based on it. Problem is, there was an oversight there, which made it into DST.

From Don't Starve code, from the seasonmanager files for all the DLCs except base game:

elseif self:IsSpring() then
	--we really want it to rain in early spring to show the season change
	--if self:GetDaysIntoSeason() > 1 and self:GetDaysIntoSeason() < 3 then

	--else
	--but it also rains a ton in the middle of spring
	local p = 1-math.sin(PI*percent_season)
	local min_spring_rate = 3
	local max_spring_rate = 3.75
	atmo_moisture_rate = (min_spring_rate + p * (max_spring_rate - min_spring_rate)) * self.base_atmo_moisture_rate
	--end
else

When defining p, that 1- shouldn't be there, as it does the same as other seasons, which is the opposite of what was intended, going up a lot more at the start and end of the season, rather than in the middle, where it's supposed to rain more often.

By comparison, DST has overall the exact same functionality, just with a different code structure. Even the minimum and maximum values are the same.

 

The following function in weather.lua:

    local function OnSeasonTick(src, data)
        _season = data.season
        _seasonprogress = data.progress

        if _ismastersim then
            if data.season == "winter" and data.elapseddaysinseason == 2 then
                --We really want it to snow in early winter, so that we can get an initial ground cover
                _moisturerateval = 0
                _moisturerateoffset = 50
            else
                --It rains less in the middle of summer
                local p = 1 - math.sin(PI * data.progress)
                _moisturerateval = MOISTURE_RATES.MIN[_season] + p * (MOISTURE_RATES.MAX[_season] - MOISTURE_RATES.MIN[_season])
                _moisturerateoffset = 0
            end

            _moisturerate:set(CalculateMoistureRate())
            _moistureceilmultiplier = MOISTURE_CEIL_MULTIPLIERS[_season] or MOISTURE_CEIL_MULTIPLIERS.autumn
            _moisturefloormultiplier = MOISTURE_FLOOR_MULTIPLIERS[_season] or MOISTURE_FLOOR_MULTIPLIERS.autumn
            _startsnowthreshold = START_SNOW_THRESHOLDS[_season] or START_SNOW_THRESHOLDS.autumn
            _stopsnowthreshold = STOP_SNOW_THRESHOLDS[_season] or STOP_SNOW_THRESHOLDS.autumn
        end
    end

And caveweather:

local function OnSeasonTick(src, data)
    _season = data.season
    _seasonprogress = data.progress

    if _ismastersim then
        local p = 1 - math.sin(PI * data.progress)
        _moisturerateval = MOISTURE_RATES.MIN[_season] + p * (MOISTURE_RATES.MAX[_season] - MOISTURE_RATES.MIN[_season])
        _moisturerateoffset = 0

        _moisturerate:set(CalculateMoistureRate())
        _moistureceilmultiplier = MOISTURE_CEIL_MULTIPLIERS[_season] or MOISTURE_CEIL_MULTIPLIERS.autumn
        _moisturefloormultiplier = MOISTURE_FLOOR_MULTIPLIERS[_season] or MOISTURE_FLOOR_MULTIPLIERS.autumn
    end
end

Both need to have a specific check for spring:

if data.season == "spring" then
    -- inverted from the other seasons, it rains a lot in the middle of spring
    local p = math.sin(PI * data.progress)
    _moisturerateval = MOISTURE_RATES.MIN[_season] + p * (MOISTURE_RATES.MAX[_season] - MOISTURE_RATES.MIN[_season])
    _moisturerateoffset = 0
else

 

Another thing to note is that DST makes the moisture rate change during winter just like in other seasons, and with the same rates as autumn. This is weird because this was pretty clear to not be the case in DS, where it was a static value of 1x, except for the second day of winter where it's 50x instead (which is the one thing that was kept).

This makes me think this might also be an oversight in DST, from when the code was adapted.


Steps to Reproduce

Don't really need to specify anything here.




User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...