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 14:26:37 -07:00
committed by GitHub
co-authored by TiviPlus <TiviPlus> Couls
parent cb49d3301b
commit ca366c3ea1
355 changed files with 1549 additions and 1591 deletions
+12 -12
View File
@@ -130,21 +130,21 @@ GLOBAL_PROTECT(href_token)
/datum/admins/proc/check_for_rights(rights_required)
if(rights_required && !(rights_required & rank.rights))
return 0
return 1
return FALSE
return TRUE
/datum/admins/proc/check_if_greater_rights_than_holder(datum/admins/other)
if(!other)
return 1 //they have no rights
return TRUE //they have no rights
if(rank.rights == R_EVERYTHING)
return 1 //we have all the rights
return TRUE //we have all the rights
if(src == other)
return 1 //you always have more rights than yourself
return TRUE //you always have more rights than yourself
if(rank.rights != other.rank.rights)
if( (rank.rights & other.rank.rights) == other.rank.rights )
return 1 //we have all the rights they have and more
return 0
return TRUE //we have all the rights they have and more
return FALSE
/datum/admins/vv_edit_var(var_name, var_value)
return FALSE //nice try trialmin
@@ -166,26 +166,26 @@ you will have to do something like if(client.rights & R_ADMIN) yourself.
/proc/check_rights(rights_required, show_msg=1)
if(usr && usr.client)
if (check_rights_for(usr.client, rights_required))
return 1
return TRUE
else
if(show_msg)
to_chat(usr, "<font color='red'>Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")].</font>", confidential = TRUE)
return 0
return FALSE
//probably a bit iffy - will hopefully figure out a better solution
/proc/check_if_greater_rights_than(client/other)
if(usr && usr.client)
if(usr.client.holder)
if(!other || !other.holder)
return 1
return TRUE
return usr.client.holder.check_if_greater_rights_than_holder(other.holder)
return 0
return FALSE
//This proc checks whether subject has at least ONE of the rights specified in rights_required.
/proc/check_rights_for(client/subject, rights_required)
if(subject && subject.holder)
return subject.holder.check_for_rights(rights_required)
return 0
return FALSE
/proc/GenerateToken()
. = ""