From 666041900a2b07b244fd3d269af8dd587d32d832 Mon Sep 17 00:00:00 2001
From: Oblisk234 <61151679+Oblisk234@users.noreply.github.com>
Date: Mon, 30 Dec 2024 22:52:53 +0000
Subject: [PATCH] Fixes a few mentor bugs (#22825)
* Mentor fixes
* That may have been the actual ID and not their alias
* OOC tag fix
* Not another runtime
* Fixes discord mentor messages not being logged in database or mentor tickets
* Fixes bad indents
* This is why you need to be careful when copypasting
---
code/modules/admin/holder2.dm | 2 ++
yogstation/code/datums/world_topic.dm | 10 ++++++++++
yogstation/code/modules/mentor/mentor_verbs.dm | 3 +--
yogstation/code/modules/mentor/mentorpm.dm | 2 +-
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm
index b7acb10ee945..b5efb03c25bf 100644
--- a/code/modules/admin/holder2.dm
+++ b/code/modules/admin/holder2.dm
@@ -122,6 +122,8 @@ GLOBAL_PROTECT(href_token)
if (deadmined)
activate()
+ if(C.mentor_datum)
+ C.mentor_position = C.mentor_datum.position
owner = C
ip_cache = C.address
cid_cache = C.computer_id
diff --git a/yogstation/code/datums/world_topic.dm b/yogstation/code/datums/world_topic.dm
index 97e34eb09d5e..bae1a25fa85b 100644
--- a/yogstation/code/datums/world_topic.dm
+++ b/yogstation/code/datums/world_topic.dm
@@ -86,6 +86,16 @@ GLOBAL_VAR_INIT(mentornoot, FALSE)
SEND_SOUND(C, sound('sound/misc/nootnoot.ogg'))
else
SEND_SOUND(C, sound('sound/items/bikehorn.ogg'))
+ var/datum/DBQuery/add_mhelp_query = SSdbcore.NewQuery(
+ "INSERT INTO `[format_table_name("mentor_interactions")]` (round_id, ckey, ckey_mentor, target_ckey, target_mentor, message) VALUES (:round, :send, :smentor, :receive, :rmentor, :msg);",
+ list("round" = GLOB.round_id, "send" = from, "smentor" = TRUE, "receive" = C.ckey, "rmentor" = C.is_mentor(), "msg" = msg)
+ )
+ if(!add_mhelp_query.Execute())
+ message_admins("Failed insert mhelp into mhelp DB. Check the SQL error logs for more details.")
+ qdel(add_mhelp_query)
+ if(C.ckey in SSYogs.mentortickets)
+ var/datum/mentorticket/T = SSYogs.mentortickets[C.ckey]
+ T.log += "[from]: [msg]"
to_chat(C, "Mentor PM from-[discord_mentor_link(from, from_id)]: [msg]", confidential = TRUE)
var/show_char_recip = !C.is_mentor() && CONFIG_GET(flag/mentors_mobname_only)
for(var/client/X in GLOB.mentors | GLOB.permissions.admins)
diff --git a/yogstation/code/modules/mentor/mentor_verbs.dm b/yogstation/code/modules/mentor/mentor_verbs.dm
index 91aff1e4d67d..5f9885821964 100644
--- a/yogstation/code/modules/mentor/mentor_verbs.dm
+++ b/yogstation/code/modules/mentor/mentor_verbs.dm
@@ -64,9 +64,8 @@ GLOBAL_PROTECT(mentor_verbs)
if(C.is_afk())
msg += " (AFK)"
- else
- msg += span_info("Mentorhelps are also sent to Discord. If no mentors are available in game mentorhelp anyways and a mentor on Discord may see it and respond.")
msg += "\n"
+ msg += span_info("Mentorhelps are also sent to Discord. If no mentors are available in game mentorhelp anyways and a mentor on Discord may see it and respond.")
to_chat(src, msg, confidential=TRUE)
diff --git a/yogstation/code/modules/mentor/mentorpm.dm b/yogstation/code/modules/mentor/mentorpm.dm
index 826c6bb5f82c..9b5dc41f9349 100644
--- a/yogstation/code/modules/mentor/mentorpm.dm
+++ b/yogstation/code/modules/mentor/mentorpm.dm
@@ -90,7 +90,7 @@
var/datum/DBQuery/add_mhelp_query = SSdbcore.NewQuery(
"INSERT INTO `[format_table_name("mentor_interactions")]` (round_id, ckey, ckey_mentor, target_ckey, target_mentor, message) VALUES (:round, :send, :smentor, :receive, :rmentor, :msg);",
- list("round" = GLOB.round_id, "send" = ckey, "smentor" = is_mentor(), "receive" = C.ckey, "rmentor" = C.is_mentor(), "msg" = msg)
+ list("round" = GLOB.round_id, "send" = ckey, "smentor" = is_mentor(), "receive" = discord_id ? whom : C.ckey, "rmentor" = discord_id ? TRUE : C.is_mentor(), "msg" = msg)
)
if(!add_mhelp_query.Execute())
message_admins("Failed insert mhelp into mhelp DB. Check the SQL error logs for more details.")