diff --git a/modular_splurt/code/modules/admin/JobBan.dm b/modular_splurt/code/modules/admin/JobBan.dm
index 6eb2cc4d01..cf9292f519 100644
--- a/modular_splurt/code/modules/admin/JobBan.dm
+++ b/modular_splurt/code/modules/admin/JobBan.dm
@@ -1,3 +1,86 @@
+GLOBAL_LIST_INIT(jobban_panel_data, list(
+ list(
+ "name" = "Command",
+ "color" = "yellow",
+ "roles" = GLOB.command_positions
+ ),
+ list(
+ "name" = "Security",
+ "color" = "red",
+ "roles" = GLOB.security_positions
+ ),
+ list(
+ "name" = "Engineering",
+ "color" = "orange",
+ "roles" = GLOB.engineering_positions
+ ),
+ list(
+ "name" = "Medical",
+ "color" = "blue",
+ "roles" = GLOB.medical_positions
+ ),
+ list(
+ "name" = "Science",
+ "color" = "violet",
+ "roles" = GLOB.science_positions
+ ),
+ list(
+ "name" = "Supply",
+ "color" = "brown",
+ "roles" = GLOB.supply_positions
+ ),
+ list(
+ "name" = "Service",
+ "color" = "green",
+ "roles" = GLOB.civilian_positions
+ ),
+ list(
+ "name" = "Silicon",
+ "color" = "purple",
+ "roles" = GLOB.nonhuman_positions
+ ),
+ list(
+ "name" = "Ghost Roles",
+ "color" = "teal",
+ "roles" = list(
+ ROLE_PAI,
+ ROLE_POSIBRAIN,
+ ROLE_DRONE,
+ ROLE_DEATHSQUAD,
+ ROLE_LAVALAND,
+ ROLE_GHOSTCAFE,
+ ROLE_SENTIENCE,
+ ROLE_MIND_TRANSFER
+ )
+ ),
+ list(
+ "name" = "Other",
+ "color" = "grey",
+ "roles" = list(
+ ROLE_RESPAWN
+ )
+ ),
+ list(
+ "name" = "Antagonists",
+ "color" = "red",
+ "roles" = list(
+ ROLE_TRAITOR,
+ ROLE_CHANGELING,
+ ROLE_HERETIC,
+ ROLE_OPERATIVE,
+ ROLE_REV,
+ ROLE_CULTIST,
+ ROLE_SERVANT_OF_RATVAR,
+ ROLE_WIZARD,
+ ROLE_ABDUCTOR,
+ ROLE_ALIEN,
+ ROLE_FAMILIES,
+ ROLE_BLOODSUCKER,
+ ROLE_SLAVER
+ )
+ )
+))
+
/datum/admins/proc/show_jobban_panel(client/C)
if(!istype(C, /client))
to_chat(owner, "This client is no longer in the game.")
@@ -46,15 +129,15 @@
/datum/jobban_panel/ui_data(mob/user)
. = list()
.["client_ckey"] = targetClient.ckey
+ .["is_antag_banned"] = jobban_isbanned(targetClient.mob, ROLE_SYNDICATE)
- if (role_status)
- .["roles"] = role_status
-
-/datum/jobban_panel/ui_static_data()
- . = list()
- updateJobbanStatus()
+ if (!role_status)
+ updateJobbanStatus()
.["roles"] = role_status
+// /datum/jobban_panel/ui_static_data()
+// . = list()
+
/datum/jobban_panel/ui_act(action, params, datum/tgui/ui)
if(..())
return
@@ -67,96 +150,147 @@
to_chat(usr, "Jobs subsystem not initialized yet!")
return
- var/query = params["selected_role"] // Which role was clicked on the UI, .e.g. "Assistant" or "engineeringdept"
- var/is_category = params["is_category"]
- var/list/jobs_to_set = list() // All the roles relating to the selected role above
+ var/mob/M = targetClient.mob
+ var/list/jobs_to_set = list() // All the roles relating to the clicked button
- to_chat(usr, "Query: " + query)
-
- if (is_category)
+ if (params["is_category"])
for(var/list/role_category in role_status) // For every department / antag category
- if (role_category["category_name"] == query) // If this is the selected category
- to_chat(usr, "Category found: " + role_category["category_name"])
+ if (role_category["category_name"] == params["selected_role"]) // If this is the selected category
for(var/list/role in role_category["category_roles"])
jobs_to_set += role["name"]
-
break
- else
- to_chat(usr, "NOT IT")
else
- jobs_to_set += query
+ jobs_to_set += params["selected_role"]
- to_chat(usr, "Total jobs to process:")
+ var/mode = params["want_to_ban"]
+
+ var/list/jobs_to_set_trimmed = list() // The roles from jobs_to_set that aren't already banned / unbanned
for(var/role in jobs_to_set)
- to_chat(usr, role)
-
+ // If we are in ban mode and this role is unbanned OR if we are in unban mode and this role is banned
+ // (We don't want to ban / unban roles that are already banned / unbanned)
+ if ((mode && !jobban_isbanned(M, role)) || (!mode && jobban_isbanned(M, role)))
+ jobs_to_set_trimmed += role
+ for(var/role in jobs_to_set_trimmed)
+ if (jobs_to_set_trimmed.len) // At least one role to get banned / unbanned
+ if (mode)
+ usr.client.holder.Jobban(targetClient.mob, jobs_to_set_trimmed)
+ else
+ usr.client.holder.UnJobban(targetClient.mob, jobs_to_set_trimmed)
+ updateJobbanStatus() // Update TGUI data to reflect new ban statuses
// Updates the jobban status of this client's jobban panel.
/datum/jobban_panel/proc/updateJobbanStatus()
- var/list/roles_to_check = list()
var/list/roles = list()
var/mob/M = targetClient.mob
- roles_to_check += list(list(
- "name" = "Command",
- "color" = "yellow",
- "roles" = GLOB.command_positions
- ))
- roles_to_check += list(list(
- "name" = "Security",
- "color" = "red",
- "roles" = GLOB.security_positions
- ))
- roles_to_check += list(list(
- "name" = "Engineering",
- "color" = "orange",
- "roles" = GLOB.engineering_positions
- ))
- roles_to_check += list(list(
- "name" = "Medical",
- "color" = "blue",
- "roles" = GLOB.medical_positions
- ))
- roles_to_check += list(list(
- "name" = "Science",
- "color" = "violet",
- "roles" = GLOB.science_positions
- ))
- roles_to_check += list(list(
- "name" = "Supply",
- "color" = "brown",
- "roles" = GLOB.supply_positions
- ))
- roles_to_check += list(list(
- "name" = "Service",
- "color" = "green",
- "roles" = GLOB.civilian_positions
- ))
- roles_to_check += list(list(
- "name" = "Silicon",
- "color" = "purple",
- "roles" = GLOB.nonhuman_positions
- ))
-
- for(var/list/role_category in roles_to_check) // For every department / antag category
+ for(var/list/role_category in GLOB.jobban_panel_data) // For every department / antag category
var/list/category_roles = list()
category_roles["category_name"] = role_category["name"]
+ category_roles["category_color"] = role_category["color"]
category_roles["category_roles"] = list()
for(var/role in role_category["roles"]) // For every job / antag
var/list/roles_instance = list()
roles_instance["name"] = role
- if(jobban_isbanned(M, role))
+ var/reason = jobban_isbanned(M, role)
+ if(reason)
roles_instance["is_banned"] = TRUE
+ roles_instance["ban_reason"] = reason
category_roles["category_roles"] += list(roles_instance)
roles += list(category_roles)
role_status = roles
+
+// notbannedlist is just a list of strings of the job titles you want to ban.
+/datum/admins/proc/Jobban(mob/M, list/notbannedlist)
+ var/severity = null
+ var/reason = null
+
+ switch(tgui_alert(usr, "Job ban type", buttons = list("Temporary", "Permanent", "Cancel")))
+ if("Temporary")
+ var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null
+ if(mins <= 0)
+ to_chat(usr, "[mins] is not a valid duration.")
+ return
+ reason = input(usr,"Please State Reason For Banning [M.key].","Reason") as message|null
+ if(!reason)
+ return
+ severity = tgui_alert(usr, "Set the severity of the note/ban", buttons = list("High", "Medium", "Minor", "None"))
+ if(!severity)
+ return
+ var/msg
+ for(var/job in notbannedlist)
+ if(!DB_ban_record(BANTYPE_JOB_TEMP, M, mins, reason, job))
+ to_chat(usr, "Failed to apply ban.")
+ return
+ if(M.client)
+ jobban_buildcache(M.client)
+ ban_unban_log_save("[key_name(usr)] temp-jobbanned [key_name(M)] from [job] for [mins] minutes. reason: [reason]")
+ log_admin_private("[key_name(usr)] temp-jobbanned [key_name(M)] from [job] for [mins] minutes.")
+ if(!msg)
+ msg = job
+ else
+ msg += ", [job]"
+ create_message("note", M.key, null, "Banned from [msg] - [reason]", null, null, 0, 0, null, 0, severity)
+ message_admins("[key_name_admin(usr)] banned [key_name_admin(M)] from [msg] for [mins] minutes.")
+ to_chat(M, "You have been [((msg == "ooc") || (msg == "appearance") || (msg == "pacifist")) ? "banned" : "jobbanned"] by [usr.client.key] from: [msg == "pacifist" ? "using violence" : msg].")
+ to_chat(M, "The reason is: [reason]")
+ to_chat(M, "This jobban will be lifted in [mins] minutes.")
+
+ if("Permanent")
+ reason = input(usr,"Please State Reason For Banning [M.key].","Reason") as message|null
+ if (!reason)
+ return
+ severity = tgui_alert(usr, "Please State Reason For Banning", buttons = list("High", "Medium", "Minor", "None"))
+ if (!severity)
+ return
+
+ var/msg
+ for(var/job in notbannedlist)
+ if(!DB_ban_record(BANTYPE_JOB_PERMA, M, -1, reason, job))
+ to_chat(usr, "Failed to apply ban.")
+ return
+ if(M.client)
+ jobban_buildcache(M.client)
+ ban_unban_log_save("[key_name(usr)] perma-jobbanned [key_name(M)] from [job]. reason: [reason]")
+ log_admin_private("[key_name(usr)] perma-banned [key_name(M)] from [job]")
+ if(!msg)
+ msg = job
+ else
+ msg += ", [job]"
+ create_message("note", M.key, null, "Banned from [msg] - [reason]", null, null, 0, 0, null, 0, severity)
+ message_admins("[key_name_admin(usr)] banned [key_name_admin(M)] from [msg].")
+ to_chat(M, "You have been [((msg == "ooc") || (msg == "appearance") || (msg == "pacifist")) ? "banned" : "jobbanned"] by [usr.client.key] from: [msg == "pacifist" ? "using violence" : msg].")
+ to_chat(M, "The reason is: [reason]")
+ to_chat(M, "This jobban can be lifted only upon request.")
+
+// notbannedlist is just a list of strings of the job titles you want to unban.
+/datum/admins/proc/UnJobban(mob/M, list/bannedlist)
+ var/msg
+ for(var/job in bannedlist)
+ var/reason = jobban_isbanned(M, job)
+ if (tgui_alert(usr, "Job: '[job]' Reason: '[reason]'", "Un-Jobban This Player?", list("Yes", "No")) == "Yes")
+ ban_unban_log_save("[key_name(usr)] unjobbanned [key_name(M)] from [job]")
+ log_admin_private("[key_name(usr)] unbanned [key_name(M)] from [job]")
+ DB_ban_unban(M.ckey, BANTYPE_ANY_JOB, job)
+ if(M.client)
+ jobban_buildcache(M.client)
+ if(!msg)
+ msg = job
+ else
+ msg += ", [job]"
+ if(msg)
+ message_admins("[key_name_admin(usr)] unbanned [key_name_admin(M)] from [msg].")
+ to_chat(M, "You have been un-jobbanned by [usr.client.key] from [msg].")
+
+
+
+
diff --git a/tgui/packages/tgui/interfaces/JobbanPanel.js b/tgui/packages/tgui/interfaces/JobbanPanel.js
index 475519c415..a096563e00 100644
--- a/tgui/packages/tgui/interfaces/JobbanPanel.js
+++ b/tgui/packages/tgui/interfaces/JobbanPanel.js
@@ -1,6 +1,6 @@
import { Fragment } from "inferno";
import { useBackend, useLocalState } from '../backend';
-import { Input, Button, Flex, Section, Tabs, Box, Dropdown, Slider, Tooltip } from '../components';
+import { Input, Collapsible, Button, Flex, Section, Tabs, Box, Dropdown, Slider, Tooltip, NoticeBox, Blink } from '../components';
import { Window } from '../layouts';
export const JobbanPanel = (props, context) => {
@@ -12,18 +12,18 @@ export const JobbanPanel = (props, context) => {
return (
-
+
{roles.map((role_category, i) => { return (
setTab(i)}>
@@ -45,11 +45,10 @@ export const JobbanPanel = (props, context) => {
const GeneralActions = (props, context) => {
const { act, data } = useBackend(context);
const [tab] = useLocalState(context, 'tab', 0);
- const { roles, client_key } = data;
+ const { roles, is_antag_banned } = data;
return (
@@ -59,9 +58,10 @@ const GeneralActions = (props, context) => {
icon="lock"
minWidth="8rem"
textAlign="center"
- onClick={() => act('add_ban', {
+ onClick={() => act(null, {
selected_role: roles[tab].category_name,
is_category: true,
+ want_to_ban: true,
})} />
);
- })}
+ })} */}
+ setTab(0)}>
+ Tab title
+
+ setTab(1)}>
+ Tab title
+
+ setTab(2)}>
+ Tab title
+
+
+
-
+
+ {tab === 0 && (
+
+ )}
+ {tab === 1 && (
+
+ )}
+ {tab === 2 && (
+
+ )}
+ {/* */}
@@ -177,6 +212,91 @@ export const PlayerPanel2 = (props, context) => {
);
};
+const Jobbans = (props, context) => {
+ const { act, data } = useBackend(context);
+ const [tab2, setTab2] = useLocalState(context, 'tab2', 0);
+ const { client_key, is_type_mob_living } = data;
+ return (
+
+
+
+
+ setTab2(0)}>
+ Tab title
+
+ setTab2(1)}>
+ Tab title
+
+ setTab2(2)}>
+ Tab title
+
+
+
+
+
+
+
+
+
+ );
+};
+
+const Joban2 = (props, context) => {
+ const { act, data } = useBackend(context);
+
+ const { client_key, is_type_mob_living } = data;
+ return (
+
+
+
+ act("heal")}
+ />
+ act("smite")}
+ />
+ act("ghost")}
+ />
+
+
+
+ );
+};
+
const GeneralActions = (props, context) => {
const { act, data } = useBackend(context);