From 3ae82f48ed8dedf3fc0faf358488bd12fcaacff4 Mon Sep 17 00:00:00 2001 From: Peter Vaiko Date: Thu, 10 Oct 2024 15:55:52 -0400 Subject: [PATCH] fix: recovery turn Also has a little workaround to make saving fields work --- scripts/ai/turns/AITurn.lua | 3 +++ scripts/field/FieldScanner.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ai/turns/AITurn.lua b/scripts/ai/turns/AITurn.lua index db34c5b2c..c0ef15de8 100644 --- a/scripts/ai/turns/AITurn.lua +++ b/scripts/ai/turns/AITurn.lua @@ -108,6 +108,9 @@ end function AITurn:onBlocked() -- unregister here before the AITurn object is destructed self.proximityController:unregisterBlockingObjectListener() + -- restore onWaypoint* listeners before giving back control to the drive strategy, otherwise they'll be lost + -- when the recovery turn is instantiated and registers its own listeners + self.ppc:restorePreviouslyRegisteredListeners() self.driveStrategy:startRecoveryTurn(1 * self.turningRadius) end diff --git a/scripts/field/FieldScanner.lua b/scripts/field/FieldScanner.lua index 2260adea5..706afcc5f 100644 --- a/scripts/field/FieldScanner.lua +++ b/scripts/field/FieldScanner.lua @@ -177,7 +177,7 @@ function FieldScanner:findContour(x, z) else if not done and not lost then self:debug('%d. try, edge not found, we may have hit an island or corner, reset/rotate the probe a bit and retry', i) - setRotation(probe, 0, i * math.pi / 7, 0) + setRotation(probe, 0, i * math.pi / 6, 0) elseif lost then self:info('Could not trace field edge, limit search to field %d and retry', fieldId) limitToFieldId = fieldId