`cloak != null && cloak.Cloaked && !player.IsAlliedWith(world.RenderPlayer)` would be slightly better - the IsAlliedWith check is only necessary if the structure is actually cloaked.