z_mirror/Tapeline
git clone https://git.raiguard.me/z_mirror/Tapeline
d9815be
trunk
1--- @diagnostic disable 2 3local settings =require ( "scripts.settings" ) 4local tape =require ( "scripts.tape" ) 5 6local versions ={ 7[ "3.0.0" ] =function () 8rendering . clear ( script . mod_name ) 9for _ , surface in pairs ( game . surfaces ) do 10for _ , box in pairs ( surface . find_entities_filtered ( { name ="tl-highlight-box" } )) do 11box . destroy () 12end 13end 14storage ={} 15settings . on_init () 16tape . on_init () 17end , 18[ "3.0.3" ] =function () 19--- @param tbl table<uint, Tape> 20local function migrate_tapes ( tbl ) 21for key , tape_data in pairs ( tbl ) do 22if tape_data . player . valid then 23tape_data . player_index =tape_data . player . index 24else 25tbl [ key ] =nil 26end 27end 28end 29migrate_tapes ( storage . drawing ) 30migrate_tapes ( storage . editing ) 31migrate_tapes ( storage . tapes ) 32end , 33[ "3.1.1" ] =function () 34for _ , player in pairs ( game . players ) do 35if tape . get_tool ( player ) 36and player . controller_type == defines . controllers . character 37and player . character_build_distance_bonus >= 1000000 38then 39player . character_build_distance_bonus =player . character_build_distance_bonus - 1000000 40end 41end 42end , 43} 44 45--- @type event_handler 46local migrations ={} 47 48--- @param e ConfigurationChangedData 49function migrations . on_configuration_changed ( e ) 50local old_version =e . mod_changes [ script . mod_name ] and e . mod_changes [ script . mod_name ]. old_version 51if not old_version then 52return 53end 54 55for version , migration in pairs ( versions ) do 56if helpers . compare_versions ( version , old_version ) > 0 then 57migration () 58end 59end 60end 61 62return migrations