Split checkpoint guards between VirtualHQ and local defence; record Workshop 0.0.151
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-11-10 13:33:00 +01:00
parent 4b737c825f
commit 9889bd6404
23 changed files with 1557 additions and 78 deletions
+15 -2
View File
@@ -2,7 +2,7 @@
from policy_harness import ROOT, body, run
import re
p=ROOT/'addons/core/Scripts/Game/ERR/10_AI/ERR_Roadblocks.c'
s='\n'.join(body(p,x) for x in ('protected void Layout(', 'protected void AddProp(', 'protected vector GuardPosition('))
s='\n'.join(body(p,x) for x in ('static int GuardCount(', 'protected void Layout(', 'protected void AddProp(', 'protected vector GuardPosition('))
s=s.replace('protected ', '').replace('out ', '').replace('array<ref ERR_RoadblockProp> covers', 'Array<Prop*>& covers')
s=s.replace('ResourceName ', 'string ').replace('vector ', 'Vec ').replace('ERR_Actors.Ground','Ground').replace('new ERR_RoadblockProp','new Prop')
shoulder = re.search(r'm_Shoulder = ([^;]+);', body(p, 'protected bool Candidate('))[1]
@@ -44,12 +44,25 @@ int main(){
if(p->Prefab=="barrier")barriers.push_back(along);
if(p->Prefab=="sign")assert(dot(p->Forward,l.m_Forward)*along>0); // both approaches face outward
// Guard starting volumes cannot intersect any prop in the planned post.
for(int side:{-1,1})for(int row=0;row<(large?4:2);row++){
for(int side:{-1,1})for(int row=0;row<2;row++){
Vec guard=l.GuardPosition(side,row);
Vec rel=guard-p->Position;
assert(std::abs(dot(rel,p->Right))>p->HalfWidth+.6 || std::abs(dot(rel,p->Forward))>p->HalfDepth+.6);
}
}
// Four distinct slots for both sizes: two on each shoulder. Large posts
// retain their wider approach footprint with guards at -9m and +9m.
assert(l.GuardCount(large)==4);
std::vector<Vec> guards;
for(int side:{-1,1})for(int row=0;row<2;row++){
Vec guard=l.GuardPosition(side,row);Vec rel=guard-l.m_Centre;
assert(std::abs(dot(rel,l.m_Right)-side*(l.m_Shoulder+1.5))<1e-6);
double expectedAlong=large?(row*18-9):side*(row*2-2.5);
assert(std::abs(dot(rel,l.m_Forward)-expectedAlong)<1e-6);
for(Vec other:guards)assert(dot(guard-other,guard-other)>1.);
guards.push_back(guard);
}
assert(guards.size()==4);
assert(counts["cover"]==(large?8:4)&&counts["barrier"]==(large?4:2)&&counts["sign"]==2&&counts.size()==3);
assert(barriers.size()==(large?4:2));
if(!large)assert(std::abs(barriers[0]-barriers[1])>11.9);