Fix convoy coordination, AI combat and spectator recovery

This commit is contained in:
2026-09-27 22:28:07 +02:00
parent 2551d171b3
commit c5629f7f4f
108 changed files with 4337 additions and 282 deletions
+4 -3
View File
@@ -69,7 +69,7 @@ for name in ('unit', 'utility'):
for name in ('Entity', 'Group', 'Waypoint', 'm_Perception'):
movement = movement.replace(name+'.', name+'->')
movement = movement.replace('GetPhysics().', 'GetPhysics()->').replace('unit->Repaths.ToString()', 'std::to_string(unit->Repaths)')
movement = movement.replace('string.Format', 'Format').replace('ERR_HQ.Event', 'Event')
movement = movement.replace('string.Format', 'Format').replace('ERR_HQ.Event', 'Event').replace('ERR_HunterCombat.Active', 'ERR_HunterCombat::Active')
movement = re.sub(r'\b(bool|float|Vec) (\w+);', r'\1 \2 {};', movement)
run(r'''
#include <cassert>
@@ -82,6 +82,7 @@ struct Utility {Perception* m_Perception;};
struct Physics {Vec GetVelocity(){return {};}};
struct Vehicle {Vec pos;Physics physics;Vec GetOrigin(){return pos;}Physics* GetPhysics(){return &physics;}};
struct Group {Utility utility;Utility* GetGroupUtilityComponent(){return &utility;}void AddWaypoint(void*){}};
namespace ERR_HunterCombat {bool fresh=false;bool Active(Group*){return fresh;}};
struct Waypoint {Vec pos;bool arrived=false;bool IsWithinCompletionRadius(Group*){return arrived;}Vec GetOrigin(){return pos;}void SetCompletionRadius(float){}};
struct MovingHunter {Vehicle* Entity;struct Group* Group;struct Waypoint* Waypoint;Vec Destination,ProgressPosition;float ProgressAt=1,NextMotionLog=0;int Repaths=0;std::string Source="test";void ClearOrder(){Waypoint=nullptr;}};
Waypoint spawned;Waypoint* Spawn(Vec pos){spawned.pos=pos;return &spawned;}
@@ -96,8 +97,8 @@ int main(){
ObserveMovement(&hunter,120001);ObserveMovement(&hunter,180001);assert(hunter.Repaths==3);
ObserveMovement(&hunter,240001);assert(hunter.Repaths==3);
vehicle.pos={20,0};ObserveMovement(&hunter,241001);assert(hunter.Repaths==0);
perception.m_aTargets.empty=false;ObserveMovement(&hunter,400000);assert(hunter.Repaths==0);
perception.m_aTargets.empty=true;ObserveMovement(&hunter,400001);assert(hunter.Repaths==0);
perception.m_aTargets.empty=false;ERR_HunterCombat::fresh=true;ObserveMovement(&hunter,400000);assert(hunter.Repaths==0);
ERR_HunterCombat::fresh=false;ObserveMovement(&hunter,400001);assert(hunter.Repaths==0);
ObserveMovement(&hunter,460000);assert(hunter.Repaths==1);
}
''')