@ -5,6 +5,7 @@
# include <modules/Gui.h>
# include <modules/Gui.h>
# include <modules/Screen.h>
# include <modules/Screen.h>
# include <modules/Maps.h>
# include <modules/Maps.h>
# include <modules/World.h>
# include <TileTypes.h>
# include <TileTypes.h>
# include <vector>
# include <vector>
# include <cstdio>
# include <cstdio>
@ -978,8 +979,8 @@ static void enable_hooks(bool enable)
DFhackCExport command_result plugin_onstatechange ( color_ostream & out , state_change_event event )
DFhackCExport command_result plugin_onstatechange ( color_ostream & out , state_change_event event )
{
{
switch ( event ) {
switch ( event ) {
case SC_ WORLD _LOADED:
case SC_ MAP _LOADED:
if ( find_engines( out ) )
if ( World: : isFortressMode ( ) & & find_engines( out ) )
{
{
out . print ( " Detected steam engine workshops - enabling plugin. \n " ) ;
out . print ( " Detected steam engine workshops - enabling plugin. \n " ) ;
enable_hooks ( true ) ;
enable_hooks ( true ) ;
@ -987,7 +988,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
else
else
enable_hooks ( false ) ;
enable_hooks ( false ) ;
break ;
break ;
case SC_ WORLD _UNLOADED:
case SC_ MAP _UNLOADED:
enable_hooks ( false ) ;
enable_hooks ( false ) ;
engines . clear ( ) ;
engines . clear ( ) ;
break ;
break ;