Skip to content

Commit

Permalink
[MIRROR] Fixes runtime from examining mod PCs (#724) (#1787)
Browse files Browse the repository at this point in the history
* 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 `"<b>" + x + "</b>"`

When placed in this line directly, you get: 

`["<b>" + HAS_TRAIT_FROM(...) ? "..." : "..." + "</b>"]`

You see the issue, right?

This resolves as you would expect: 
`("<b>" + HAS_TRAIT_FROM(...)) ? ("...") : ("..." + "</b>")`

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: 

`["<b>" + frame_or_pc + "</b>"]`

## Changelog

:cl: Melbert
fix: Fixed examining modular PCs
/:cl:

* Fixes runtime from examining mod PCs

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
  • Loading branch information
3 people authored Feb 6, 2024
1 parent 4c10702 commit e0c7799
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand Down

0 comments on commit e0c7799

Please sign in to comment.