Skip to content

Commit

Permalink
health analyzer: add flying chat output (only visible to scanner)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xkeeper0 committed Mar 18, 2021
1 parent c6e9ec3 commit a53537e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
10 changes: 7 additions & 3 deletions code/modules/speech/floating_chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@
return measured * (1 + round(length(src.maptext_width) / 128))
src.measured_height = text2num(splittext(measured, "x")[2])

proc/make_chat_maptext(atom/target, msg, style = "", alpha = 255)
proc/make_chat_maptext(atom/target, msg, style = "", alpha = 255, force = 0)
var/image/chat_maptext/text = unpool(/image/chat_maptext)
animate(text, maptext_y = 28, time = 0.01) // this shouldn't be necessary but it keeps breaking without it
msg = copytext(msg, 1, 128) // 4 lines, seems fine to me
text.maptext = "<span class='pixel c ol' style=\"[style]\">[msg]</span>"
if (!force)
msg = copytext(msg, 1, 128) // 4 lines, seems fine to me
text.maptext = "<span class='pixel c ol' style=\"[style]\">[msg]</span>"
else
// force whatever it is to be shown. for not chat tings. honk.
text.maptext = msg
if(istype(target, /atom/movable))
var/atom/movable/L = target
text.loc = L.chat_text
Expand Down
22 changes: 22 additions & 0 deletions code/obj/item/device/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,28 @@ that cannot be itched
user.visible_message("<span class='alert'><b>[user]</b> has analyzed [M]'s vitals.</span>",\
"<span class='alert'>You have analyzed [M]'s vitals.</span>")
boutput(user, scan_health(M, src.reagent_scan, src.disease_detection, src.organ_scan, visible = 1))

// lord forgive me for this sin
// output a pop-up overhead thing to the client,
// if they want flying text
if (user.client && !user.client.preferences?.flying_chat_hidden)

var/image/chat_maptext/chat_text = null
var/h_pct = M.max_health ? round(100 * M.health / M.max_health) : M.health
var/oxy = round(M.get_oxygen_deprivation())
var/tox = round(M.get_toxin_damage())
var/burn = round(M.get_burn_damage())
var/brute = round(M.get_brute_damage())

var/popup_text = "<span class='ol c pixel'><span class='vga'>[h_pct]%</span>\n<span style='color: #40b0ff;'>[oxy]</span> - <span style='color: #33ff33;'>[tox]</span> - <span style='color: #ffee00;'>[burn]</span> - <span style='color: #ff6666;'>[brute]</span></span>"
chat_text = make_chat_maptext(M, popup_text, force = 1)
if(chat_text)
chat_text.measure(user.client)
for(var/image/chat_maptext/I in user.chat_text.lines)
if(I != chat_text)
I.bump_up(chat_text.measured_height)
chat_text.show_to(user.client)

update_medical_record(M)

if (M.stat > 1)
Expand Down
5 changes: 5 additions & 0 deletions strings/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
(u)kyle
(+)epinephrine has a similar effect to salicylic acid where it negates some of the movement speed penalty from damage.
(+)Werewolf thrash tries to keep you in the same place as where you start. Werewolf feast will rip out some of the targets non-vital organs for an extra snack!
(u)Zamujasa
(*)Health analyzers will show a flying-chat-esque health readout when used, with the overall health percentage and oxy-tox-burn-brute numbers.
(*)The readout in the chat panel is unaffected.
(*)This also follows the "flying chat" toggle, if you want to turn it off.
(*)Feedback is appreciated. I may add this to the stationary floor scanners in Medbay as well...
(t)tue mar 16 21
(u)The Laundry (warc)
(+)Ugh, that hat fuckin' REEKS dude, don't make me murder it off of you!
Expand Down

0 comments on commit a53537e

Please sign in to comment.