From a25b8ec1be094c087d4b5750889ac03210b99387 Mon Sep 17 00:00:00 2001 From: Davidj361 Date: Mon, 9 Apr 2018 14:04:58 -0400 Subject: [PATCH 1/2] Detective Scanner Fixes (#36915) * Fixed notes for detective's printed report * Added alt-click functionality to clear logs for detective scanner * Added a right click option to detective scanner to display logs without printing them * Made the display function as an action button. * Review changes done * review changes * review changes and a bad player message fix --- code/modules/detectivework/scanner.dm | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/code/modules/detectivework/scanner.dm b/code/modules/detectivework/scanner.dm index aa80178030..e7589aa15f 100644 --- a/code/modules/detectivework/scanner.dm +++ b/code/modules/detectivework/scanner.dm @@ -16,6 +16,15 @@ var/list/log = list() var/range = 8 var/view_check = TRUE + actions_types = list(/datum/action/item_action/displayDetectiveScanResults) + +/datum/action/item_action/displayDetectiveScanResults + name = "Display Forensic Scanner Results" + +/datum/action/item_action/displayDetectiveScanResults/Trigger() + var/obj/item/device/detective_scanner/scanner = target + if(istype(scanner)) + scanner.displayDetectiveScanResults(usr) /obj/item/device/detective_scanner/attack_self(mob/user) if(log.len && !scanning) @@ -36,6 +45,7 @@ P.info += jointext(log, "
") P.info += "
Notes:
" P.info_links = P.info + P.updateinfolinks() if(ismob(loc)) var/mob/M = loc @@ -165,3 +175,28 @@ /proc/get_timestamp() return time2text(world.time + 432000, ":ss") + +/obj/item/device/detective_scanner/AltClick(mob/living/user) + // Best way for checking if a player can use while not incapacitated, etc + if(!user.canUseTopic(src, be_close=TRUE)) + return + if(!LAZYLEN(log)) + to_chat(user, "Cannot clear logs, the scanner has no logs.") + return + if(scanning) + to_chat(user, "Cannot clear logs, the scanner is in use.") + return + to_chat(user, "The scanner logs are cleared.") + log = list() + +/obj/item/device/detective_scanner/proc/displayDetectiveScanResults(mob/living/user) + // No need for can-use checks since the action button should do proper checks + if(!LAZYLEN(log)) + to_chat(user, "Cannot display logs, the scanner has no logs.") + return + if(scanning) + to_chat(user, "Cannot display logs, the scanner is in use.") + return + to_chat(user, "Scanner Report") + for(var/iterLog in log) + to_chat(user, iterLog) \ No newline at end of file