Editor: "Dirty" water heights are saved in modified CELLs
This is a relatively simple issue which also plagues TESCS and is generally resolved by mod cleaning. There's another issue related to this which I will elaborate upon separately.
So, normally, when a cell is saved all subrecords are included. This is true of both TESCS and OpenCS. This is also the origin of the "Black Fog Bug" wherein empty AMBI subrecords make it impossible to see in some areas after altering them.
A common resolution to this is to simply clean it with TES3CMD. There's a specific cleaning operation which does something similar to this:
--cell-params
clean cell subrecords AMBI,WHGT duped from masters
However this does not apply to blanked AMBI and WHGT subrecords because those are not identical to the master file. They will still stay in the plugin if cleaned by tes3cmd, and also, loaded by the engine. This results in some areas being flooded, or possibly experiencing a drought, when resaved in either construction set.
Note that this is where the other problem I mentioned comes into play as the fix I am going to propose does not fix visible loading issues in OpenCS. It does, however, fix the issue reported here.
Such cells load like this:
Aharunartus' WHGT is set at -300 by Morrowind.esm. However OpenCS loads it with a value of 0 for WHGT. This value is then resaved back into the plugin and makes this area flood. My proposed fix only resolves the saving issue and not the issue with loading, to be clear. Loading problems also affect cellRefs and it's a whole thing that is unrelated to this.
- Shut up and tell us how to fix it, S3
if (mData.mFlags & Interior)
{
// Try to avoid saving ambient information when it's unnecessary.
// This is to fix black lighting and flooded water
// in resaved cell records that lack this information.
if (mWaterInt && mWater != 0)
esm.writeHNT("WHGT", mWater);
if (mData.mFlags & QuasiEx)
esm.writeHNOCRefId("RGNN", mRegion);
else if (mHasAmbi)
esm.writeHNT("AMBI", mAmbi, 16);
}
This is a minor formatting change for mHasAmbi to just look a bit nicer, and also checks if the value for mWater is not zero, the default, prior to saving. Also, per discussions with the MWSE team, I have simply removed saving of INTV as it's what was used to store water levels prior to WHGT being added in expansions. No modern plugins will ship with INTV used for water height.
Also, I'd like to mention that I cannot identify how the WHGT subrecord was removed from this plugin to begin with. TESCS and OpenCS will both save WHGT subs with a value of zero. TES3CMD will not clean them during a typical clean. In other words, instances of plugins affected by this seem as if they are going to be few and far between.
- Why do I believe this is a valid change?
Well, this is what users are going to do. We ran into this exact issue on modding-openmw with our CI builds and simply removed the WHGT sub from the plugins. Everything was perfectly fine. The logs on fire
esp at the end of this post did exactly that, and worked perfectly well until someone on the team edited it in OpenCS, after which many caves were flooded. Also, when the other issue regarding overriding cells is fixed, we will need to refuse to write WHGT in two separate cases: Once, when WHGT is zero, as that is what the engine assumes to be the default anyway, and secondly, when the WHGT is identical to the master file. This is less significant a problem, but the redundancy can cause mod compatibility issues that don't need to exist if it is not done. Finally, this is already what is done for AMBI subrecords. It only makes sense to apply it here as it's a different but equally bad problem with an equally simple fix.
Finally, the affected plugin: Logs_on_Fire.esp And after resaving with master: Logs_on_Fire.omwaddon And after resaving with this patch: Logs_on_Fire.omwaddon
To reproduce this issue, simply resave the plugin in OpenCS and then use the console command coc Aharunartus
.