Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions SQL/database_changelog.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255.

The latest database version is 5.4; The query to update the schema revision table is:
The latest database version is 5.5; The query to update the schema revision table is:

INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 4);
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 5);
or
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 4);
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 5);

In any query remember to add a prefix to the table names if you use one.

----------------------------------------------------

version 5.5 14 August 2021, by JamieD1

Adds column in mentor for position

ALTER TABLE `mentor` ADD COLUMN `position` VARSET(32) UNSIGNED NOT NULL AFTER `ckey`;

----------------------------------------------------

version 5.4 18 May 2020, by TheGamer01

Adds table for antag tokens
Expand Down
1 change: 1 addition & 0 deletions SQL/tgstation_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ DROP TABLE IF EXISTS `mentor`;
CREATE TABLE IF NOT EXISTS `mentor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ckey` varchar(32) NOT NULL,
`position` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=130 DEFAULT CHARSET=utf8;

Expand Down
1 change: 1 addition & 0 deletions SQL/tgstation_schema_prefixed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ DROP TABLE IF EXISTS `SS13_mentor`;
CREATE TABLE IF NOT EXISTS `SS13_mentor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ckey` varchar(32) NOT NULL,
`position` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=130 DEFAULT CHARSET=utf8;

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* make sure you add an update to the schema_version stable in the db changelog
*/
#define DB_MINOR_VERSION 4
#define DB_MINOR_VERSION 5


//! ## Timing subsystem
Expand Down
5 changes: 4 additions & 1 deletion code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,10 @@
check_teams()
// yogs start - mentors
else if(href_list["makementor"])
makeMentor(href_list["makementor"])
makeMentor(href_list["makementor"], "Mentor")

else if(href_list["wikimentor"])
makeMentor(href_list["wikimentor"], "Wiki Staff")

else if(href_list["removementor"])
removeMentor(href_list["removementor"])
Expand Down
1 change: 1 addition & 0 deletions code/modules/client/client_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,4 @@

