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:
TiviPlus
2020-08-28 23:26:37 +02:00
committed by GitHub
parent cb49d3301b
commit ca366c3ea1
355 changed files with 1549 additions and 1591 deletions
@@ -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