From 2c65113bdb2f77b2644e34a50e3509c195514903 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 31 Oct 2020 03:03:05 -0700 Subject: [PATCH] detect all conditions that make the game pause --- plugins/buildingplan.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/buildingplan.cpp b/plugins/buildingplan.cpp index ad0bdf358..f5671fe0f 100644 --- a/plugins/buildingplan.cpp +++ b/plugins/buildingplan.cpp @@ -897,12 +897,19 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan return CR_OK; } +static bool is_paused() +{ + return World::ReadPauseState() || + ui->main.mode > df::ui_sidebar_mode::Squads || + !strict_virtual_cast(Gui::getCurViewscreen(true)); +} + static bool cycle_requested = false; #define DAY_TICKS 1200 DFhackCExport command_result plugin_onupdate(color_ostream &) { - if (Maps::IsValid() && !World::ReadPauseState() + if (Maps::IsValid() && !is_paused() && (cycle_requested || world->frame_counter % (DAY_TICKS/2) == 0)) { planner.doCycle();