#NEWLINE# def save_world( create = False ) : #NEWLINE# #INDENT# gfx . title ( 'Saving...' ) #NEWLINE# logging . debug ( 'Offloading world...' ) #NEWLINE# if create : #NEWLINE# #INDENT# maps . cache_all_clusters ( ) #NEWLINE# #UNINDENT# ( _config_directory , _worlds_directory ) = profiles . has_reactor3 ( ) #NEWLINE# _version_file = os . path . join ( _worlds_directory , WORLD_INFO [ 'id' ] , 'version.txt' ) #NEWLINE# with open ( _version_file , 'w' ) as version_file : #NEWLINE# #INDENT# version_file . write ( VERSION ) #NEWLINE# #UNINDENT# logging . debug ( 'Saving items...' ) #NEWLINE# items . save_all_items ( ) #NEWLINE# maps . save_map ( 'map' , base_dir = profiles . get_world_directory ( WORLD_INFO [ 'id' ] ) ) #NEWLINE# logging . debug ( 'Saving life...' ) #NEWLINE# _life = life . save_all_life ( ) #NEWLINE# with open ( os . path . join ( profiles . get_world_directory ( WORLD_INFO [ 'id' ] ) , 'life.dat' ) , 'w' ) as e : #NEWLINE# #INDENT# e . write ( _life ) #NEWLINE# #UNINDENT# with open ( os . path . join ( profiles . get_world_directory ( WORLD_INFO [ 'id' ] ) , 'items.dat' ) , 'w' ) as e : #NEWLINE# #INDENT# e . write ( json . dumps ( ITEMS ) ) #NEWLINE# #UNINDENT# items . reload_all_items ( ) #NEWLINE# logging . info ( 'World saved.' )