From faf5bacaada461f2d64180e6fe851e86f4ac5b58 Mon Sep 17 00:00:00 2001 From: Geeves Date: Tue, 18 Jun 2024 06:37:58 +0200 Subject: [PATCH] Floating Chat Pixel Fix (#19473) * Fixed the floating chat offset when you speak from inside a mech. --- code/game/atoms_movable.dm | 2 +- code/modules/heavy_vehicle/mech_interaction.dm | 3 +++ code/modules/mob/floating_messages.dm | 7 ++----- html/changelogs/geeves-floating_chat_pixel_fix.yml | 6 ++++++ 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 html/changelogs/geeves-floating_chat_pixel_fix.yml diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 43d2afa60b9..560597d594c 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -729,7 +729,7 @@ return 0 /atom/movable/proc/get_floating_chat_y_offset() - return 0 + return 8 /atom/movable/proc/can_attach_sticker(var/mob/user, var/obj/item/sticker/S) return TRUE diff --git a/code/modules/heavy_vehicle/mech_interaction.dm b/code/modules/heavy_vehicle/mech_interaction.dm index a11316007b5..255e6daadd4 100644 --- a/code/modules/heavy_vehicle/mech_interaction.dm +++ b/code/modules/heavy_vehicle/mech_interaction.dm @@ -582,6 +582,9 @@ /mob/living/heavy_vehicle/get_floating_chat_x_offset() return -offset_x // reverse the offset +/mob/living/heavy_vehicle/get_floating_chat_y_offset() + return 20 + /mob/living/heavy_vehicle/hear_say(var/message, var/verb = "says", var/datum/language/language = null, var/alt_name = "", var/italics = 0, var/mob/speaker = null, var/sound/speech_sound, var/sound_vol) if(can_listen()) addtimer(CALLBACK(src, PROC_REF(handle_hear_say), speaker, message), 0.5 SECONDS) diff --git a/code/modules/mob/floating_messages.dm b/code/modules/mob/floating_messages.dm index 46d869d7998..c0a6b7c33f6 100644 --- a/code/modules/mob/floating_messages.dm +++ b/code/modules/mob/floating_messages.dm @@ -103,17 +103,14 @@ var/list/floating_chat_colors = list() I.plane = HUD_PLANE I.layer = UNDER_HUD_LAYER - I.pixel_x = (-round(I.maptext_width/2) + 16) + attached_holder.get_floating_chat_x_offset() I.appearance_flags = RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM I.alpha = 0 I.maptext_width = CHAT_MESSAGE_WIDTH - I.maptext_x = (CHAT_MESSAGE_WIDTH - src.bound_width) * -0.5 - - I.pixel_y = src.get_floating_chat_y_offset() - I.pixel_x = src.get_floating_chat_x_offset() + I.pixel_y = attached_holder.get_floating_chat_y_offset() + I.pixel_x = (-round(I.maptext_width/2) + 16) + attached_holder.get_floating_chat_x_offset() //Select the various parameters for the maptext, to ensure pixel-perfect scaling var/font_family diff --git a/html/changelogs/geeves-floating_chat_pixel_fix.yml b/html/changelogs/geeves-floating_chat_pixel_fix.yml new file mode 100644 index 00000000000..90c961937d8 --- /dev/null +++ b/html/changelogs/geeves-floating_chat_pixel_fix.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - bugfix: "Fixed the floating chat offset when you speak from inside a mech." \ No newline at end of file