From cbccd660d785dfd2d1c5ac6cb63224d902eec1f7 Mon Sep 17 00:00:00 2001 From: ynot01 Date: Thu, 1 Sep 2022 07:43:08 -0400 Subject: [PATCH 1/4] Update ntdownloader.dm --- .../file_system/programs/ntdownloader.dm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/modules/modular_computers/file_system/programs/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/ntdownloader.dm index 3f3a0c2fc507..7044d20d0545 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,6 +118,16 @@ download_netspeed = NTNETSPEED_HIGHSIGNAL if(3) download_netspeed = NTNETSPEED_ETHERNET + + 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_completion *= max((-dist/50) + 3, 1) download_completion += download_netspeed /datum/computer_file/program/ntnetdownload/ui_act(action, params) From 8beeddfe2b14e228118575be10aba4adbc7a6cd8 Mon Sep 17 00:00:00 2001 From: ynot01 Date: Thu, 1 Sep 2022 07:43:37 -0400 Subject: [PATCH 2/4] typo --- .../modular_computers/file_system/programs/ntdownloader.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/modular_computers/file_system/programs/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/ntdownloader.dm index 7044d20d0545..ab7d5160d1d6 100644 --- a/code/modules/modular_computers/file_system/programs/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/ntdownloader.dm @@ -127,7 +127,7 @@ dist = cur_dist // At 0 tiles distance, 3x download speed. At 100 tiles distance, 1x download speed. - download_completion *= max((-dist/50) + 3, 1) + download_netspeed *= max((-dist/50) + 3, 1) download_completion += download_netspeed /datum/computer_file/program/ntnetdownload/ui_act(action, params) From fdab1c35f8ba1ad4727e8fc14a512cc43526320e Mon Sep 17 00:00:00 2001 From: ynot01 Date: Thu, 1 Sep 2022 07:45:00 -0400 Subject: [PATCH 3/4] clamp --- .../modular_computers/file_system/programs/ntdownloader.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/modular_computers/file_system/programs/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/ntdownloader.dm index ab7d5160d1d6..5670a41c5353 100644 --- a/code/modules/modular_computers/file_system/programs/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/ntdownloader.dm @@ -128,7 +128,8 @@ // At 0 tiles distance, 3x download speed. At 100 tiles distance, 1x download speed. download_netspeed *= max((-dist/50) + 3, 1) - download_completion += download_netspeed + + download_completion = min(downloaded_file.size, download_completion + download_netspeed) // Add the progress /datum/computer_file/program/ntnetdownload/ui_act(action, params) if(..()) From e06be91e504e66ec1c60ccc22639b72de0bed952 Mon Sep 17 00:00:00 2001 From: ynot01 Date: Thu, 1 Sep 2022 08:31:42 -0400 Subject: [PATCH 4/4] ethernet unaffected + buff --- code/__DEFINES/machines.dm | 2 +- .../file_system/programs/ntdownloader.dm | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) 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 5670a41c5353..387c776a8caf 100644 --- a/code/modules/modular_computers/file_system/programs/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/ntdownloader.dm @@ -119,15 +119,15 @@ if(3) download_netspeed = NTNETSPEED_ETHERNET - 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) + 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