publish eve_rock_watcher.py

This commit is contained in:
brockdarnold 2026-06-15 04:13:01 +00:00
parent 322263e738
commit ca77f3e5e2

View file

@ -292,6 +292,7 @@ def main():
last_alert = {} last_alert = {}
last_status = 0.0 last_status = 0.0
region = mode = None region = mode = None
empty_streak = 0
while True: while True:
if not w.bot_mining(cp): # only during a mining session if not w.bot_mining(cp): # only during a mining session
tracker.h.clear() tracker.h.clear()
@ -308,10 +309,24 @@ def main():
try: try:
rows = read_rows(cp, region, mode) rows = read_rows(cp, region, mode)
if not rows: if not rows:
# nothing selected at the moment — KEEP the fixed region (positions are # The saved region may be stale (you compressed, reselected, or the window
# stable; don't burn CPU re-hunting on a 9000px screen), just retry. # moved), so a fixed box reads empty forever. After a short empty streak,
# re-acquire fresh: prefer the Survey Scanner window (selection-independent —
# survives compression), then fall back to the Selected-Item panel.
empty_streak += 1
if empty_streak % 6 == 0:
nm = None
r = detect_survey_region(cp)
if r:
region, mode, nm = r, "survey", "survey"
else:
r = detect_selected_region(cp)
if r:
region, mode, nm = r, "selected", "selected"
print(f"[rock] empty {empty_streak}x — re-detect: {nm or 'still nothing visible'}")
time.sleep(poll) time.sleep(poll)
continue continue
empty_streak = 0
now = time.time() now = time.time()
keyed = tracker.update(rows, now) keyed = tracker.update(rows, now)
hr = hold_rate() hr = hold_rate()