detect all conditions that make the game pause

develop
Myk Taylor 2020-10-31 03:03:05 -07:00
parent 27e054c9a7
commit 2c65113bdb
1 changed files with 8 additions and 1 deletions

@ -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<df::viewscreen_dwarfmodest>(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();