z_mirror/BlueprintTools
git clone https://git.raiguard.me/z_mirror/BlueprintTools
00b37f1
trunk
1local constants =require ( "constants" ) 2 3local buttons_gui =require ( "scripts.gui.buttons" ) 4local import_string_gui =require ( "scripts.gui.import-string" ) 5local library_shortcuts_gui =require ( "scripts.gui.library-shortcuts" ) 6 7local player_data ={} 8 9function player_data . init ( player_index ) 10--- @class PlayerTable 11storage . players [ player_index ] ={ 12flags ={ 13blueprint_buttons_shown =false , 14deconstruction_planner_buttons_shown =false , 15holding_temporary_item =false , 16setting_temporary_item =false , 17upgrade_planner_buttons_shown =false , 18} , 19guis ={} , 20set_tiles_settings ={ 21fill_gaps =true , 22margin =0 , 23tile ="landfill" , 24} , 25settings ={} , 26} 27end 28 29function player_data . update_settings ( player , player_table ) 30local mod_settings =player . mod_settings 31local settings ={} 32 33for internal , prototype in pairs ( constants . settings ) do 34settings [ internal ] =mod_settings [ prototype ]. value 35end 36 37player_table . settings =settings 38end 39 40function player_data . refresh ( player , player_table ) 41player_data . update_settings ( player , player_table ) 42 43buttons_gui . refresh ( player , player_table ) 44import_string_gui . destroy ( player ) 45library_shortcuts_gui . refresh ( player , player_table ) 46 47-- If the tile does not exist 48if not prototypes . tile [ player_table . set_tiles_settings . tile ] then 49-- Set it to `nil` 50player_table . set_tiles_settings . tile =nil 51end 52end 53 54return player_data