"""Native workstation sightlines use the working surface and still reject blocked geometry.""" from pathlib import Path import subprocess,tempfile root=Path(__file__).resolve().parents[2] s=(root/'src/server/game/World/AdventureSocialActions.cpp').read_text() a=s.index(' bool TargetVisible(');b=s.index(' std::vector < Unit * > People',a) head='#include "AdventureProfessionPolicy.h"\n#include "AdventureEconomyPolicy.h"\n#include \nconstexpr int LINEOFSIGHT_ALL_CHECKS=1;\nnamespace VMAP {enum class ModelIgnoreFlags{Nothing};}\nstruct GameObject{};\nstruct WorldObject {bool object=false;float height=0;GameObject* ToGameObject(){return object?reinterpret_cast(this):nullptr;}float GetPositionX(){return 0;}float GetPositionY(){return 0;}float GetPositionZ(){return 95;}float GetCollisionHeight(){return height;}};\nstruct Map{float endpoint=0;bool visible=true;bool isInLineOfSight(int,float,float,float,float,float,float z,int,VMAP::ModelIgnoreFlags){endpoint=z;return visible;}}map;\nstruct Player:WorldObject{Map* GetMap(){return ↦}int GetPhaseShift(){return 0;}bool IsWithinLOSInMap(WorldObject*){return false;}};\n' main='int main(){Player p;WorldObject target;target.object=true;\nassert(TargetVisible(&p,&target,"work_blacksmithing")&&map.endpoint==96.5f);\nmap.visible=false;assert(!TargetVisible(&p,&target,"work_blacksmithing"));\nmap.visible=true;target.object=false;target.height=2;\nassert(TargetVisible(&p,&target,"profession_trainer")&&map.endpoint==97);\nassert(!TargetVisible(&p,&target,"inspect"));\n}' with tempfile.TemporaryDirectory(prefix='vcore-profession-los-') as folder: cpp=Path(folder)/'test.cpp';binary=Path(folder)/'test';cpp.write_text(head+s[a:b]+main) subprocess.run(['c++','-std=c++17','-I',str(root/'src/server/game/World'),str(cpp),'-o',str(binary)],check=True) subprocess.run([str(binary)],check=True) print('Native workstation working-surface sightline and blocked geometry rejection passed.')