Skip to content

Commit

Permalink
Generate atmospheres for gas giants in legacy custom systems
Browse files Browse the repository at this point in the history
- Gas giants previously depended on a fixed 14.0 atmospheric density
- Add an import step which generates a plausible atmospheric density if a gas giant defined in Lua doesn't have its atmosphere set.
  • Loading branch information
Web-eWorks committed Feb 17, 2024
1 parent dc0003c commit 54fdec0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/galaxy/CustomSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,9 @@ void CustomSystemsDatabase::RunLuaSystemSanityChecks(CustomSystem *csys)

bool wantRings = body->ringStatus == CustomSystemBody::WANT_RANDOM_RINGS || body->ringStatus == CustomSystemBody::WANT_RINGS;

if (!(body->want_rand_offset || body->want_rand_phase || body->want_rand_arg_periapsis || wantRings))
bool wantAtm = body->bodyData.m_type == SystemBodyType::TYPE_PLANET_GAS_GIANT && body->bodyData.m_volatileGas == fixed(0);

if (!(body->want_rand_offset || body->want_rand_phase || body->want_rand_arg_periapsis || wantRings || wantAtm))
continue;

// Generate body orbit parameters from its seed
Expand Down Expand Up @@ -1047,6 +1049,12 @@ void CustomSystemsDatabase::RunLuaSystemSanityChecks(CustomSystem *csys)
}
}

if (wantAtm) {
// Taken from StarSystemRandomGenerator::PickPlanetType
body->bodyData.m_volatileGas = rand.NormFixed(fixed(1050, 1000), fixed(8000, 1000)).Abs();
body->bodyData.m_atmosOxidizing = rand.NormFixed(fixed(0, 1), fixed(300, 1000)).Abs();
}

}
}

Expand Down

0 comments on commit 54fdec0

Please sign in to comment.