From 6af8ca393b8e4a9e937600e74443670c4f984dd2 Mon Sep 17 00:00:00 2001 From: Novacat <35587478+Novacat@users.noreply.github.com> Date: Wed, 10 Mar 2021 14:46:32 -0500 Subject: [PATCH] Merge pull request #9900 from VOREStation/upstream-merge-7958 [MIRROR] Fixes context-menu examine expanding incorrect target --- code/_helpers/view.dm | 4 ++++ code/modules/admin/admin_tools.dm | 7 +------ code/modules/admin/verbs/randomverbs.dm | 2 +- code/modules/examine/examine.dm | 18 ++++++++++++++++-- code/modules/mob/mob.dm | 19 ------------------- 5 files changed, 22 insertions(+), 28 deletions(-) diff --git a/code/_helpers/view.dm b/code/_helpers/view.dm index 13ee837caa..be60a56697 100644 --- a/code/_helpers/view.dm +++ b/code/_helpers/view.dm @@ -10,3 +10,7 @@ viewX = text2num(viewrangelist[1]) viewY = text2num(viewrangelist[2]) return list(viewX, viewY) + +// Used to get `atom/O as obj|mob|turf in view()` to match against strings containing apostrophes immediately after substrings that match to other objects. Somehow. - Ater +/proc/_validate_atom(atom/A) + return view() \ No newline at end of file diff --git a/code/modules/admin/admin_tools.dm b/code/modules/admin/admin_tools.dm index 42ab6aae9a..2d9ae2cdd4 100644 --- a/code/modules/admin/admin_tools.dm +++ b/code/modules/admin/admin_tools.dm @@ -76,9 +76,4 @@ onclose(usr, "admin_dialogue_log") - feedback_add_details("admin_verb","PDL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - - -// Used to get `atom/O as obj|mob|turf in view()` to match against strings containing apostrophes immediately after substrings that match to other objects. Somehow. - Ater -/proc/admin_atom_validate(atom/A) - return view() \ No newline at end of file + feedback_add_details("admin_verb","PDL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! \ No newline at end of file diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 6017d51289..403e1a3113 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -629,7 +629,7 @@ Traitors and the like can also be revived with the previous role mostly intact. message_admins("[key_name_admin(src)] has created a command report", 1) feedback_add_details("admin_verb","CCR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/client/proc/cmd_admin_delete(atom/O as obj|mob|turf in admin_atom_validate(O)) // I don't understand precisely how this fixes the string matching against a substring, but it does - Ater +/client/proc/cmd_admin_delete(atom/O as obj|mob|turf in _validate_atom(O)) // I don't understand precisely how this fixes the string matching against a substring, but it does - Ater set category = "Admin" set name = "Delete" diff --git a/code/modules/examine/examine.dm b/code/modules/examine/examine.dm index b3ff65753c..f428c20c83 100644 --- a/code/modules/examine/examine.dm +++ b/code/modules/examine/examine.dm @@ -76,10 +76,24 @@ stat(null,"[description_holders["antag"]]") //Red, malicious antag-related text //override examinate verb to update description holders when things are examined -/mob/examinate(atom/A as mob|obj|turf in view()) - if(..()) +//mob verbs are faster than object verbs. See http://www.byond.com/forum/?post=1326139&page=2#comment8198716 for why this isn't atom/verb/examine() +/mob/verb/examinate(atom/A as mob|obj|turf in _validate_atom(A)) + set name = "Examine" + set category = "IC" + + if((is_blind(src) || usr.stat) && !isobserver(src)) + to_chat(src, "Something is there but you can't see it.") return 1 + //Could be gone by the time they finally pick something + if(!A) + return 1 + + face_atom(A) + var/list/results = A.examine(src) + if(!results || !results.len) + results = list("You were unable to examine that. Tell a developer!") + to_chat(src, jointext(results, "
")) update_examine_panel(A) /mob/proc/update_examine_panel(var/atom/A) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index a451488ad5..11caab736b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -194,25 +194,6 @@ client.eye = loc return TRUE -//mob verbs are faster than object verbs. See http://www.byond.com/forum/?post=1326139&page=2#comment8198716 for why this isn't atom/verb/examine() -/mob/verb/examinate(atom/A as mob|obj|turf in view()) - set name = "Examine" - set category = "IC" - - if((is_blind(src) || usr.stat) && !isobserver(src)) - to_chat(src, "Something is there but you can't see it.") - return 1 - - //Could be gone by the time they finally pick something - if(!A) - return 1 - - face_atom(A) - var/list/results = A.examine(src) - if(!results || !results.len) - results = list("You were unable to examine that. Tell a developer!") - to_chat(src, jointext(results, "
")) - /mob/verb/pointed(atom/A as mob|obj|turf in view()) set name = "Point To" set category = "Object"