Files
Viano-Core/tests/clientless/test_vertical_flight_escape.py
T
Nico 3aa780662e Complete AdventureBot navigation, instance travel and shutdown fixes
Finish capital waiting travel and adaptive flight entry up to 10,000 yards.
Preserve checked vertical climbs, recover blocked ground departures and find
validated dry landings. Retain group routes and Undercity arrival constraints.

Restore defense from native combat references, coordinate instance rendezvous
and browser reentry, finalize clientless sessions before map destruction and
transfer Halaa capture-point ownership safely.

Include the associated regression tests, investigation reports and reusable
diagnostic scripts. Keep generated runtime evidence and server binaries local
through scoped ignore rules. Validation/build/live evidence is recorded in the
session checkpoint and individual reports.
2026-11-05 10:35:34 +01:00

43 lines
2.4 KiB
Python

"""Run production Next: lateral blockage may require a checked vertical escape."""
from pathlib import Path
import subprocess,tempfile
root=Path(__file__).resolve().parents[2]
code=r'''
#include "ClientlessFlightPath.h"
#include <cassert>
using namespace ClientlessFlightPath;
int main(){
Settings cfg;Memory m;m.Departed=true;Point from{0,0,20},goal{200,0,0};
auto surface=[](float,float){return Surface{0,600,true};};
auto column=[](Point const&a,Point const&b){return Horizontal(a,b)<0.01f;};
assert(!Next(from,goal,cfg,m,surface,column).Valid);
auto escape=Next(from,goal,cfg,m,surface,column,false,true);
assert(escape.Valid&&escape.Avoiding&&escape.Next.X==0&&escape.Next.Y==0&&escape.Next.Z==40);
// A safe upward escape can start inside the nominal 8-yard clearance band.
auto lowStart=Next({0,0,5},goal,cfg,m,surface,column,false,true);
assert(lowStart.Valid&&lowStart.Next.Z==35);
// The complete body column is checked; a roof cannot be crossed.
auto roof=[](Point const&a,Point const&b){return Horizontal(a,b)<0.01f&&b.Z<38;};
assert(!Next(from,goal,cfg,m,surface,roof,false,true).Valid);
// Clamp to the allowed ceiling and stop when no room for ascent remains.
auto low=[](float,float){return Surface{0,34,true};};
escape=Next(from,goal,cfg,m,low,column,false,true);assert(escape.Valid&&escape.Next.Z==28);
assert(!Next({0,0,28},goal,cfg,m,low,column,false,true).Valid);
// Unknown surfaces and an overhead slab at the origin remain forbidden.
auto unknown=[](float,float){return Surface{};};
auto slab=[](float,float){return Surface{30,600,true};};
assert(!Next(from,goal,cfg,m,unknown,column,false,true).Valid);
assert(!Next(from,goal,cfg,m,slab,column,false,true).Valid);
// A clear ordinary flight retains its original route and smooth handoffs.
auto clear=[](Point const&,Point const&){return true;};
Memory first=m,second=m;
auto a=Next(from,goal,cfg,first,surface,clear),b=Next(from,goal,cfg,second,surface,clear,false,true);
assert(a.Valid&&b.Valid&&Distance(a.Next,b.Next)<0.001f&&Horizontal(from,b.Next)>1);
}
'''
with tempfile.TemporaryDirectory() as d:
p=Path(d);(p/'test.cpp').write_text(code)
subprocess.run(['c++','-std=c++17','-I'+str(root/'src/server/game/World'),str(p/'test.cpp'),'-o',str(p/'test')],check=True)
subprocess.run([str(p/'test')],check=True)
print('Vertical airborne escape: full volume, roof/ceiling/unknown support rejection, opt-in recovery and unchanged ordinary routes PASS')