Anything that isn't Allied to your Units may uncloak it, regardless of SightDistance or LOS- i.e., your building may be completely blind, but it can still uncloak stuff at the mincloakdistance

Needless to say, this produces some irritating results with World Builder stuff, which is all completely blind, yet decloaks cloaked Units around them, and makes it rather hard to have cloaking that's over a large area, as opposed to almost-impossible-to-find cloaking.
Just removing Neutral stuff from the checking loop would probably be sufficient to remedy this. However it'd make Neutral stuff that's supposed to be dangerous completely unable to uncloak things. I don't see any other cheap way to do this, though.
The relevant section is in Unit.cpp, here:
Code: Select all
else if (wantCloak || (scriptCloak >= 1)) {
if ((decloakDistance > 0.0f) &&
helper->GetClosestEnemyUnitNoLosTest(midPos, decloakDistance,
allyteam, unitDef->decloakSpherical)) {
curCloakTimeout = gs->frameNum + cloakTimeout;
isCloaked = false;
}