Add profile-driven daily schedules, semantic location import and editable catalogs, flexible intent execution and safe graph handovers. Implement coherent social scenes, native chair use and campfires, frontal conversation approaches and walking. Fix clientless near-teleport observer identity and native flight area queries. Include migrations, regression tests and implementation documentation.
33 lines
1.8 KiB
Python
33 lines
1.8 KiB
Python
"""Production phased area lookup must use TerrainInfo's map/zone/area order."""
|
|
from pathlib import Path
|
|
import subprocess,tempfile
|
|
root=Path(__file__).resolve().parents[2]
|
|
s=(root/'src/server/game/World/ClientlessFlightMgr.cpp').read_text()
|
|
a=s.index('std::pair < uint32, uint32 > ClientlessFlightMgr::AreaZone(')
|
|
b=s.index('bool ClientlessFlightMgr::Enabled(',a)
|
|
code=r'''
|
|
#include <cassert>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <memory>
|
|
using uint32=uint32_t;
|
|
struct Position{float GetPositionX()const{return 1;}float GetPositionY()const{return 2;}float GetPositionZ()const{return 3;}};
|
|
struct Player{int GetPhaseShift()const{return 17;}};
|
|
struct TerrainInfo{int calls=0;void GetZoneAndAreaId(int phase,uint32 map,uint32& zone,uint32& area,Position const&){assert(phase==17&&map==530);++calls;zone=3430;area=3460;}};
|
|
struct TerrainMgr{std::shared_ptr<TerrainInfo> value=std::make_shared<TerrainInfo>();auto LoadTerrain(uint32 map){assert(map==530);return value;}} sTerrainMgr;
|
|
class ClientlessFlightMgr{public:
|
|
mutable std::unordered_map<std::string,std::pair<uint32,uint32>> _planningAreas;
|
|
mutable std::unordered_map<uint32,std::shared_ptr<TerrainInfo>> _planningTerrain;
|
|
std::pair<uint32,uint32> AreaZone(Player const*,uint32,Position const&)const;
|
|
};
|
|
'''
|
|
code+=s[a:b]+r'''
|
|
int main(){ClientlessFlightMgr mgr;Player p;Position pos;auto r=mgr.AreaZone(&p,530,pos);assert(r.first==3460&&r.second==3430);assert(mgr.AreaZone(&p,530,pos)==r);assert(sTerrainMgr.value->calls==1);}
|
|
'''
|
|
with tempfile.TemporaryDirectory(prefix='vcore-area-query-') as folder:
|
|
cpp=Path(folder)/'test.cpp';binary=Path(folder)/'test';cpp.write_text(code)
|
|
subprocess.run(['c++','-std=c++17',str(cpp),'-o',str(binary)],check=True)
|
|
subprocess.run([str(binary)],check=True)
|
|
print('Native terrain query map/phase, area/zone ordering and cache passed.')
|