From a10ac669477217c48d842d9f3df0c12cea625c23 Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:56:07 -0500 Subject: [PATCH] [MIRROR] Fixes runtime from examining mod PCs (#724) * Fixes runtime from examining mod PCs (#81200) ## About The Pull Request It's a classic ![image](https://github.com/tgstation/tgstation/assets/51863163/297cbecd-c32d-4c10-8c25-000d8a95310c) `EXAMINE_HINT(x)` resolves to `"" + x + ""` When placed in this line directly, you get: `["" + HAS_TRAIT_FROM(...) ? "..." : "..." + ""]` You see the issue, right? This resolves as you would expect: `("" + HAS_TRAIT_FROM(...)) ? ("...") : ("..." + "")` Which, of course, runtimes as it's adding a string to an integer (0). By pulling it out to its own var we can get around this: `["" + frame_or_pc + ""]` ## Changelog :cl: Melbert fix: Fixed examining modular PCs /:cl: * Fixes runtime from examining mod PCs --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- .../modular_computers/computers/machinery/modular_computer.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 63a1d005169..8fb32244e1d 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -70,7 +70,8 @@ /obj/machinery/modular_computer/examine(mob/user) . = cpu?.examine(user) || ..() . += span_info("You can toggle interaction between computer and its machinery frame with [EXAMINE_HINT("Right-Click")] while empty-handed.") - . += span_info("Currently interacting with [EXAMINE_HINT(HAS_TRAIT_FROM(src, TRAIT_MODPC_INTERACTING_WITH_FRAME, REF(user)) ? "frame" : "computer")].") + var/frame_or_pc = HAS_TRAIT_FROM(src, TRAIT_MODPC_INTERACTING_WITH_FRAME, REF(user)) ? "frame" : "computer" + . += span_info("Currently interacting with [EXAMINE_HINT(frame_or_pc)].") /obj/machinery/modular_computer/attack_ghost(mob/dead/observer/user) . = ..()