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.
55 lines
2.6 KiB
Python
55 lines
2.6 KiB
Python
"""Compile production travel setup and native spline forwarding for per-trip walking."""
|
|
from pathlib import Path
|
|
import subprocess,tempfile
|
|
root=Path(__file__).resolve().parents[2]
|
|
s=(root/'src/server/game/World/ClientlessTravelMgr.cpp').read_text()
|
|
a=s.index('bool ClientlessTravelMgr::StartTravel(');b=s.index('void ClientlessTravelMgr::CancelTravel(',a)
|
|
start=s[a:b]
|
|
a=s.index(' player->GetMotionMaster()->MoveSmoothPath(');b=s.index(' Position const& segmentEnd',a)
|
|
launch=s[a:b]
|
|
code=r'''
|
|
#include <cassert>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
using uint32=uint32_t;
|
|
#define TC_LOG_INFO(...) ((void)0)
|
|
struct Position{float GetPositionX()const{return 0;}float GetPositionY()const{return 0;}float GetPositionZ()const{return 0;}};
|
|
struct Guid{uint32 GetCounter(){return 26;}};
|
|
struct Motion{bool walk=false;int calls=0;void MoveSmoothPath(uint32,Position const*,std::size_t,bool w){walk=w;++calls;}}motion;
|
|
struct Player{
|
|
bool IsInWorld(){return true;}Guid GetGUID(){return {};}uint32 GetMapId(){return 0;}Motion* GetMotionMaster(){return &motion;}
|
|
};
|
|
enum class ClientlessTravelState{Moving};
|
|
class ClientlessTravelMgr{
|
|
public:
|
|
struct TravelRecord{
|
|
struct{ClientlessTravelState State;uint32 MapId;Position Target;float RemainingDistance=0;}Status;
|
|
bool Walk=false,AllowGroundMount=false,PortalApproach=false;
|
|
std::vector<Position> ActiveSpline;
|
|
};
|
|
std::unordered_map<uint32,TravelRecord> _records;
|
|
bool StartTravel(Player*,Position const&,bool=false,bool=false,bool=false);
|
|
bool LaunchPath(Player* player,TravelRecord& record){
|
|
'''
|
|
code+=launch+r'''
|
|
return true;}
|
|
};
|
|
'''+start+r'''
|
|
int main(){
|
|
ClientlessTravelMgr mgr;Player p;Position goal;
|
|
mgr.StartTravel(&p,goal,false,false,true);
|
|
assert(motion.walk&&mgr._records[26].Walk&&!mgr._records[26].AllowGroundMount);
|
|
mgr.LaunchPath(&p,mgr._records[26]);assert(motion.walk); // repath preserves gait
|
|
mgr.StartTravel(&p,goal,true,false,true);assert(motion.walk&&!mgr._records[26].AllowGroundMount);
|
|
mgr.StartTravel(&p,goal,true);assert(!motion.walk&&!mgr._records[26].Walk&&mgr._records[26].AllowGroundMount);
|
|
mgr.StartTravel(&p,goal,false,true);assert(!motion.walk&&mgr._records[26].PortalApproach);
|
|
}
|
|
'''
|
|
with tempfile.TemporaryDirectory(prefix='vcore-walk-') 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('Production travel gait reaches native spline, survives repaths, prevents mounting and preserves legacy running defaults.')
|