OK, I tried to post this last night but sadly the nightly downtime had started and the site was still unavailable half an hour later so I went to bed. Anyhow, it worked out for the best, because I improved the fix...
First, the fix for the meltdown. There are 3 steps.
This is code to replace the existing doMeltdown function in the game utils Python. That would be FinalFrontierGameUtils.py in FFP version 1.7 or later (the post BUGification versions) or CvGameUtils.py in earlier versions (which would include the Star Trek mods). The new function completely replaces what the DLL does for a meltdown so the DLL's code is not run (including running the CvPlut::nukeExplosion - that doesn't happen anymore). It is, in essence, a copy of everything the DLL did, including checking the random chance for each building type that can have a meltdown, but focused on the specific planet that has the building that is having the meltdown. It does deal with the issue of a meltdown on the planet where the Capitol building is located. The code should be explained well enough that modifications should be easy to make, if any are desired.
At some point, I'm not sure exactly when, FFP added a flag to control whether or not the doMeltdown callback was active. Before that it was always active.
So, the instructions to fix the meltdown:
1) Check PythonCallbackDefines.xml for USE_DO_MELTDOWN_CALLBACK. If it exists then set it to 1 to enable it. If it does not exist then it is always enabled so you don't have to do anything in this file.
2) Replace the doMeltdown function with this code:
EDIT: bad code removed
3) Sadly, you now need to go through every building in CIV4BuildingInfos.xml and decide if the building should survive the meltdown. No building that is actually on the planet should do so. In particular, the Capitol should be set to not be immune (in FFP it was set to be immune) so that the "what do we do with the Capitol" code gets run. The only buildings that should definitely survive in regular FFP are: capital shipyard, squadron factory, squadron defense network (already set), and star fortress (and UB star citadel version). You could also set things that would be in orbit to be nuke immune, like the stardock and spaceport. The moonbase could also be set to be immune, but currently doing so would currently have no effect since the planet's disabled setting is being checked first in the planet population limit check and it directly sets it to 0, so the CvSolarSystem.py's CvPlanet.getPopulationLimit function would need to be modified to get that to work, which I didn't do. Of course, the easiest solution for this is to just set them all to 0, so nothing is immune, but it doesn't make much sense, logically speaking, for those "buildings" that are not actually on the planet.
That should fix it. I tested it by setting the nutrition facility to have a 50% chance of melting down each turn, so in the first few turns of a game every civ got its starting planet wiped out. This correctly destroyed all the buildings on the planet and moved the Capitol to a different planet in the system, disabled the planet (changing it to the star graphic and setting its max population to 0), and spread a few plots of radiation cloud around the system's plot. It was wonderfully, gruesomely, horrible.
-----
Second, the other related issue: nuclear weapons that have the same effect, but always targeted at the best planet.
There are three steps to fixing this.
1) Add an entry in GlobalDefinesAlt.xml with a DefineName of NUKE_BUILDING_DESTRUCTION_PROB and an iDefineIntVal of 0, like so:
Code:
<Define>
<DefineName>NUKE_BUILDING_DESTRUCTION_PROB</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
2) Change one line of code in FinalFrontierEvents.py (current version) or CvFinalFrontierEvents.py (previous versions).
In the onNukeExplosion function, about 14 lines in, the line that looked like this:
EDIT: code removed, the entire function has a replacement given a few posts after this.
3) Go through CIV4BuildingInfos.xml and adjust building's bNukeImmune setting as per step 3 of the meltdown fix. If you already did this for the meltdown fix, you don't need to do this step since it is identical.
And there you have it. With any luck, this will fix the thing completely so it won't have to be revisited later. That said, in the DLL the the CvPlot::nukeEffect code could have it's building removal check commented out (to be reinstated only if planets make it into the DLL at some point, at which time it can be fixed to work correctly).