Fix atlas resource handling and suppression AI serialization
This commit is contained in:
@@ -68,6 +68,7 @@ for name in ('unit', 'utility'):
|
||||
movement = movement.replace(name+'.', name+'->')
|
||||
for name in ('Entity', 'Group', 'Waypoint', 'm_Perception'):
|
||||
movement = movement.replace(name+'.', name+'->')
|
||||
movement = movement.replace('Physics physics =', 'Physics* physics =').replace('physics.GetVelocity()', 'physics->GetVelocity()')
|
||||
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').replace('ERR_HunterCombat.Active', 'ERR_HunterCombat::Active')
|
||||
movement = re.sub(r'\b(bool|float|Vec) (\w+);', r'\1 \2 {};', movement)
|
||||
@@ -85,6 +86,8 @@ struct Group {Utility utility;Utility* GetGroupUtilityComponent(){return &utilit
|
||||
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;}};
|
||||
// Actual abandonment/exit behavior is covered by test_hunter_stuck.py.
|
||||
int abandonments=0;void AbandonStuckVehicle(MovingHunter*){abandonments++;}
|
||||
Waypoint spawned;Waypoint* Spawn(Vec pos){spawned.pos=pos;return &spawned;}
|
||||
template<class... Args> std::string Format(Args...){return "log";}
|
||||
void Event(std::string,std::string){}
|
||||
@@ -95,7 +98,9 @@ int main(){
|
||||
ObserveMovement(&hunter,60000);assert(hunter.Waypoint==&delivered&&hunter.Repaths==0);
|
||||
ObserveMovement(&hunter,60001);assert(hunter.Repaths==1&&hunter.Waypoint->pos.x==100&&hunter.Waypoint->pos.z==200);assert(hunter.Destination.x==900);
|
||||
ObserveMovement(&hunter,120001);ObserveMovement(&hunter,180001);assert(hunter.Repaths==3);
|
||||
ObserveMovement(&hunter,240001);assert(hunter.Repaths==3);
|
||||
ObserveMovement(&hunter,240001);assert(hunter.Repaths==3&&abandonments==1);
|
||||
// A separate still-owned patrol makes progress and resumes after contact.
|
||||
hunter={&vehicle,&group,&delivered,{900,900}};
|
||||
vehicle.pos={20,0};ObserveMovement(&hunter,241001);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);
|
||||
|
||||
Reference in New Issue
Block a user