diff --git a/code/__DEFINES/dcs/datum_signals.dm b/code/__DEFINES/dcs/datum_signals.dm
index fa475cfd2a2..381204c413c 100644
--- a/code/__DEFINES/dcs/datum_signals.dm
+++ b/code/__DEFINES/dcs/datum_signals.dm
@@ -134,3 +134,5 @@
/// from base of /datum/ruleset/proc/can_apply()
#define COMSIG_RULESET_FAILED_SPECIES "failed_species"
+
+#define COMSIGN_TICKET_COUNT_UPDATE "ticket_count_updated"
diff --git a/code/controllers/subsystem/tickets/SStickets.dm b/code/controllers/subsystem/tickets/SStickets.dm
index c7c77d18f48..2b90e822867 100644
--- a/code/controllers/subsystem/tickets/SStickets.dm
+++ b/code/controllers/subsystem/tickets/SStickets.dm
@@ -187,6 +187,7 @@ SUBSYSTEM_DEF(tickets)
SEND_SOUND(C, sound('sound/effects/adminticketopen.ogg'))
message_staff(url_title, NONE, TRUE)
+ open_ticket_count_updated()
return T
//Set ticket state with key N to open
@@ -197,6 +198,7 @@ SUBSYSTEM_DEF(tickets)
sendFollowupToDiscord(T, usr.client, "*Ticket reopened.*")
to_chat_safe(returnClient(N), "Your [ticket_name] has been re-opened.")
T.ticketState = TICKET_OPEN
+ open_ticket_count_updated()
return TRUE
//Set ticket state with key N to resolved
@@ -207,6 +209,7 @@ SUBSYSTEM_DEF(tickets)
message_staff("[usr.client] / ([usr]) resolved [ticket_name] number [N]")
sendFollowupToDiscord(T, usr.client, "*Ticket resolved.*")
to_chat_safe(returnClient(N), "Your [ticket_name] has now been resolved.")
+ open_ticket_count_updated()
return TRUE
/datum/controller/subsystem/tickets/proc/refresh_tickets(list/tickets)
@@ -271,6 +274,7 @@ SUBSYSTEM_DEF(tickets)
message_staff("[C] has converted ticket number [T.ticketNum] to a [other_ticket_name] ticket.")
log_game("[C] has converted ticket number [T.ticketNum] to a [other_ticket_name] ticket.")
create_other_system_ticket(T)
+ open_ticket_count_updated()
/datum/controller/subsystem/tickets/proc/create_other_system_ticket(datum/ticket/T)
var/client/C = get_client_by_ckey(T.client_ckey)
@@ -326,6 +330,7 @@ SUBSYSTEM_DEF(tickets)
sendFollowupToDiscord(T, usr.client, "*Ticket closed.*")
to_chat_safe(returnClient(N), close_messages)
T.ticketState = TICKET_CLOSED
+ open_ticket_count_updated()
return TRUE
//Check if the user already has a ticket open and within the cooldown period.
@@ -827,6 +832,13 @@ UI STUFF
return FALSE
return TRUE
+/datum/controller/subsystem/tickets/proc/open_ticket_count_updated()
+ var/ticket_count = 0
+ for(var/datum/ticket/T in allTickets)
+ if(T.ticketState == TICKET_OPEN || T.ticketState == TICKET_STALE)
+ ticket_count++
+ SEND_SIGNAL(src, COMSIGN_TICKET_COUNT_UPDATE, ticket_count)
+
#undef TICKET_STAFF_MESSAGE_ADMIN_CHANNEL
#undef TICKET_STAFF_MESSAGE_PREFIX
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index d678325ce80..a98a4c73806 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -929,6 +929,9 @@ GLOBAL_LIST_INIT(view_runtimes_verbs, list(
log_admin("[key_name(usr)] re-adminned themselves.")
GLOB.de_admins -= ckey
GLOB.de_mentors -= ckey
+ if(istype(mob, /mob/dead/observer))
+ var/mob/dead/observer/O = mob
+ O.update_admin_actions()
SSblackbox.record_feedback("tally", "admin_verb", 1, "Re-admin")
return
else
diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm
index 5eb5fbb3b9c..4ecb375ecec 100644
--- a/code/modules/admin/holder2.dm
+++ b/code/modules/admin/holder2.dm
@@ -148,7 +148,10 @@ you will have to do something like if(client.holder.rights & R_ADMIN) yourself.
if(holder)
holder.disassociate()
qdel(holder)
- return 1
+ if(istype(mob, /mob/dead/observer))
+ var/mob/dead/observer/O = mob
+ O.update_admin_actions()
+ return TRUE
//This proc checks whether subject has at least ONE of the rights specified in rights_required.
/proc/check_rights_for(client/subject, rights_required)
diff --git a/code/modules/mob/dead/observer/observer_admin_actions.dm b/code/modules/mob/dead/observer/observer_admin_actions.dm
new file mode 100644
index 00000000000..fdbef61a402
--- /dev/null
+++ b/code/modules/mob/dead/observer/observer_admin_actions.dm
@@ -0,0 +1,74 @@
+/mob/dead/observer/proc/update_admin_actions()
+ for(var/datum/action/innate/admin/action in actions)
+ if(!check_rights(action.rights_required, FALSE, src))
+ qdel(action)
+ if(!client || !client.holder)
+ return
+ if(ckey && (ckey in (GLOB.de_admins + GLOB.de_mentors)))
+ return
+
+ for(var/datum/action/innate/admin/action as anything in subtypesof(/datum/action/innate/admin))
+ if(check_rights(action.rights_required, FALSE, src))
+ var/datum/action/innate/admin/given_action = new action()
+ given_action.Grant(src)
+
+/datum/action/innate/admin
+ button_overlay_icon = 'icons/mob/actions/actions_admin.dmi'
+ var/rights_required = R_ADMIN
+
+/datum/action/innate/admin/Trigger()
+ if(!..())
+ return FALSE
+ if(!check_rights(rights_required, TRUE, usr))
+ return
+ admin_click(usr)
+
+/datum/action/innate/admin/proc/admin_click(mob/user)
+ return
+
+/datum/action/innate/admin/ticket
+ name = "Adminhelps"
+ desc = "There are 0 open tickets."
+ button_overlay_icon_state = "adminhelp"
+ var/ticket_amt = 0
+
+/datum/action/innate/admin/ticket/New(Target)
+ button_overlay_icon_state = "nohelp"
+ . = ..()
+ register_ticket_signals()
+
+/datum/action/innate/admin/ticket/admin_click(mob/user)
+ SStickets.showUI(user)
+
+/datum/action/innate/admin/ticket/proc/register_ticket_signals()
+ RegisterSignal(SStickets, COMSIGN_TICKET_COUNT_UPDATE, PROC_REF(update_tickets))
+
+/datum/action/innate/admin/ticket/proc/update_tickets(ticketsystem, _ticket_amt)
+ ticket_amt = _ticket_amt
+ desc = "There are [ticket_amt] open tickets."
+ if(ticket_amt > 0)
+ button_overlay_icon_state = initial(button_overlay_icon_state)
+ else
+ button_overlay_icon_state = "nohelp"
+ UpdateButtons()
+
+/datum/action/innate/admin/ticket/UpdateButton(atom/movable/screen/movable/action_button/button, status_only, force)
+ . = ..()
+ if(ticket_amt <= 0)
+ return
+ var/image/maptext_holder = image('icons/effects/effects.dmi', icon_state = "nothing")
+ maptext_holder.plane = FLOAT_PLANE + 1.1
+ maptext_holder.maptext = "[ticket_amt]"
+ maptext_holder.maptext_x = 2
+ button.add_overlay(maptext_holder)
+
+/datum/action/innate/admin/ticket/mentor
+ name = "Mentorhelps"
+ button_overlay_icon_state = "mentorhelp"
+ rights_required = R_MENTOR|R_ADMIN
+
+/datum/action/innate/admin/ticket/mentor/register_ticket_signals()
+ RegisterSignal(SSmentor_tickets, COMSIGN_TICKET_COUNT_UPDATE, PROC_REF(update_tickets))
+
+/datum/action/innate/admin/ticket/mentor/admin_click(mob/user)
+ SSmentor_tickets.showUI(user)
diff --git a/code/modules/mob/dead/observer/observer_login.dm b/code/modules/mob/dead/observer/observer_login.dm
index d9212897cc8..4dd71a5677d 100644
--- a/code/modules/mob/dead/observer/observer_login.dm
+++ b/code/modules/mob/dead/observer/observer_login.dm
@@ -10,3 +10,4 @@
if(GLOB.non_respawnable_keys[ckey])
can_reenter_corpse = 0
REMOVE_TRAIT(src, TRAIT_RESPAWNABLE, GHOSTED)
+ update_admin_actions()
diff --git a/code/modules/mob/dead/observer/observer_logout.dm b/code/modules/mob/dead/observer/observer_logout.dm
index d6c1b6e96fb..a61d232b3c4 100644
--- a/code/modules/mob/dead/observer/observer_logout.dm
+++ b/code/modules/mob/dead/observer/observer_logout.dm
@@ -5,6 +5,7 @@
cleanup_observe()
..()
+ update_admin_actions()
spawn(0)
if(src && !key) //we've transferred to another mob. This ghost should be deleted.
qdel(src)
diff --git a/icons/mob/actions/actions_admin.dmi b/icons/mob/actions/actions_admin.dmi
new file mode 100644
index 00000000000..032806bdcfb
Binary files /dev/null and b/icons/mob/actions/actions_admin.dmi differ
diff --git a/paradise.dme b/paradise.dme
index f82b6593c29..7f4a74f4c99 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -2342,6 +2342,7 @@
#include "code\modules\mob\camera\eye\syndicate.dm"
#include "code\modules\mob\camera\eye\xenobio_eye.dm"
#include "code\modules\mob\dead\dead.dm"
+#include "code\modules\mob\dead\observer\observer_admin_actions.dm"
#include "code\modules\mob\dead\observer\observer_base.dm"
#include "code\modules\mob\dead\observer\observer_login.dm"
#include "code\modules\mob\dead\observer\observer_logout.dm"