They're not
You quite literally drew a yellow line between their respective eye points that is unobstructed by bricks.
Anyway, you can use
::getWorldBox() to get the coordinates of the world box, then you can send a ray to each corner to see if you can see any corners of their world box, then send a check to eye point and/or their
Player::getHackPosition() to make it even more accurate.
function Player::canSeeObject(%this, %obj) {
if(!isObject(%obj) || !isFunction(%obj.getClassName(), getWorldBox))
return false;
%worldBox = %obj.getWorldBox();
%minBox = getWords(%worldBox,0,2);
%maxBox = getWords(%worldBox,3);
%box[0] = "return %minBox;";
%box[1] = "return getWords(%minBox,0,1) SPC getWord(%maxBox,2);";
%box[2] = "return getWord(%minBox,0) SPC getWord(%maxBox,1) SPC getWord(%minBox,2);";
%box[3] = "return getWord(%maxBox,0) SPC getWords(%minBox,1);";
%box[4] = "return %maxBox;";
%box[5] = "return getWords(%maxBox,0,1) SPC getWord(%minBox,2);";
%box[6] = "return getWord(%maxBox,0) SPC getWord(%minBox,1) SPC getWord(%maxBox,2);";
%box[7] = "return getWord(%minBox,0) SPC getWords(%maxBox,1);";
%box[8] = "return %obj.getType() & $TypeMasks::PlayerObjectType ? %obj.getHackPosition() : %obj.getWorldBoxCenter();";
for(%i = 0; %i < 9; %i++)
if(!isObject(containerRayCast(%this.getEyePoint(), eval(%box[%i]), %player)))
return true;
return false;
}