diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index 21560524ae4e..d9fdd3d79a75 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -58,7 +58,7 @@ //NTNet transfer speeds, used when downloading/uploading a file/program. #define NTNETSPEED_LOWSIGNAL 0.5 // GQ/s transfer speed when the device is wirelessly connected and on Low signal #define NTNETSPEED_HIGHSIGNAL 1 // GQ/s transfer speed when the device is wirelessly connected and on High signal -#define NTNETSPEED_ETHERNET 2 // GQ/s transfer speed when the device is using wired connection +#define NTNETSPEED_ETHERNET 3 // GQ/s transfer speed when the device is using wired connection //Caps for NTNet logging. Less than 10 would make logging useless anyway, more than 500 may make the log browser too laggy. Defaults to 100 unless user changes it. #define MAX_NTNET_LOGS 300 diff --git a/code/modules/modular_computers/file_system/programs/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/ntdownloader.dm index 3f3a0c2fc507..387c776a8caf 100644 --- a/code/modules/modular_computers/file_system/programs/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/ntdownloader.dm @@ -110,7 +110,7 @@ complete_file_download() // Download speed according to connectivity state. NTNet server is assumed to be on unlimited speed so we're limited by our local connectivity download_netspeed = 0 - // Speed defines are found in misc.dm + // Speed defines are found in code/__DEFINES/machines.dm switch(ntnet_status) if(1) download_netspeed = NTNETSPEED_LOWSIGNAL @@ -118,7 +118,18 @@ download_netspeed = NTNETSPEED_HIGHSIGNAL if(3) download_netspeed = NTNETSPEED_ETHERNET - download_completion += download_netspeed + + if(ntnet_status != 3) // Ethernet unaffected by distance + var/dist = 100 + // Loop through every ntnet relay, find the closest one and use that + for(var/obj/machinery/ntnet_relay/n in SSnetworks.station_network.relays) + var/cur_dist = get_dist_euclidian(n, computer) + if(n.is_operational() && cur_dist <= dist) + dist = cur_dist + // At 0 tiles distance, 3x download speed. At 100 tiles distance, 1x download speed. + download_netspeed *= max((-dist/50) + 3, 1) + + download_completion = min(downloaded_file.size, download_completion + download_netspeed) // Add the progress /datum/computer_file/program/ntnetdownload/ui_act(action, params) if(..())