Shelter


Shelter is a special survival condition that displays with status effects below the hunger and thirst meters, but does not display any active buff on the character's stats page.
Its primary function is to provide protection from the Sandstorm, requiring at least 80% shelter to do so.
Shelter is determined through detection of solid surfaces in five directions from the player. These detection lines are aligned to the map, not the player character, and point North, East, South, West and Up. The detection distance is twenty meters, which is slightly less than eight blocks.
Most windows are actual holes in the wall and can count against shelter if the character is lined up with them. Doors specifically count as no shelter.
For each of the five detection lines that encounter a solid surface, the character gains 20% shelter, up to 100% if all five make contact. If they have no covering above, they receive a -40% shelter penalty. At least three directions need to make contact at the same time, or shelter is set to 0%.
In addition to providing protection from the Sandstorm, shelter also provides temperature resistance equal to 5 resistance per detection line that makes contact with a player-built building piece multiplied by the percentage of shelter, up to a maximum of +25 resistance if all five detection lines reach a player-built building piece: 5 * 5 * 100%
Note that detection lines stop as soon as they make contact with an object and only building pieces count toward temperature resistance, this means that something like a tapestry hanging on a wall will stop the detection line before it reaches the wall. This will not reduce the Shelter percentage, but will exclude the covered wall from adding its +5 resistance to the total.