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

Method planetOrbitDistance

source/game/StarSystemWorld.cpp:145–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145float SystemWorld::planetOrbitDistance(CelestialCoordinate const& coordinate) const {
146 RandomSource random(coordinateSeed(coordinate, "PlanetOrbitDistance"));
147
148 if (coordinate.isSystem() || coordinate.isNull())
149 return 0;
150
151 float distance = planetSize(coordinate.parent()) / 2.0;
152 for (int i = 0; i < coordinate.orbitNumber(); i++) {
153 if (i > 0 && i < coordinate.orbitNumber())
154 distance += clusterSize(coordinate.parent().child(i));
155
156 if (coordinate.isPlanetaryBody())
157 distance += random.randf(m_config.planetaryOrbitPadding[0], m_config.planetaryOrbitPadding[1]);
158 else if (coordinate.isSatelliteBody())
159 distance += random.randf(m_config.satelliteOrbitPadding[0], m_config.satelliteOrbitPadding[1]);
160 }
161
162 distance += clusterSize(coordinate) / 2.0;
163
164 return distance;
165}
166
167float SystemWorld::orbitInterval(float distance, bool isMoon) const {
168 float gravityConstant = isMoon ? m_config.planetGravitationalConstant : m_config.starGravitationalConstant;

Callers

nothing calls this directly

Calls 8

isSystemMethod · 0.80
orbitNumberMethod · 0.80
childMethod · 0.80
isPlanetaryBodyMethod · 0.80
randfMethod · 0.80
isSatelliteBodyMethod · 0.80
isNullMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected