Merge pull request #2103 from CHOMPStationBot/upstream-merge-10515

[MIRROR] Runechat tweak/feature
This commit is contained in:
Nadyr
2021-05-31 22:26:15 -04:00
committed by GitHub

View File

@@ -167,7 +167,7 @@ var/list/runechat_image_cache = list()
approx_lines = max(1, mheight / CHAT_MESSAGE_APPROX_LHEIGHT)
// Translate any existing messages upwards, apply exponential decay factors to timers
message_loc = target
message_loc = target.runechat_holder(src)
RegisterSignal(message_loc, COMSIG_PARENT_QDELETING, .proc/qdel_self)
if(owned_by.seen_messages)
var/idx = 1
@@ -190,10 +190,10 @@ var/list/runechat_image_cache = list()
message.plane = PLANE_RUNECHAT
message.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA | KEEP_APART
message.alpha = 0
message.pixel_y = (owner.bound_height * 0.95)*owner.size_multiplier
message.maptext_width = msgwidth
message.maptext_height = mheight
message.maptext_x = (msgwidth - owner.bound_width) * -0.5
message.maptext_x = message_loc.runechat_x_offset(msgwidth, mheight)
message.maptext_y = message_loc.runechat_y_offset(msgwidth, mheight)
message.maptext = complete_text
if(owner.contains(target)) // Special case, holding an atom speaking (pAI, recorder...)
@@ -334,3 +334,33 @@ var/list/runechat_image_cache = list()
if(!M.client)
continue
M.create_chat_message(src, message, italics, classes, audible)
// Allows you to specify your desired offset for messages from yourself
/atom/proc/runechat_x_offset(width, height)
return (width - world.icon_size) * -0.5
/atom/proc/runechat_y_offset(width, height)
return world.icon_size * 0.95
/atom/movable/runechat_x_offset(width, height)
return (width - bound_width) * -0.5
/atom/movable/runechat_y_offset(width, height)
return bound_height * 0.95
/* Nothing special
/mob/runechat_x_offset(width, height)
return (width - bound_width) * -0.5
*/
/mob/runechat_y_offset(width, height)
return ..()*size_multiplier
// Allows you to specify a different attachment point for messages from yourself
/atom/proc/runechat_holder(datum/chatmessage/CM)
return src
/mob/runechat_holder(datum/chatmessage/CM)
if(istype(loc, /obj/item/weapon/holder))
return loc
return ..()