Jump to content

Low temperature warnings don't play under certain conditions


hoxi
  • Pending

If you get cold outside of winter, there's no overlay warning (and the sounds that play from it) unless you're inside an Ice Crystaleyezer's range. You just start taking damage out of nowhere.

This is due to an extra check for temperature being below 0 (enough to take cold damage), or that the current season is winter or local temperature is below 0, as of the last update. This can be a problem at times and could actually end up killing you if low on health, especially at the start of spring if it's already raining a lot (had it happen to a friend).

 Here's what I found in regards to the code, in the following file:

  • data\scripts\widgets\icecover.lua

Seems like in the IceOver:OnIceChange() function, specifically at line 50, shown below:

	local isup = false
    while all_up_thresh[self.laststep + 1] ~= nil and
        temp < all_up_thresh[self.laststep + 1] and
        self.laststep < num_steps and
        (temp < 0 or TheWorld.state.iswinter or GetLocalTemperature(self.owner) < 0) --right here

        self.laststep = self.laststep + 1
        isup = true
    end

One of the checks to allow show the freezing overlay is that the temperature has to be below 0 degrees, which is when we start taking cold damage, otherwise the season has to be winter or local temperature has to be 0. The thresholds table indicates the first step is at when below 5 degrees, as shown below:

local all_up_thresh = {5, 0, -5, -10}

For comparison, this is how its handled for overheating, in the file:

  • data\scripts\widgets\heatover.lua

In the HeatOver:OnHeatChange() function, at line 68, shown below:

	local isup = false
	while all_up_thresh[self.laststep+1] ~= nil and
		temp > all_up_thresh[self.laststep+1] and
		self.laststep < num_steps and
		(temp >= 65 or TheWorld.state.issummer or GetLocalTemperature(self.owner) >= 65) do --right here

		self.laststep = self.laststep + 1
		isup = true
	end

With the thresholds being:

local all_up_thresh = {65, 70, 75, 80}

Whereas 70 is the overheating temperature, and 65 is the first step for the overlay to show, and it matches in the code above.

It probably doesn't help that a lot of these values are hard-coded into the functions instead of retrieving values from settings from elsewhere (like tuning.lua), and it's hard to tell if this intentional as a design choice for cold damage outside of winter not showing a "freezing" warning since there's not "freezing cold" happening, it's that we're cold (like from wetness/moisture being too high), or if this is a bug or oversight.

If it's intentional, then some sort of warning is needed. If it's not, it's a simple fix.

(temp < 0 or TheWorld.state.iswinter or GetLocalTemperature(self.owner) < 0) do

Could be removed entirely, as it's completely arbitrary, both from here, along with its overheating equivalent in HeatOver, even if it works fine there (which begs the question why these checks are even a thing).

IceOver also seems to have no anti-spam prevention for each sound, so I added that as well, but this is more entirely optional really. Borrowed from HeatOver and singleplayer Don't Starve.

				local freeze_sounds_names =
				{
					"freeze_1st",
					"freeze_2nd",
					"freeze_3rd",
					"freeze_4th",
				}
				if isup then
					 -- Check if the sound is playing so it doesn't get spammed when temp dances back and forth across the threshold
					if not TheFrontEnd:GetSound():PlayingSound(freeze_sounds_names[self.laststep]) then
						TheFrontEnd:GetSound():PlaySound(freeze_sounds[self.laststep], freeze_sounds_names[self.laststep])
					end

Steps to Reproduce
  1. Get cold through any method outside of winter (wetness, endothermic fires, a chill amulet, etc), without being inside an Ice Crystaleyezer's range.
  2. Lower your temperature enough to take cold damage.
  3. Notice how there won't be a warning prior to taking damage.
  • Like 2



User Feedback


Not sure if this is a proper way to bump or bring attention to this, but I'd say this is decently impactful to at least take a look at.

If the reason that is_winter check was added was so that new players don't see the freezing overlay when starting out, and potentially freak out, maybe a different and more specific check could be used?

Share this comment


Link to comment
Share on other sites

Still an issue even after the Ice Crystaleyezer got added. There's just now a local temperature check to pretend it's winter when inside their range.

Though this change means that players will actually get the warning if the world is cold enough, as GetLocalTemperature returns the world's temperature if not inside an overrider's range. So it further begs the question why these checks are even there, for both IceOver and HeatOver (they do even less there because it doesn't make a difference). Wouldn't it make sense to get rid of them and save performance? At least mainly due to the local temperature check.

Share this comment


Link to comment
Share on other sites



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...