Files
Viano-Core/tests/clientless/test_adventure_micro_reset.py
T
Nico 119d63ed1c
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s
Implement autonomous AdventureBot intents and social micro actions
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.
2026-10-26 22:45:38 +01:00

46 lines
2.4 KiB
Python

"""Production micro cleanup cancels the physical spline without interrupting transit."""
from pathlib import Path
import subprocess,tempfile
root=Path(__file__).resolve().parents[2]
s=(root/'src/server/game/World/AdventureBehaviorMgr.cpp').read_text()
a=s.index('void AdventureBehaviorMgr::ResetMicro(');b=s.index('bool AdventureBehaviorMgr::LocalMove(',a)
code=r'''
#include <cassert>
#include <cstdint>
#include <string>
using uint32=uint32_t;
constexpr int UNIT_NPC_EMOTESTATE=0,UNIT_STAND_STATE_STAND=0;
struct Guid{uint32 GetCounter(){return 26;}};
struct Player{
bool alive=true,transport=false,taxi=false,flying=false,teleport=false;
int stops=0,stands=0,emotes=0;
bool IsAlive(){return alive;}bool GetTransport(){return transport;}bool IsInFlight(){return taxi;}bool IsFlying(){return flying;}bool IsBeingTeleported(){return teleport;}
void SetStandState(int){++stands;}void SetUInt32Value(int,int){++emotes;}void StopMoving(){++stops;}
Guid GetGUID(){return {};}
};
bool busy=false;bool Busy(uint32){return busy;}
struct Travel{int cancels=0;void CancelTravel(uint32){++cancels;}} travel;auto sClientlessTravelMgr=&travel;
struct ObjectGuid{void Clear(){}};
struct SocialScene{};
struct AdventureSocialActions{static void Reset(Player*,SocialScene&){}};
class AdventureBehaviorMgr{public:
struct Record{SocialScene Social;std::string Micro="explore";int MicroTimer=100,GestureTimer=100;ObjectGuid WorkObject;int WorkEmote=0;bool WorkPending=false;};
void ResetMicro(Player*,Record&);
};
'''
code+=s[a:b]+r'''
int main(){
AdventureBehaviorMgr mgr;AdventureBehaviorMgr::Record r;Player p;
mgr.ResetMicro(&p,r);assert(p.stops==1&&travel.cancels==1&&r.Micro.empty());
r.Micro="drink";p.transport=true;mgr.ResetMicro(&p,r);assert(p.stops==1&&travel.cancels==1);
p.transport=false;p.flying=true;r.Micro="look";mgr.ResetMicro(&p,r);assert(p.stops==1);
p.flying=false;busy=true;r.Micro="look";mgr.ResetMicro(&p,r);assert(p.stops==1);
busy=false;p.alive=false;r.Micro="rest";int stands=p.stands;mgr.ResetMicro(&p,r);assert(p.stands==stands);
}
'''
with tempfile.TemporaryDirectory(prefix='vcore-micro-reset-') 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('Micro cleanup ends physical local movement, preserves transit and does not stand up dead players.')