diff --git a/src/bot.py b/src/bot.py index 12ccbf8..a025fa2 100644 --- a/src/bot.py +++ b/src/bot.py @@ -382,8 +382,16 @@ class Bot: def on_start_from_town(self): self._curr_loc = self._town_manager.wait_for_town_spawn() if not self._curr_loc: - Logger.warning("Could not detect town spawn — defaulting to A1_TOWN_START. Run will waypoint to correct act.") - self._curr_loc = Location.A1_TOWN_START + # Try a direct marker scan before any blind default — D2R respawns the + # char in the act it last save+exited from, which is A4/A5 for this + # route, so the old A1 default ran wrong-act pathing immediately. + detected = self._town_manager.detect_current_act(timeout=4) + if detected: + Logger.warning(f"Town spawn templates missed — act detection says {detected}") + self._curr_loc = detected + else: + Logger.warning("Could not detect town spawn — defaulting to A5_TOWN_START (route home act)") + self._curr_loc = Location.A5_TOWN_START self._spawn_act = TownManager.get_act_from_location(self._curr_loc) # Handle picking up corpse in case of death