from pathlib import Path p=Path('/tmp/erri-pair-service-0054/addons/core/Scripts/Game/ERR/10_AI/ERR_ConvoyService.c');s=p.read_text().replace('return order.Position == m_InterceptPosition &&','return !(order.Position != m_InterceptPosition) &&') s=s.replace(' ClearOrder(); m_InterceptRouteIndex = RouteIndex;\n m_InterceptWaypoint = detour; InterceptWaypoint = detour; InterceptActive = true;\n Group.AddWaypoint(detour);\n }\n bool DeliverIntercept',' m_InterceptRouteIndex = RouteIndex;\n m_InterceptWaypoint = detour; InterceptWaypoint = detour; InterceptActive = true;\n Group.AddWaypoint(detour);\n }\n bool DeliverIntercept',1) needle=' lead.InstallIntercept(firstWaypoint);' s=s.replace(needle,''' // Route removal is also a native boundary; both prepared handles remain // caller-owned until both exact claims have survived it. lead.ClearOrder(); if (InterceptPairEligible(task, first, second, now) && InterceptCurrent(task, first) && InterceptCurrent(task, second)) partner.ClearOrder(); if (!InterceptPairEligible(task, first, second, now) || !InterceptCurrent(task, first) || !InterceptCurrent(task, second) || task.Vehicles[first.VehicleIndex] != lead || task.Vehicles[second.VehicleIndex] != partner || !lead.CanInstallIntercept(m_Mode, first, now) || !partner.CanInstallIntercept(m_Mode, second, now)) { SCR_EntityHelper.DeleteEntityAndChildren(firstWaypoint); SCR_EntityHelper.DeleteEntityAndChildren(secondWaypoint); ReleaseIntercept(task, first, now); ReleaseIntercept(task, second, now); return false; } '''+needle,1);p.write_text(s)