mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 09:05:11 +01: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:
@@ -222,11 +222,11 @@
|
||||
/obj/item/modular_computer/process()
|
||||
if(!enabled) // The computer is turned off
|
||||
last_power_usage = 0
|
||||
return 0
|
||||
return
|
||||
|
||||
if(obj_integrity <= integrity_failure * max_integrity)
|
||||
shutdown_computer()
|
||||
return 0
|
||||
return
|
||||
|
||||
if(active_program && active_program.requires_ntnet && !get_ntnet_status(active_program.requires_ntnet_feature))
|
||||
active_program.event_networkfailure(0) // Active program requires NTNet to run but we've just lost connection. Crash.
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
if(!enabled)
|
||||
if(ui)
|
||||
ui.close()
|
||||
return 0
|
||||
return
|
||||
if(!use_power())
|
||||
if(ui)
|
||||
ui.close()
|
||||
return 0
|
||||
return
|
||||
|
||||
// Robots don't really need to see the screen, their wireless connection works as long as computer is on.
|
||||
if(!screen_on && !issilicon(user))
|
||||
if(ui)
|
||||
ui.close()
|
||||
return 0
|
||||
return
|
||||
|
||||
// If we have an active program switch to it now.
|
||||
if(active_program)
|
||||
@@ -74,9 +74,9 @@
|
||||
data["programs"] = list()
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
|
||||
for(var/datum/computer_file/program/P in hard_drive.stored_files)
|
||||
var/running = 0
|
||||
var/running = FALSE
|
||||
if(P in idle_threads)
|
||||
running = 1
|
||||
running = TRUE
|
||||
|
||||
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc, "running" = running))
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// No running around with open laptops in hands.
|
||||
item_flags = SLOWS_WHILE_IN_HAND
|
||||
|
||||
screen_on = 0 // Starts closed
|
||||
screen_on = FALSE // Starts closed
|
||||
var/start_open = TRUE // unless this var is set to 1
|
||||
var/icon_state_closed = "laptop-closed"
|
||||
var/w_class_open = WEIGHT_CLASS_BULKY
|
||||
|
||||
@@ -43,13 +43,6 @@
|
||||
/obj/item/modular_computer/processor/relay_qdel()
|
||||
qdel(machinery_computer)
|
||||
|
||||
// This thing is not meant to be used on it's own, get topic data from our machinery owner.
|
||||
//obj/item/modular_computer/processor/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
|
||||
// if(!machinery_computer)
|
||||
// return 0
|
||||
|
||||
// return machinery_computer.canUseTopic(user, state)
|
||||
|
||||
/obj/item/modular_computer/processor/shutdown_computer()
|
||||
if(!machinery_computer)
|
||||
return
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
if(!(hardware_flag & usage_flags))
|
||||
if(loud && computer && user)
|
||||
to_chat(user, "<span class='danger'>\The [computer] flashes a \"Hardware Error - Incompatible software\" warning.</span>")
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/proc/get_signal(specific_action = 0)
|
||||
if(computer)
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
// Called by Process() on device that runs us, once every tick.
|
||||
/datum/computer_file/program/proc/process_tick()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
*Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
|
||||
@@ -147,8 +147,8 @@
|
||||
ID = card_holder.GetID()
|
||||
generate_network_log("Connection opened -- Program ID: [filename] User:[ID?"[ID.registered_name]":"None"]")
|
||||
program_state = PROGRAM_STATE_ACTIVE
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -31,43 +31,43 @@
|
||||
// Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
|
||||
/obj/item/computer_hardware/hard_drive/proc/store_file(datum/computer_file/F)
|
||||
if(!F || !istype(F))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(!can_store_file(F))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(!check_functionality())
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(!stored_files)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
// This file is already stored. Don't store it again.
|
||||
if(F in stored_files)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
F.holder = src
|
||||
stored_files.Add(F)
|
||||
recalculate_size()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
// Use this proc to remove file from the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
|
||||
/obj/item/computer_hardware/hard_drive/proc/remove_file(datum/computer_file/F)
|
||||
if(!F || !istype(F))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(!stored_files)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(!check_functionality())
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(F in stored_files)
|
||||
stored_files -= F
|
||||
recalculate_size()
|
||||
return 1
|
||||
return TRUE
|
||||
else
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
// Loops through all stored files and recalculates used_capacity of this drive
|
||||
/obj/item/computer_hardware/hard_drive/proc/recalculate_size()
|
||||
@@ -80,24 +80,24 @@
|
||||
// Checks whether file can be stored on the hard drive. We can only store unique files, so this checks whether we wouldn't get a duplicity by adding a file.
|
||||
/obj/item/computer_hardware/hard_drive/proc/can_store_file(datum/computer_file/F)
|
||||
if(!F || !istype(F))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(F in stored_files)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/name = F.filename + "." + F.filetype
|
||||
for(var/datum/computer_file/file in stored_files)
|
||||
if((file.filename + "." + file.filetype) == name)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
// In the unlikely event someone manages to create that many files.
|
||||
// BYOND is acting weird with numbers above 999 in loops (infinite loop prevention)
|
||||
if(stored_files.len >= 999)
|
||||
return 0
|
||||
return FALSE
|
||||
if((used_capacity + F.size) > max_capacity)
|
||||
return 0
|
||||
return FALSE
|
||||
else
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
// Tries to find the file by filename. Returns null on failure
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
power_usage = 10
|
||||
icon_state = "datadisk6"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
critical = 0
|
||||
critical = FALSE
|
||||
max_capacity = 16
|
||||
device_type = MC_SDD
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
/obj/item/computer_hardware/recharger/proc/use_power(amount, charging=0)
|
||||
if(charging)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/computer_hardware/recharger/process()
|
||||
..()
|
||||
@@ -34,17 +34,17 @@
|
||||
var/obj/machinery/M = holder.physical
|
||||
if(M.powered())
|
||||
M.use_power(amount)
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
else
|
||||
var/area/A = get_area(src)
|
||||
if(!istype(A))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(A.powered(AREA_USAGE_EQUIP))
|
||||
A.use_power(amount, AREA_USAGE_EQUIP)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/computer_hardware/recharger/wired
|
||||
name = "wired power connector"
|
||||
@@ -56,26 +56,25 @@
|
||||
if(ismachinery(M.physical) && M.physical.anchored)
|
||||
return ..()
|
||||
to_chat(user, "<span class='warning'>\The [src] is incompatible with portable computers!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
/obj/item/computer_hardware/recharger/wired/use_power(amount, charging=0)
|
||||
if(ismachinery(holder.physical) && holder.physical.anchored)
|
||||
var/obj/machinery/M = holder.physical
|
||||
var/turf/T = M.loc
|
||||
if(!T || !istype(T))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/obj/structure/cable/C = T.get_cable_node()
|
||||
if(!C || !C.powernet)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/power_in_net = C.powernet.avail-C.powernet.load
|
||||
|
||||
if(power_in_net && power_in_net > amount)
|
||||
C.powernet.load += amount
|
||||
return 1
|
||||
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user