MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / exposedToWeather

Method exposedToWeather

source/game/StarWorldClient.cpp:2141–2156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2139}
2140
2141bool WorldClient::exposedToWeather(Vec2F const& pos) const {
2142 if (!inWorld())
2143 return false;
2144
2145 if (!isUnderground(pos) && liquidLevel(Vec2I::floor(pos)).liquid == EmptyLiquidId) {
2146 auto assets = Root::singleton().assets();
2147 float weatherRayCheckDistance = assets->json("/weather.config:weatherRayCheckDistance").toFloat();
2148 float weatherRayCheckWindInfluence = assets->json("/weather.config:weatherRayCheckWindInfluence").toFloat();
2149
2150 auto offset = Vec2F(-m_weather.wind() * weatherRayCheckWindInfluence, weatherRayCheckDistance).normalized() * weatherRayCheckDistance;
2151
2152 return !lineCollision({pos, pos + offset});
2153 }
2154
2155 return false;
2156}
2157
2158bool WorldClient::isUnderground(Vec2F const& pos) const {
2159 if (!inWorld())

Callers

nothing calls this directly

Calls 7

liquidLevelFunction · 0.85
singletonClass · 0.85
assetsMethod · 0.80
toFloatMethod · 0.80
jsonMethod · 0.80
normalizedMethod · 0.80
windMethod · 0.80

Tested by

no test coverage detected