From 8246d36de26835c7ffda7d6252124cbc6b179bbf Mon Sep 17 00:00:00 2001
From: AlbertNanotracen <155601848+AlbertNanotracen@users.noreply.github.com>
Date: Mon, 27 May 2024 01:24:52 -0300
Subject: [PATCH] Innitial commit (#1760)
---
code/__DEFINES/~monkestation/span.dm | 2 --
monkestation/code/modules/mentor/client.dm | 4 +--
.../code/modules/mentor/mentor_manager.dm | 33 +++++++++++++------
3 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/code/__DEFINES/~monkestation/span.dm b/code/__DEFINES/~monkestation/span.dm
index 4da802b4f72a..34bace2cd3d9 100644
--- a/code/__DEFINES/~monkestation/span.dm
+++ b/code/__DEFINES/~monkestation/span.dm
@@ -4,5 +4,3 @@
#define span_clockgray(str) ("" + str + "")
#define span_clockred(str) ("" + str + "")
#define span_ratvar(str) ("" + str + "")
-
-#define REQUEST_MENTORHELP "request_mentorhelp"
diff --git a/monkestation/code/modules/mentor/client.dm b/monkestation/code/modules/mentor/client.dm
index 08a1df36a2d3..f3fcbb4d2eab 100644
--- a/monkestation/code/modules/mentor/client.dm
+++ b/monkestation/code/modules/mentor/client.dm
@@ -41,9 +41,9 @@
if(ckey in cdatums)
mentor_datum.is_contributor = TRUE
-/// Admins are Mentors, too
+///Verifies if the client is considered a Mentor, AKA has a Mentor datum or is an Admin.
/client/proc/is_mentor()
- if(mentor_datum || check_rights_for(src, R_ADMIN,0))
+ if(mentor_datum || check_rights_for(src, R_ADMIN, 0))
return TRUE
/proc/dementor(client/owner)
diff --git a/monkestation/code/modules/mentor/mentor_manager.dm b/monkestation/code/modules/mentor/mentor_manager.dm
index 0ed982a9889e..9a01305f3b6e 100644
--- a/monkestation/code/modules/mentor/mentor_manager.dm
+++ b/monkestation/code/modules/mentor/mentor_manager.dm
@@ -1,8 +1,12 @@
+///Requests from Mentorhelps
+#define REQUEST_MENTORHELP "request_mentorhelp"
+
/// Verb for opening the requests manager panel
/client/proc/mentor_requests()
set name = "Mentor Manager"
set desc = "Open the mentor manager panel to view all requests during this round"
set category = "Mentor"
+
SSblackbox.record_feedback("tally", "mentor_verb", 1, "Mentor Manager") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
GLOB.mentor_requests.ui_interact(usr)
@@ -23,9 +27,15 @@ GLOBAL_DATUM_INIT(mentor_requests, /datum/request_manager/mentor, new)
/datum/request_manager/mentor/nuke_request(client/C, message)
return
-/datum/request_manager/mentor/proc/mentorhelp(client/C, message)
- var/msg = copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN)
- request_for_client(C, REQUEST_MENTORHELP, msg)
+/datum/request_manager/mentor/fax_request(client/requester, message, additional_info)
+ return
+
+/datum/request_manager/mentor/music_request(client/requester, message)
+ return
+
+/datum/request_manager/mentor/proc/mentorhelp(client/requester, message)
+ var/sanitizied_message = copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN)
+ request_for_client(requester, REQUEST_MENTORHELP, sanitizied_message)
/datum/request_manager/mentor/ui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
@@ -35,14 +45,14 @@ GLOBAL_DATUM_INIT(mentor_requests, /datum/request_manager/mentor, new)
/datum/request_manager/mentor/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
// Only admins should be sending actions
- if (!(usr.client in GLOB.mentors))
- to_chat(usr, "You do not have permission to do this.", confidential = TRUE)
- return
+ var/client/mentor_client = usr.client
+ if(!mentor_client || !mentor_client.is_mentor())
+ to_chat(mentor_client, "You are not allowed to be using this mentor-only proc. Please report it.", confidential = TRUE)
// Get the request this relates to
var/id = params["id"] != null ? num2text(params["id"]) : null
if (!id)
- to_chat(usr, "Failed to find a request ID in your action, please report this", confidential = TRUE)
+ to_chat(mentor_client, "Failed to find a request ID in your action, please report this.", confidential = TRUE)
CRASH("Received an action without a request ID, this shouldn't happen!")
var/datum/request/request = !id ? null : requests_by_id[id]
if(isnull(request))
@@ -51,17 +61,17 @@ GLOBAL_DATUM_INIT(mentor_requests, /datum/request_manager/mentor, new)
switch(action)
if ("reply")
var/mob/M = request.owner?.mob
- usr.client.cmd_mentor_pm(M)
+ mentor_client.cmd_mentor_pm(M)
return TRUE
if ("follow")
var/mob/M = request.owner?.mob
- usr.client.mentor_follow(M)
+ mentor_client.mentor_follow(M)
return TRUE
return ..()
/datum/request_manager/mentor/ui_data(mob/user)
. = list(
- "requests" = list()
+ "requests" = list(),
)
for (var/ckey in requests)
for (var/datum/request/request as anything in requests[ckey])
@@ -74,7 +84,10 @@ GLOBAL_DATUM_INIT(mentor_requests, /datum/request_manager/mentor, new)
"owner_ckey" = request.owner_ckey,
"owner_name" = request.owner_name,
"message" = request.message,
+ "additional_info" = request.additional_information,
"timestamp" = request.timestamp,
"timestamp_str" = gameTimestamp(wtime = request.timestamp)
)
.["requests"] += list(data)
+
+#undef REQUEST_MENTORHELP