var/list/active_music = list()
var/datum/music/playing_music = null
var/mentor_position = null
7 changes: 5 additions & 2 deletions code/modules/client/verbs/ooc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ GLOBAL_VAR_INIT(mentor_ooc_colour, YOGS_MENTOR_OOC_COLOUR) // yogs - mentor ooc
oocmsg_toadmins = oocmsg
else
if(is_mentor()) // If the speaker is a mentor
oocmsg = "<span class='ooc'>\[Mentor]"
oocmsg += "<font color='[prefs.ooccolor]'>"
var mposition = "Mentor"
mposition = src.mentor_datum?.position
oocmsg = "<span class='ooc'>\["
oocmsg += "[mposition]"
oocmsg += "]<font color='[prefs.ooccolor]'>"
else
oocmsg = "<span class='ooc'>[(is_donator(src) && !CONFIG_GET(flag/everyone_is_donator)) ? "(Donator)" : ""]"
oocmsg += "<font color='[bussedcolor]'>"
Expand Down
2 changes: 1 addition & 1 deletion tools/LinuxOneShot/SetupProgram/PreCompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ echo "Compiling tgui..."
cd "$1"
chmod +x tools/bootstrap/node # Workaround for https://github.com/tgstation/tgstation-server/issues/1167
chmod +x tgui/bin/tgui
env TG_BOOTSTRAP_CACHE="$original_dir" TG_BOOTSTRAP_NODE_LINUX=1 TG_BUILD_TGS_MODE=1 tools/bootstrap/node tools/build/build.js
env TG_BOOTSTRAP_CACHE="$original_dir" TG_BOOTSTRAP_NODE_LINUX=1 TG_BUILD_TGS_MODE=1 tools/bootstrap/node tools/build/build.js
1 change: 1 addition & 0 deletions yogstation/SQL/mentor.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ CREATE TABLE `mentor_memo` (
CREATE TABLE `mentor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ckey` varchar(32) NOT NULL,
`position` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
3 changes: 2 additions & 1 deletion yogstation/code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var/body = "<br>"
if(M.client)
body += "<A href='?_src_=holder;[HrefToken()];makementor=[M.ckey]'>Make mentor</A> | "
body += "<A href='?_src_=holder;[HrefToken()];wikimentor=[M.ckey]'>Make Wiki mentor</A> | "
body += "<A href='?_src_=holder;[HrefToken()];removementor=[M.ckey]'>Remove mentor</A>"
return body

Expand All @@ -23,4 +24,4 @@
toggle_dlooc()
log_admin("[key_name(usr)] toggled Dead LOOC.")
message_admins("[key_name_admin(usr)] toggled Dead LOOC.")
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Dead LOOC", "[GLOB.dlooc_allowed ? "Enabled" : "Disabled"]"))
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Dead LOOC", "[GLOB.dlooc_allowed ? "Enabled" : "Disabled"]"))
10 changes: 5 additions & 5 deletions yogstation/code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
usr << browse(edit_log,"window=mentormemoeditlist")
qdel(query_memoedits)

/datum/admins/proc/makeMentor(ckey)
/datum/admins/proc/makeMentor(ckey, position)
if(!usr.client)
return

Expand All @@ -34,7 +34,7 @@
to_chat(usr, "<span class='danger'>The client chosen is an admin! Cannot mentorize.</span>", confidential=TRUE)
return

new /datum/mentors(ckey)
new /datum/mentors(ckey, position)

if(SSdbcore.Connect())
var/datum/DBQuery/query_get_mentor = SSdbcore.NewQuery("SELECT id FROM `[format_table_name("mentor")]` WHERE `ckey` = :ckey", list("ckey" = ckey))
Expand All @@ -45,7 +45,7 @@
return
qdel(query_get_mentor)

var/datum/DBQuery/query_add_mentor = SSdbcore.NewQuery("INSERT INTO `[format_table_name("mentor")]` (`id`, `ckey`) VALUES (null, :ckey)", list("ckey" = ckey))
var/datum/DBQuery/query_add_mentor = SSdbcore.NewQuery("INSERT INTO `[format_table_name("mentor")]` (`id`, `ckey`, `position`) VALUES (null, :ckey, :position)", list("ckey" = ckey, "position" = position))
if(!query_add_mentor.warn_execute())
qdel(query_add_mentor)
return
Expand All @@ -65,8 +65,8 @@
else
to_chat(usr, "<span class='danger'>Failed to establish database connection. The changes will last only for the current round.</span>", confidential=TRUE)

message_admins("[key_name_admin(usr)] added new mentor: [ckey]")
log_admin("[key_name(usr)] added new mentor: [ckey]")
message_admins("[key_name_admin(usr)] added new [position]: [ckey]")
log_admin("[key_name(usr)] added new [position]: [ckey]")

/datum/admins/proc/removeMentor(ckey)
if(!usr.client)
Expand Down
11 changes: 7 additions & 4 deletions yogstation/code/modules/mentor/mentor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ GLOBAL_PROTECT(mentor_href_token)
var/target // the mentor's ckey
var/href_token // href token for mentor commands, uses the same token used by admins.
var/mob/following
var/position = "Mentor"

/datum/mentors/New(ckey)
/datum/mentors/New(ckey, mentorposition)
if(!ckey)
QDEL_IN(src, 0)
throw EXCEPTION("Mentor datum created without a ckey")
Expand All @@ -28,6 +29,7 @@ GLOBAL_PROTECT(mentor_href_token)
owner.add_mentor_verbs()
if(!check_rights_for(owner, R_ADMIN,0)) // don't add admins to mentor list.
GLOB.mentors += owner
position = mentorposition

/datum/mentors/proc/CheckMentorHREF(href, href_list)
var/auth = href_list["mentor_token"]
Expand Down Expand Up @@ -87,14 +89,15 @@ GLOBAL_PROTECT(mentor_href_token)
load_mentors()
return

var/datum/DBQuery/query_load_mentors = SSdbcore.NewQuery("SELECT ckey FROM [format_table_name("mentor")]")
var/datum/DBQuery/query_load_mentors = SSdbcore.NewQuery("SELECT ckey, position FROM [format_table_name("mentor")]")
if(!query_load_mentors.Execute())
qdel(query_load_mentors)
return

while(query_load_mentors.NextRow())
var/ckey = ckey(query_load_mentors.item[1])
new /datum/mentors(ckey)
var/position = query_load_mentors.item[2]
new /datum/mentors(ckey, position)

qdel(query_load_mentors)

Expand All @@ -109,4 +112,4 @@ GLOBAL_PROTECT(mentor_href_token)

// new client var: mentor_datum. Acts the same way holder does towards admin: it holds the mentor datum. if set, the guy's a mentor.
/client
var/datum/mentors/mentor_datum
var/datum/mentors/mentor_datum
24 changes: 15 additions & 9 deletions yogstation/code/modules/mentor/mentor_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ GLOBAL_PROTECT(mentor_verbs)
/client/verb/mentorwho()
set name = "Mentorwho"
set category = "Mentor"

var/msg = "<b>Current Mentors:</b>\n"
var/position = "Mentor"
var/msg = "<b>Current Mentors & Wiki:</b>\n"
if(holder)
for(var/client/C in GLOB.mentors)
msg += "\t[C] is a mentor"
if(C.mentor_datum.position)
position = C.mentor_datum.position
msg += "\t[C] is a [position]"

if(C.holder && C.holder.fakekey)
msg += " <i>(as [C.holder.fakekey])</i>"
Expand All @@ -62,10 +64,12 @@ GLOBAL_PROTECT(mentor_verbs)
msg += "\n"
else
for(var/client/C in GLOB.mentors)
if(C.mentor_datum.position)
position = C.mentor_datum.position
if(C.holder && C.holder.fakekey)
msg += "\t[C.holder.fakekey] is a mentor"
msg += "\t[C.holder.fakekey] is a [position]"
else
msg += "\t[C] is a mentor"
msg += "\t[C] is a [position]"
msg += "\n"
msg += "<span class='info'>Mentorhelps are also seen by admins. If no mentors are available in game adminhelp instead and an admin will see it and respond.</span>"
to_chat(src, msg, confidential=TRUE)
Expand Down Expand Up @@ -98,9 +102,11 @@ GLOBAL_PROTECT(mentor_verbs)
set name = "Dementor"
set category = "Mentor"
set desc = "Shed your mentor powers."
if(GLOB.mentors.len <= 2)
to_chat(src, "<span class='notice'>There are not enough mentors on for you to De-Mentor yourself!</span>", confidential=TRUE)
return
if(mentor_datum.position == "Mentor")
if(GLOB.mentors.len <= 2)
to_chat(src, "<span class='notice'>There are not enough mentors on for you to De-Mentor yourself!</span>", confidential=TRUE)
return
mentor_position = mentor_datum.position
remove_mentor_verbs()
mentor_datum = null
GLOB.mentors -= src
Expand All @@ -115,7 +121,7 @@ GLOBAL_PROTECT(mentor_verbs)
set desc = "Gain your mentor powers."
remove_verb(src, /client/proc/rementor)
spawn(20) // Now UselessTheremin being a shit too.
new /datum/mentors(ckey)
new /datum/mentors(ckey, mentor_position)
to_chat(src, "<span class='interface'>You are now a Mentor again.</span>", confidential=TRUE)
log_admin("[src] rementored themself.")
message_admins("[src] rementored themself.")