mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-10 08:54:15 +00:00
Bools and returns super-pr (#53221)
Replaces like 70-80% of 0 and such, as a side effect cleaned up a bunch of returns Edit: Most left out ones are in mecha which should be done in mecha refactor already Oh my look how clean it is Co-authored-by: TiviPlus <TiviPlus> Co-authored-by: Couls <coul422@gmail.com>
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
tgui_id = "NtosNetDownloader"
|
||||
|
||||
var/datum/computer_file/program/downloaded_file = null
|
||||
var/hacked_download = 0
|
||||
var/download_completion = 0 //GQ of downloaded data.
|
||||
var/hacked_download = FALSE
|
||||
var/download_completion = FALSE //GQ of downloaded data.
|
||||
var/download_netspeed = 0
|
||||
var/downloaderror = ""
|
||||
var/obj/item/modular_computer/my_computer = null
|
||||
@@ -36,33 +36,33 @@
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(filename)
|
||||
if(downloaded_file)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/datum/computer_file/program/PRG = SSnetworks.station_network.find_ntnet_file_by_name(filename)
|
||||
|
||||
if(!PRG || !istype(PRG))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
// Attempting to download antag only program, but without having emagged/syndicate computer. No.
|
||||
if(PRG.available_on_syndinet && !emagged)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
|
||||
|
||||
if(!computer || !hard_drive || !hard_drive.can_store_file(PRG))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
ui_header = "downloader_running.gif"
|
||||
|
||||
if(PRG in main_repo)
|
||||
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.")
|
||||
hacked_download = 0
|
||||
hacked_download = FALSE
|
||||
else if(PRG in antag_repo)
|
||||
generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.")
|
||||
hacked_download = 1
|
||||
hacked_download = TRUE
|
||||
else
|
||||
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from unspecified server.")
|
||||
hacked_download = 0
|
||||
hacked_download = FALSE
|
||||
|
||||
downloaded_file = PRG.clone()
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
return
|
||||
generate_network_log("Aborted download of file [hacked_download ? "**ENCRYPTED**" : "[downloaded_file.filename].[downloaded_file.filetype]"].")
|
||||
downloaded_file = null
|
||||
download_completion = 0
|
||||
download_completion = FALSE
|
||||
ui_header = "downloader_finished.gif"
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/proc/complete_file_download()
|
||||
@@ -83,7 +83,7 @@
|
||||
// The download failed
|
||||
downloaderror = "I/O ERROR - Unable to save file. Check whether you have enough free space on your hard drive and whether your hard drive is properly connected. If the issue persists contact your system administrator for assistance."
|
||||
downloaded_file = null
|
||||
download_completion = 0
|
||||
download_completion = FALSE
|
||||
ui_header = "downloader_finished.gif"
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/process_tick()
|
||||
@@ -105,20 +105,20 @@
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
return TRUE
|
||||
switch(action)
|
||||
if("PRG_downloadfile")
|
||||
if(!downloaded_file)
|
||||
begin_file_download(params["filename"])
|
||||
return 1
|
||||
return TRUE
|
||||
if("PRG_reseterror")
|
||||
if(downloaderror)
|
||||
download_completion = 0
|
||||
download_netspeed = 0
|
||||
download_completion = FALSE
|
||||
download_netspeed = FALSE
|
||||
downloaded_file = null
|
||||
downloaderror = ""
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/ui_data(mob/user)
|
||||
my_computer = computer
|
||||
@@ -186,7 +186,7 @@
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/kill_program(forced)
|
||||
abort_file_download()
|
||||
return ..(forced)
|
||||
return ..()
|
||||
|
||||
////////////////////////
|
||||
//Syndicate Downloader//
|
||||
@@ -199,7 +199,7 @@
|
||||
filedesc = "Software Download Tool"
|
||||
program_icon_state = "generic"
|
||||
extended_desc = "This program allows downloads of software from shared Syndicate repositories"
|
||||
requires_ntnet = 0
|
||||
requires_ntnet = FALSE
|
||||
ui_header = "downloader_finished.gif"
|
||||
tgui_id = "NtosNetDownloader"
|
||||
emagged = TRUE
|
||||
|
||||
Reference in New Issue
Block a user