@ -41,7 +41,6 @@ typedef int32_t mat_index;
typedef std : : map < mat_index , int > gem_map ;
typedef std : : map < mat_index , int > gem_map ;
bool running = false ;
bool running = false ;
decltype ( world - > frame_counter ) last_frame_count = 0 ;
const char * tagline = " Creates a new Workshop Order setting, automatically cutting rough gems. " ;
const char * tagline = " Creates a new Workshop Order setting, automatically cutting rough gems. " ;
const char * usage = (
const char * usage = (
" enable autogems \n "
" enable autogems \n "
@ -218,8 +217,7 @@ void create_jobs() {
}
}
DFhackCExport command_result plugin_onupdate ( color_ostream & out ) {
DFhackCExport command_result plugin_onupdate ( color_ostream & out ) {
if ( running & & ( world - > frame_counter - last_frame_count > = DELTA_TICKS ) ) {
if ( running & & ! World : : ReadPauseState ( ) & & ( world - > frame_counter % DELTA_TICKS = = 0 ) ) {
last_frame_count = world - > frame_counter ;
create_jobs ( ) ;
create_jobs ( ) ;
}
}
@ -336,7 +334,6 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
// Determine whether auto gem cutting has been disabled for this fort.
// Determine whether auto gem cutting has been disabled for this fort.
auto config = World : : GetPersistentData ( CONFIG_KEY ) ;
auto config = World : : GetPersistentData ( CONFIG_KEY ) ;
running = config . isValid ( ) & & ! config . ival ( 0 ) ;
running = config . isValid ( ) & & ! config . ival ( 0 ) ;
last_frame_count = world - > frame_counter ;
read_config ( out ) ;
read_config ( out ) ;
}
}
} else if ( event = = DFHack : : SC_MAP_UNLOADED ) {
} else if ( event = = DFHack : : SC_MAP_UNLOADED ) {