canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE (#69790)

* canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE

The most idiotic thing I've seen is canUseTopic's defines, they literally just define TRUE, you can use it however you want, it doesn't matter, it just means TRUE. You can mix and match the args and it will set that arg to true, despite the name.

It's so idiotic I decided to remove it, so now I can reclaim a little bit of my sanity.
This commit is contained in:
John Willard
2022-10-01 12:47:52 -04:00
committed by GitHub
parent 94dece8e5a
commit 91f02f2a6b
156 changed files with 232 additions and 233 deletions
@@ -96,7 +96,7 @@
. = ..()
if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
if(!ishuman(user) || !user.canUseTopic(src, BE_CLOSE))
if(!ishuman(user) || !user.canUseTopic(src, be_close = TRUE))
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
if(has_buckled_mobs())
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
@@ -286,7 +286,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool, 0)
if(over_object == usr && Adjacent(usr))
if(!item_chair || has_buckled_mobs() || src.flags_1 & NODECONSTRUCT_1)
return
if(!usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
if(!usr.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE))
return
usr.visible_message(span_notice("[usr] grabs \the [src.name]."), span_notice("You grab \the [src.name]."))
var/obj/item/C = new item_chair(loc)
@@ -482,7 +482,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0)
/obj/structure/chair/bronze/AltClick(mob/user)
turns = 0
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user)))
return
if(!(datum_flags & DF_ISPROCESSING))
user.visible_message(span_notice("[user] spins [src] around, and the last vestiges of Ratvarian technology keeps it spinning FOREVER."), \
@@ -598,7 +598,7 @@
set category = "Object"
set name = "Toggle Open"
if(!usr.canUseTopic(src, BE_CLOSE) || !isturf(loc))
if(!usr.canUseTopic(src, be_close = TRUE) || !isturf(loc))
return
if(iscarbon(usr) || issilicon(usr) || isdrone(usr))
@@ -661,7 +661,7 @@
/obj/structure/closet/attack_hand_secondary(mob/user, modifiers)
. = ..()
if(!user.canUseTopic(src, BE_CLOSE) || !isturf(loc))
if(!user.canUseTopic(src, be_close = TRUE) || !isturf(loc))
return
if(!opened && secure)
@@ -49,7 +49,7 @@
var/t = tgui_input_text(user, "What would you like the label to be?", name, max_length = 53)
if(user.get_active_held_item() != interact_tool)
return
if(!user.canUseTopic(src, BE_CLOSE))
if(!user.canUseTopic(src, be_close = TRUE))
return
handle_tag("[t ? t : initial(name)]")
return
@@ -315,7 +315,7 @@
open()
/obj/structure/closet/body_bag/environmental/prisoner/attack_hand_secondary(mob/user, modifiers)
if(!user.canUseTopic(src, BE_CLOSE) || !isturf(loc))
if(!user.canUseTopic(src, be_close = TRUE) || !isturf(loc))
return
togglelock(user)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
+2 -2
View File
@@ -458,7 +458,7 @@
if(!payments_acc)
to_chat(usr, span_notice("[src] hasn't been registered yet."))
return TRUE
if(!usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
if(!potential_acc)
to_chat(usr, span_notice("No ID card detected."))
@@ -514,7 +514,7 @@
if(payments_acc != potential_acc.registered_account)
to_chat(usr, span_warning("[src] rejects your new price."))
return
if(!usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
to_chat(usr, span_warning("You need to get closer!"))
return
sale_price = new_price_input
+1 -1
View File
@@ -9,7 +9,7 @@
/obj/structure/sacrificealtar/AltClick(mob/living/user)
..()
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
if(!istype(user) || !user.canUseTopic(src, be_close = TRUE))
return
if(!has_buckled_mobs())
return
+1 -1
View File
@@ -110,7 +110,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 29)
return attack_hand(user, modifiers)
/obj/structure/extinguisher_cabinet/AltClick(mob/living/user)
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE))
return
toggle_cabinet(user)
+1 -1
View File
@@ -44,7 +44,7 @@
. = ..()
if(.)
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return
if(obj_flags & IN_USE)
to_chat(user, span_warning("It's already in use - wait a bit!"))
@@ -167,7 +167,7 @@
playsound(src, 'sound/machines/click.ogg', 10, TRUE)
/obj/item/plunger/AltClick(mob/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
if(!istype(user) || !user.canUseTopic(src, be_close = TRUE))
return
var/new_layer = tgui_input_list(user, "Select a layer", "Layer", GLOB.plumbing_layers)
+1 -1
View File
@@ -151,7 +151,7 @@ at the cost of risking a vicious bite.**/
switch(altar_result)
if("Change Color")
var/chosen_color = input(user, "", "Choose Color", pants_color) as color|null
if(!isnull(chosen_color) && user.canUseTopic(src, BE_CLOSE))
if(!isnull(chosen_color) && user.canUseTopic(src, be_close = TRUE))
pants_color = chosen_color
if("Create Artefact")
if(!COOLDOWN_FINISHED(src, use_cooldown) || status != ALTAR_INACTIVE)
+11 -11
View File
@@ -32,7 +32,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
var/new_style = tgui_input_list(user, "Select a facial hairstyle", "Grooming", GLOB.facial_hairstyles_list)
if(isnull(new_style))
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE //no tele-grooming
hairdresser.facial_hairstyle = new_style
else
@@ -42,7 +42,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
var/new_style = tgui_input_list(user, "Select a hairstyle", "Grooming", GLOB.hairstyles_list)
if(isnull(new_style))
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE //no tele-grooming
if(HAS_TRAIT(hairdresser, TRAIT_BALD))
to_chat(hairdresser, span_notice("If only growing back hair were that easy for you..."))
@@ -153,7 +153,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
if(isnull(choice))
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
switch(choice)
@@ -161,7 +161,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
var/newname = sanitize_name(tgui_input_text(amazed_human, "Who are we again?", "Name change", amazed_human.name, MAX_NAME_LEN), allow_numbers = TRUE) //It's magic so whatever.
if(!newname)
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
amazed_human.real_name = newname
amazed_human.name = newname
@@ -176,7 +176,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
return TRUE
if(!selectable_races[racechoice])
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
var/datum/species/newrace = selectable_races[racechoice]
@@ -190,7 +190,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
if(MUTCOLORS in amazed_human.dna.species.species_traits)
var/new_mutantcolor = input(user, "Choose your skin color:", "Race change", amazed_human.dna.features["mcolor"]) as color|null
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
if(new_mutantcolor)
var/temp_hsv = RGBtoHSV(new_mutantcolor)
@@ -211,7 +211,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
return TRUE
if(amazed_human.gender == "male")
if(tgui_alert(amazed_human, "Become a Witch?", "Confirmation", list("Yes", "No")) == "Yes")
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
amazed_human.gender = FEMALE
amazed_human.physique = FEMALE
@@ -221,7 +221,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
else
if(tgui_alert(amazed_human, "Become a Warlock?", "Confirmation", list("Yes", "No")) == "Yes")
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
amazed_human.gender = MALE
amazed_human.physique = MALE
@@ -234,13 +234,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
if("hair")
var/hairchoice = tgui_alert(amazed_human, "Hairstyle or hair color?", "Change Hair", list("Style", "Color"))
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
if(hairchoice == "Style") //So you just want to use a mirror then?
return ..()
else
var/new_hair_color = input(amazed_human, "Choose your hair color", "Hair Color",amazed_human.hair_color) as color|null
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
if(new_hair_color)
amazed_human.hair_color = sanitize_hexcolor(new_hair_color)
@@ -254,7 +254,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
if(BODY_ZONE_PRECISE_EYES)
var/new_eye_color = input(amazed_human, "Choose your eye color", "Eye Color", amazed_human.eye_color_left) as color|null
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return TRUE
if(new_eye_color)
amazed_human.eye_color_left = sanitize_hexcolor(new_eye_color)
+1 -1
View File
@@ -90,7 +90,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an
var/t = tgui_input_text(user, "What would you like the label to be?", text("[]", name), null)
if (user.get_active_held_item() != P)
return
if(!user.canUseTopic(src, BE_CLOSE))
if(!user.canUseTopic(src, be_close = TRUE))
return
if (t)
name = text("[]- '[]'", initial(name), t)
+2 -2
View File
@@ -162,13 +162,13 @@
to_chat(user, span_warning("The rotation is locked!"))
return FALSE
var/new_angle = tgui_input_number(user, "New angle for primary reflection face", "Reflector Angle", rotation_angle, 360)
if(isnull(new_angle) || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(isnull(new_angle) || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
return FALSE
set_angle(SIMPLIFY_DEGREES(new_angle))
return TRUE
/obj/structure/reflector/AltClick(mob/user)
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user)))
return
else if(finished)
rotate(user)
+1 -1
View File
@@ -131,7 +131,7 @@ FLOOR SAFES
if(!ishuman(usr))
return
var/mob/living/carbon/human/user = usr
if(!user.canUseTopic(src, BE_CLOSE))
if(!user.canUseTopic(src, be_close = TRUE))
return
var/canhear = FALSE
@@ -176,7 +176,7 @@
/obj/structure/training_machine/AltClick(mob/user)
. = ..()
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, NO_TK, FLOOR_OKAY))
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, floor_okay = TRUE))
return
if(has_buckled_mobs())
user_unbuckle_mob(buckled_mobs[1], user)