Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/__DEFINES/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,26 @@
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
if(2)
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(..())
Expand Down