Cover

Cover determines when players are sheltered and affects behavior of some structures.
Cover is calculated by checking how many of the 17 cover rays are blocked by obstacles. Each ray starts 0.5 meters from the structure cover point and extends to 29.5 meters (30 meters from the cover point).
Cover rays always have the same orientation that doesn't depend on the structure rotation. The directions are:
* Directly upwards.
* 8 cardinal directions on a horizontal plane.
* 8 cardinal directions at 45 degrees between horizontal and vertical plane.
Roof is checked by finding a non-leaky material directly above within 100 meters.
The implementation has several quirks:
* When very close to walls/roof, some cover lines may start outside the wall/roof (completely ignoring the roof/wall).
* Same building with a different orientation may have a different cover because cover lines always have the same orientation.
* Buildings with a very large open area may end up without cover.
* Terrain, trees or rocks may cause unexpected cover.
== Affected structures ==
*Artisan table, Forge, Stonecutter, Workbench: 70% cover and roof is required for crafting and repairing.
* Bed, Dragon bed: 80% cover and roof is needed for setting spawn point and sleeping.
* Beehive: Less than 60% cover is needed to produce honey.
* Fermenter:70% cover and roof is needed for fermenting.
* Bonfire: 70% cover is needed for the stronger fire during strong winds.
* Campfire, Hearth: 70% cover is needed for fire during strong winds.
* Player: 80% cover and roof is needed for sheltered.
*Sconce, Standing blue-burning iron torch, Standing green-burning iron torch, Standing iron torch, Standing wood torch: 0.5 meters of space is needed above for fire.
*Windmill: Cover percentage directly affects speed. Propeller always blocks 24% - 29% of the cover rays depending on the wind direction.
Artisantable cover.jpg|Artisan table visualized with a mod
Bed_cover.jpg|Bed visualized by a mod
Beehive cover.jpg|Beehive visualized by a mod
Bonfire cover.jpg|Bonfire visualized with a mod
Workbench cover.jpg|Campfire visualized with a mod
Dragonbed_cover.jpg|Dragon bed visualized by a mod
Fermenter cover.jpg|Fermenter visualized by a mod
Forge cover.jpg|Forge visualized with a mod
Hearth cover.jpg|Hearth visualized with a mod
Stonecutter cover.jpg|Stonecutter visualized with a mod
Windmill cover.jpg|Windmill visualized with a mod
Workbench cover.jpg|Workbench visualized with a mod
Category:Gameplay
Category:Mechanics