Fix low-terrain startup and extraction placement; record Workshop 0.0.121
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -114,12 +114,22 @@ run(r'''
|
||||
#include <vector>
|
||||
#define null nullptr
|
||||
struct vector{float x=0,y=0,z=0;};vector operator+(vector a,vector b){return{a.x+b.x,a.y+b.y,a.z+b.z};}float DistanceXZ(vector a,vector b){return std::hypot(a.x-b.x,a.z-b.z);}
|
||||
namespace Kind{constexpr int PRISON=0;}
|
||||
namespace Kind{constexpr int PRISON=0,EXTRACTION=2;}
|
||||
struct SiteData{int Kind=0,ResponseCount=0;bool Guarded=false,crash=false;vector GuardOffset,ResponseOffset;};
|
||||
namespace StartSetup{bool measured=true;bool IsCrash(SiteData*s){return s->crash;}bool Geometry(vector&offset,vector¢er,float&half,float&height){offset={16,1,0};center={17,0,0};half=6;height=6;return measured;}}
|
||||
struct Road{};struct RoadManager{void GetClosestRoad(vector,Road*&,float&,bool){}};struct AIWorld{RoadManager roads;RoadManager*GetRoadNetworkManager(){return &roads;}};
|
||||
struct Call{vector p;float half,height;};
|
||||
struct Survey{std::string m_Rejection;bool Reject(std::string reason){m_Rejection=reason;return false;}AIWorld world;std::vector<vector>m_Airfields;std::vector<Call>calls;int refuse=0;vector Rotate(vector p,float h){assert(h==90);return{p.z,p.y,-p.x};}bool Clear(vector p,float,float half,float,float&floor,float height=4){calls.push_back({p,half,height});floor=42;return int(calls.size())!=refuse;}SITE};
|
||||
int main(){SiteData a;float floor=0;Survey airport;airport.m_Airfields.push_back({600,0,0});assert(!airport.Site(&a,{0,0,0},90,floor)&&airport.calls.empty());assert(airport.Site(&a,{0,0,0},90,floor,300)&&airport.calls.size()==1);Survey normal;assert(normal.Site(&a,{100,0,200},90,floor)&&normal.calls.size()==1&&normal.calls[0].half==10&&normal.calls[0].height==4);a.crash=true;Survey crash;assert(crash.Site(&a,{100,0,200},90,floor)&&crash.calls.size()==2);assert(crash.calls[1].p.x==100&&crash.calls[1].p.z==183&&crash.calls[1].half==6&&crash.calls[1].height==6);for(int refusal:{1,2}){Survey blocked;blocked.refuse=refusal;assert(!blocked.Site(&a,{100,0,200},90,floor));}StartSetup::measured=false;Survey unknown;assert(!unknown.Site(&a,{100,0,200},90,floor)&&unknown.calls.size()==1);}
|
||||
struct Road{};struct RoadManager{Road road;bool near=false;int queries=0;void GetClosestRoad(vector,Road*&r,float&distance,bool){queries++;r=near?&road:nullptr;distance=0;}};struct AIWorld{RoadManager roads;RoadManager*GetRoadNetworkManager(){return &roads;}};
|
||||
struct Call{vector p;float half,height,range;};
|
||||
struct Survey{std::string m_Rejection;bool Reject(std::string reason){m_Rejection=reason;return false;}AIWorld world;std::vector<vector>m_Airfields;std::vector<Call>calls;int refuse=0;float variation=0;vector Rotate(vector p,float h){assert(h==90);return{p.z,p.y,-p.x};}bool Clear(vector p,float,float half,float range,float&floor,float height=4){calls.push_back({p,half,height,range});floor=42;return int(calls.size())!=refuse&&variation<=range;}SITE};
|
||||
int main(){
|
||||
SiteData camp,pad;pad.Kind=Kind::EXTRACTION;float h;
|
||||
Survey roadside;roadside.world.roads.near=true;
|
||||
assert(!roadside.Site(&camp,{0,0,0},90,h)&&roadside.m_Rejection=="road proximity");
|
||||
assert(roadside.Site(&pad,{0,0,0},90,h)&&roadside.world.roads.queries==1);
|
||||
assert(roadside.calls.size()==1&&std::abs(roadside.calls[0].range-.8f)<.001);
|
||||
Survey gentle;gentle.variation=.7f;assert(!gentle.Site(&camp,{0,0,0},90,h)&&gentle.Site(&pad,{0,0,0},90,h));gentle.variation=.9f;assert(!gentle.Site(&pad,{0,0,0},90,h));
|
||||
Survey blockedPad;blockedPad.refuse=1;assert(!blockedPad.Site(&pad,{0,0,0},90,h));
|
||||
pad.Guarded=true;Survey blockedGuards;blockedGuards.refuse=2;assert(!blockedGuards.Site(&pad,{0,0,0},90,h));
|
||||
Survey guards;assert(guards.Site(&pad,{0,0,0},90,h)&&guards.calls.size()==2&&std::abs(guards.calls[1].range-.6f)<.001);
|
||||
SiteData a;float floor=0;Survey airport;airport.m_Airfields.push_back({600,0,0});assert(!airport.Site(&a,{0,0,0},90,floor)&&airport.calls.empty());assert(airport.Site(&a,{0,0,0},90,floor,300)&&airport.calls.size()==1);Survey normal;assert(normal.Site(&a,{100,0,200},90,floor)&&normal.calls.size()==1&&normal.calls[0].half==10&&normal.calls[0].height==4);a.crash=true;Survey crash;assert(crash.Site(&a,{100,0,200},90,floor)&&crash.calls.size()==2);assert(crash.calls[1].p.x==100&&crash.calls[1].p.z==183&&crash.calls[1].half==6&&crash.calls[1].height==6);for(int refusal:{1,2}){Survey blocked;blocked.refuse=refusal;assert(!blocked.Site(&a,{100,0,200},90,floor));}StartSetup::measured=false;Survey unknown;assert(!unknown.Site(&a,{100,0,200},90,floor)&&unknown.calls.size()==1);}
|
||||
'''.replace('SITE',site))
|
||||
print('PASS: actual GameMode readiness admission and common full-footprint survey require crash authorization and both surveyed areas')
|
||||
|
||||
Reference in New Issue
Block a user