Jump to content

Low temperature overlay does not appear before player starts taking damage from freezing

  • Pending

The ice overlay that warns the player they are at a dangerously low temperature does not appear until the player starts to take damage from freezing. The sound effect also does not play at the warning threshold, giving the player no indication that they are close to freezing until they start to take damage. The overlay otherwise functions as normal, persisting until the player has sufficiently warmed up. The overheating overlay functions normally, and idle animations are unaffected as well.

Steps to Reproduce

Bring your character to critically low temperatures (freezing); the method doesn't matter, though it can most easily be achieved through surrounding yourself with multiple endothermic fires.

User Feedback

Not sure if it's fine to reply to an old thread, but I thought that making another one when one exists would be bad.

I recently picked up on the game again and noticed this is still a thing. I looked through the code to find the cause (now that I have a better understanding) and I found the following, in the 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) do --right here

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

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. 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) do --right here

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

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) do

Should instead be:

(temp <= 5 or TheWorld.state.iswinter) do

Or alternatively:

(temp <= all_up_thresh[ 1 ] or TheWorld.state.iswinter) do

Both cases using <= to be consistent with original behavior as well as how HeatOver handles overheating.

I would personally define values used for both IceOver and HeatOver somewhere else and then set them here (or automatize them in some way based on the freezing and overheating temperature values) so that they're not hard-coded into the functions. But either way, fixing this would be very nice, suddenly starting to take freezing damage because we're not in winter isn't fun!

I hope I don't come across as trying to tell you (Klei) what to do, this is just what I was able to find and make sense of, and how I'd go about it as a suggestion. I hope it helps!

Edit: realized that IceOver has 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 =
				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])


Edited by hoxi
Updated one of the suggested lines + added suggestion regarding SFX anti-spam, like with overheating

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