Fixes cloaked units invisible to spectators

Not sure when #2918 was introduced. The code was hard to understand for me, so I rewrote it during the bug fix. Also don't know where `InvisibleToEnemy:` trait is used.