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

Method exposedToWeather

source/game/StarWorldServer.cpp:2248–2260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2246}
2247
2248bool WorldServer::exposedToWeather(Vec2F const& pos) const {
2249 if (!isUnderground(pos) && liquidLevel(Vec2I::floor(pos)).liquid == EmptyLiquidId) {
2250 auto assets = Root::singleton().assets();
2251 float weatherRayCheckDistance = assets->json("/weather.config:weatherRayCheckDistance").toFloat();
2252 float weatherRayCheckWindInfluence = assets->json("/weather.config:weatherRayCheckWindInfluence").toFloat();
2253
2254 auto offset = Vec2F(-m_weather.wind() * weatherRayCheckWindInfluence, weatherRayCheckDistance).normalized() * weatherRayCheckDistance;
2255
2256 return !lineCollision({pos, pos + offset});
2257 }
2258
2259 return false;
2260}
2261
2262bool WorldServer::isUnderground(Vec2F const& pos) const {
2263 return m_worldTemplate->undergroundLevel() >= pos[1];

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