[MIRROR] Refactor, improve, and rename canUseTopic to be can_perform_action [MDB IGNORE] (#19391)

* Refactor, improve, and rename canUseTopic to be can_perform_action

* updoot

* https://github.com/tgstation/tgstation/pull/72876

https://github.com/tgstation/tgstation/pull/72876

---------

Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-10 04:19:25 +00:00
committed by GitHub
co-authored by Tim Gandalf
parent 7305d12d29
commit f8f2abb11f
209 changed files with 455 additions and 354 deletions
+1 -1
View File
@@ -45,7 +45,7 @@
if(!inputvalue)
return
if(user.canUseTopic(src, be_close = TRUE))
if(user.can_perform_action(src))
name = "folder[(inputvalue ? " - '[inputvalue]'" : null)]"
/obj/item/folder/proc/remove_item(obj/item/Item, mob/user)
+1 -1
View File
@@ -141,7 +141,7 @@
. += span_notice("Alt-click [src] to fold it into a paper plane.")
/obj/item/paper/AltClick(mob/living/user, obj/item/I)
if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE))
if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS))
return
if(istype(src, /obj/item/paper/carbon))
var/obj/item/paper/carbon/Carbon = src
+5 -5
View File
@@ -142,7 +142,7 @@
to_chat(user, span_warning("You must be holding the pen to continue!"))
return
var/deg = tgui_input_number(user, "What angle would you like to rotate the pen head to? (0-360)", "Rotate Pen Head", max_value = 360)
if(isnull(deg) || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || loc != user)
if(isnull(deg) || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH) || loc != user)
return
degrees = deg
to_chat(user, span_notice("You rotate the top of the pen to [deg] degrees."))
@@ -169,12 +169,12 @@
//Changing name/description of items. Only works if they have the UNIQUE_RENAME object flag set
if(isobj(O) && (O.obj_flags & UNIQUE_RENAME))
var/penchoice = tgui_input_list(user, "What would you like to edit?", "Pen Setting", list("Rename", "Description", "Reset"))
if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE))
if(QDELETED(O) || !user.can_perform_action(O))
return
if(penchoice == "Rename")
var/input = tgui_input_text(user, "What do you want to name [O]?", "Object Name", "[O.name]", MAX_NAME_LEN)
var/oldname = O.name
if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE))
if(QDELETED(O) || !user.can_perform_action(O))
return
if(input == oldname || !input)
to_chat(user, span_notice("You changed [O] to... well... [O]."))
@@ -190,7 +190,7 @@
if(penchoice == "Description")
var/input = tgui_input_text(user, "Describe [O]", "Description", "[O.desc]", 140)
var/olddesc = O.desc
if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE))
if(QDELETED(O) || !user.can_perform_action(O))
return
if(input == olddesc || !input)
to_chat(user, span_notice("You decide against changing [O]'s description."))
@@ -200,7 +200,7 @@
O.renamedByPlayer = TRUE
if(penchoice == "Reset")
if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE))
if(QDELETED(O) || !user.can_perform_action(O))
return
qdel(O.GetComponent(/datum/component/rename))
+1 -1
View File
@@ -448,7 +448,7 @@
/obj/machinery/photocopier/MouseDrop_T(mob/target, mob/user)
check_ass() //Just to make sure that you can re-drag somebody onto it after they moved off.
if(!istype(target) || target.anchored || target.buckled || !Adjacent(target) || !user.canUseTopic(src, be_close = TRUE) || target == ass || copier_blocked())
if(!istype(target) || target.anchored || target.buckled || !Adjacent(target) || !user.can_perform_action(src) || target == ass || copier_blocked())
return
add_fingerprint(user)
if(target == user)