Merge pull request #10515 from VOREStation/Arokha/another

Runechat tweak/feature
This commit is contained in:
Aronai Sieyes
2021-05-31 15:36:10 -04:00
committed by Chompstation Bot
parent f959b644e9
commit 715a37a0f2

View File

@@ -165,7 +165,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
@@ -188,10 +188,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...)
@@ -332,3 +332,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 ..()