mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 15:14:27 +01:00
lastlog, dept_demote, refactor
This commit is contained in:
@@ -53,15 +53,16 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
//Assoc array: "JobName" = (int)<Opened Positions>
|
||||
var/list/opened_positions = list()
|
||||
|
||||
|
||||
/obj/machinery/computer/card/proc/is_centcom()
|
||||
return istype(src, /obj/machinery/computer/card/centcom)
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/computer/card/proc/is_authenticated(var/mob/user)
|
||||
if(user.can_admin_interact())
|
||||
return 1
|
||||
return TRUE
|
||||
if(scan)
|
||||
return check_access(scan)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/computer/card/proc/get_target_rank()
|
||||
return modify && modify.assignment ? modify.assignment : "Unassigned"
|
||||
@@ -217,6 +218,38 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
jobs_returned += "Civilian"
|
||||
return jobs_returned
|
||||
|
||||
/obj/machinery/computer/card/proc/get_employees(list/selectedranks)
|
||||
var/list/names_returned = list()
|
||||
if(isnull(GLOB.data_core.general) || isnull(GLOB.data_core.security))
|
||||
return names_returned
|
||||
for(var/datum/data/record/R in GLOB.data_core.general)
|
||||
if(!R.fields || !R.fields["name"] || !R.fields["real_rank"])
|
||||
continue
|
||||
if(!(R.fields["real_rank"] in selectedranks))
|
||||
continue
|
||||
for(var/datum/data/record/E in GLOB.data_core.security)
|
||||
if(E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])
|
||||
var/buttontext
|
||||
var/isdemotable = FALSE
|
||||
switch(E.fields["criminal"])
|
||||
if(SEC_RECORD_STATUS_NONE)
|
||||
buttontext = "Demote"
|
||||
isdemotable = TRUE
|
||||
if(SEC_RECORD_STATUS_DEMOTE)
|
||||
buttontext = "Arrest"
|
||||
isdemotable = TRUE
|
||||
else
|
||||
buttontext = "Ineligible"
|
||||
names_returned.Add(list(list(
|
||||
"name" = E.fields["name"],
|
||||
"crimstat" = E.fields["criminal"],
|
||||
"title" = R.fields["real_rank"],
|
||||
"buttontext" = buttontext,
|
||||
"demotable" = isdemotable
|
||||
)))
|
||||
break
|
||||
return names_returned
|
||||
|
||||
/obj/machinery/computer/card/attack_ai(var/mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
@@ -240,24 +273,25 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
data["modify_name"] = modify ? modify.name : FALSE
|
||||
data["modify_owner"] = modify && modify.registered_name ? modify.registered_name : "-----"
|
||||
data["modify_rank"] = get_target_rank()
|
||||
data["modify_lastlog"] = modify && modify.lastlog ? modify.lastlog : FALSE
|
||||
data["scan_name"] = scan ? scan.name : FALSE
|
||||
data["scan_rank"] = scan ? scan.rank : FALSE
|
||||
data["authenticated"] = is_authenticated(user) ? scan.registered_name : FALSE
|
||||
|
||||
data["authenticated"] = is_authenticated(user) ? scan.registered_name : FALSE
|
||||
data["target_dept"] = target_dept
|
||||
data["iscentcom"] = is_centcom() ? TRUE : FALSE
|
||||
switch(mode)
|
||||
if(0)
|
||||
if(modify)
|
||||
// JOB TRANSFER / ACCESS CHANGE
|
||||
data["current_skin"] = modify.icon_state
|
||||
data["jobs_top"] = list("Captain", "Custom")
|
||||
// JOB TRANSFER
|
||||
data["scan_hasidchange"] = scan && (ACCESS_CHANGE_IDS in scan.access) ? TRUE : FALSE
|
||||
if(!scan)
|
||||
// don't gen data
|
||||
else if(target_dept && !(ACCESS_CHANGE_IDS in scan.access))
|
||||
else if(target_dept)
|
||||
data["jobs_dept"] = get_subordinates(scan.assignment, FALSE)
|
||||
else
|
||||
data["account_number"] = modify ? modify.associated_account_number : null
|
||||
data["jobs_top"] = list("Captain", "Custom")
|
||||
data["jobs_engineering"] = GLOB.engineering_positions
|
||||
data["jobs_medical"] = GLOB.medical_positions
|
||||
data["jobs_science"] = GLOB.science_positions
|
||||
@@ -267,6 +301,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
data["jobs_karma"] = GLOB.whitelisted_positions
|
||||
data["jobs_centcom"] = get_all_centcom_jobs()
|
||||
data["jobFormats"] = SSjobs.format_jobs_for_id_computer(modify)
|
||||
data["current_skin"] = modify.icon_state
|
||||
data["card_skins"] = format_card_skins(get_station_card_skins())
|
||||
data["all_centcom_skins"] = is_centcom() ? format_card_skins(get_centcom_card_skins()) : FALSE
|
||||
|
||||
@@ -284,7 +319,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
data["cooldown_time"] = "[mins]:[seconds]"
|
||||
else
|
||||
data["cooldown_time"] = FALSE
|
||||
if(2) // ACCESS CHANGING
|
||||
if(2) // ACCESS CHANGES
|
||||
if(modify)
|
||||
data["selectedAccess"] = modify.access
|
||||
data["regions"] = get_accesslist_static_data(REGION_GENERAL, is_centcom() ? REGION_CENTCOMM : REGION_COMMAND)
|
||||
@@ -292,6 +327,10 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
// RECORDS
|
||||
if(is_authenticated(user))
|
||||
data["records"] = SSjobs.format_job_change_records(data["iscentcom"])
|
||||
if(4)
|
||||
if(is_authenticated(user))
|
||||
data["jobs_dept"] = get_subordinates(scan.assignment, FALSE)
|
||||
data["people_dept"] = get_employees(data["jobs_dept"])
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/card/proc/regenerate_id_name()
|
||||
@@ -369,10 +408,10 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
return
|
||||
var/t1 = params["assign_target"]
|
||||
if(target_dept && modify.assignment == "Demoted")
|
||||
visible_message("<span class='notice'>[src]: Demoted individuals must see the HoP for a new job.</span>")
|
||||
visible_message("<span class='warning'>[src]: Demoted individuals must see the HoP for a new job.</span>")
|
||||
return FALSE
|
||||
if(!job_in_department(SSjobs.GetJob(modify.rank), FALSE))
|
||||
visible_message("<span class='notice'>[src]: Cross-department job transfers must be done by the HoP.</span>")
|
||||
visible_message("<span class='warning'>[src]: Cross-department job transfers must be done by the HoP.</span>")
|
||||
return FALSE
|
||||
if(!job_in_department(SSjobs.GetJob(t1)))
|
||||
return FALSE
|
||||
@@ -382,6 +421,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
if(temp_t && scan && modify)
|
||||
var/oldrank = modify.getRankAndAssignment()
|
||||
SSjobs.log_job_transfer(modify.registered_name, oldrank, temp_t, scan.registered_name, null)
|
||||
modify.lastlog = "[station_time_timestamp()]: Reassigned by \"[scan.registered_name]\" from \"[oldrank]\" to \"[temp_t]\"."
|
||||
modify.assignment = temp_t
|
||||
log_game("[key_name(usr)] has reassigned \"[modify.registered_name]\" from \"[oldrank]\" to \"[temp_t]\".")
|
||||
SSjobs.notify_dept_head(modify.rank, "[scan.registered_name] has transferred \"[modify.registered_name]\" the \"[oldrank]\" to \"[temp_t]\".")
|
||||
@@ -408,6 +448,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
message_admins("[key_name_admin(usr)] has reassigned \"[modify.registered_name]\" from \"[jobnamedata]\" to \"[t1]\".")
|
||||
|
||||
SSjobs.log_job_transfer(modify.registered_name, jobnamedata, t1, scan.registered_name, null)
|
||||
modify.lastlog = "[station_time_timestamp()]: Reassigned by \"[scan.registered_name]\" from \"[jobnamedata]\" to \"[t1]\"."
|
||||
SSjobs.notify_dept_head(t1, "[scan.registered_name] has transferred \"[modify.registered_name]\" the \"[jobnamedata]\" to \"[t1]\".")
|
||||
if(modify.owner_uid)
|
||||
SSjobs.slot_job_transfer(modify.rank, t1)
|
||||
@@ -445,6 +486,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
message_admins("[key_name_admin(usr)] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" [m_ckey_text] to \"Civilian (Demoted)\" for: \"[reason]\".")
|
||||
usr.create_log(MISC_LOG, "demoted \"[modify.registered_name]\" [m_ckey_text] the \"[jobnamedata]\"")
|
||||
SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Demoted", scan.registered_name, reason)
|
||||
modify.lastlog = "[station_time_timestamp()]: DEMOTED by \"[scan.registered_name]\" from \"[jobnamedata]\" for: \"[reason]\"."
|
||||
SSjobs.notify_dept_head(modify.rank, "[scan.registered_name] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" for \"[reason]\".")
|
||||
modify.access = access
|
||||
modify.rank = "Civilian"
|
||||
@@ -491,6 +533,21 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
log_game("[key_name(usr)] has closed a job slot for job \"[j]\".")
|
||||
message_admins("[key_name_admin(usr)] has closed a job slot for job \"[j.title]\".")
|
||||
return
|
||||
if("remote_demote")
|
||||
for(var/datum/data/record/E in GLOB.data_core.general)
|
||||
if(E.fields["name"] == params["remote_demote"])
|
||||
for(var/datum/data/record/R in GLOB.data_core.security)
|
||||
if(R.fields["id"] == E.fields["id"])
|
||||
if(R.fields["criminal"] == SEC_RECORD_STATUS_DEMOTE)
|
||||
set_criminal_status(usr, R, SEC_RECORD_STATUS_ARREST, "Failure to comply with demotion order.", scan.assignment)
|
||||
else if(R.fields["criminal"] == SEC_RECORD_STATUS_NONE)
|
||||
set_criminal_status(usr, R, SEC_RECORD_STATUS_DEMOTE, "Order of department head", scan.assignment)
|
||||
addtimer(CALLBACK(src, .proc/respawn), respawn_time)
|
||||
else
|
||||
to_chat(usr, "Cannot demote, due to their current sec status.")
|
||||
return FALSE
|
||||
return
|
||||
return
|
||||
// Everything below here requires a full ID computer (dept consoles do not qualify)
|
||||
if(target_dept)
|
||||
playsound(src.loc, 'sound/machines/buzz-sigh.ogg', 50, 0)
|
||||
@@ -586,6 +643,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" [m_ckey_text] the \"[jobnamedata]\" for: \"[reason]\".")
|
||||
usr.create_log(MISC_LOG, "terminated the employment of \"[modify.registered_name]\" [m_ckey_text] the \"[jobnamedata]\"")
|
||||
SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Terminated", scan.registered_name, reason)
|
||||
modify.lastlog = "[station_time_timestamp()]: TERMINATED by \"[scan.registered_name]\" from \"[jobnamedata]\" for: \"[reason]\"."
|
||||
SSjobs.notify_dept_head(modify.rank, "[scan.registered_name] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\" for \"[reason]\".")
|
||||
modify.assignment = "Terminated"
|
||||
modify.access = list()
|
||||
@@ -611,6 +669,9 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
blacklisted_full = list()
|
||||
blacklisted_partial = list()
|
||||
|
||||
/obj/machinery/computer/card/centcom/is_centcom()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/card/minor
|
||||
name = "department management console"
|
||||
target_dept = TARGET_DEPT_GENERIC
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
var/rank = null //actual job
|
||||
var/owner_uid
|
||||
var/owner_ckey
|
||||
var/lastlog
|
||||
var/dorm = 0 // determines if this ID has claimed a dorm already
|
||||
|
||||
var/sex
|
||||
|
||||
@@ -36,6 +36,12 @@ export const CardComputer = (props, context) => {
|
||||
onClick={() => act("mode", { mode: 3 })}>
|
||||
Records
|
||||
</Tabs.Tab>
|
||||
<Tabs.Tab
|
||||
icon="scroll"
|
||||
selected={data.mode === 4}
|
||||
onClick={() => act("mode", { mode: 4 })}>
|
||||
Demote
|
||||
</Tabs.Tab>
|
||||
</Tabs>
|
||||
);
|
||||
|
||||
@@ -85,6 +91,11 @@ export const CardComputer = (props, context) => {
|
||||
bodyBlock = (
|
||||
<Section title="Department Job Transfer">
|
||||
<LabeledList>
|
||||
{!!data.modify_lastlog && (
|
||||
<LabeledList.Item label="Latest Transfer">
|
||||
{data.modify_lastlog}
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Department">
|
||||
{data.jobs_dept.map(v => (
|
||||
<Button
|
||||
@@ -108,6 +119,16 @@ export const CardComputer = (props, context) => {
|
||||
color="red" icon="times"
|
||||
onClick={() => act("demote")} />
|
||||
</LabeledList.Item>
|
||||
{!!data.scan_hasidchange && (
|
||||
<LabeledList.Item label="Non-Crew">
|
||||
<Button
|
||||
disabled={"Terminated" === data.modify_rank}
|
||||
key="Terminate" content="Terminated"
|
||||
tooltip="Zero access. Not crew."
|
||||
color="red" icon="eraser"
|
||||
onClick={() => act("terminate")} />
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
</LabeledList>
|
||||
</Section>
|
||||
);
|
||||
@@ -135,6 +156,12 @@ export const CardComputer = (props, context) => {
|
||||
: "None"}
|
||||
onClick={() => act("account")} />
|
||||
</LabeledList.Item>
|
||||
{!!data.modify_lastlog && (
|
||||
<LabeledList.Item label="Latest Transfer">
|
||||
{data.modify_lastlog}
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
|
||||
</Section>
|
||||
<Section title="Job Transfer">
|
||||
<LabeledList>
|
||||
@@ -220,7 +247,7 @@ export const CardComputer = (props, context) => {
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Non-Crew">
|
||||
<LabeledList.Item label="Demotions">
|
||||
<Button
|
||||
disabled={"Terminated" === data.modify_rank}
|
||||
key="Demoted" content="Demoted"
|
||||
@@ -228,6 +255,8 @@ export const CardComputer = (props, context) => {
|
||||
tooltip="Civilian access, 'demoted' title."
|
||||
color="red" icon="times"
|
||||
onClick={() => act("demote")} />
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Non-Crew">
|
||||
<Button
|
||||
disabled={"Terminated" === data.modify_rank}
|
||||
key="Terminate" content="Terminated"
|
||||
@@ -279,23 +308,31 @@ export const CardComputer = (props, context) => {
|
||||
|
||||
<Table>
|
||||
<Table.Row>
|
||||
<Table.Cell bold textAlign='center'>Title</Table.Cell>
|
||||
<Table.Cell bold textAlign='center'>Used Slots</Table.Cell>
|
||||
<Table.Cell bold textAlign='center'>Total Slots</Table.Cell>
|
||||
<Table.Cell bold textAlign='center'>Free Slots</Table.Cell>
|
||||
<Table.Cell bold textAlign='center'>Close Slot</Table.Cell>
|
||||
<Table.Cell bold textAlign='center'>Open Slot</Table.Cell>
|
||||
<Table.Cell bold textAlign='center'>Priority</Table.Cell>
|
||||
<Table.Cell bold textAlign="center">Title</Table.Cell>
|
||||
<Table.Cell bold textAlign="center">Used Slots</Table.Cell>
|
||||
<Table.Cell bold textAlign="center">Total Slots</Table.Cell>
|
||||
<Table.Cell bold textAlign="center">Free Slots</Table.Cell>
|
||||
<Table.Cell bold textAlign="center">Close Slot</Table.Cell>
|
||||
<Table.Cell bold textAlign="center">Open Slot</Table.Cell>
|
||||
<Table.Cell bold textAlign="center">Priority</Table.Cell>
|
||||
</Table.Row>
|
||||
{data.job_slots.map(slotData => (
|
||||
<Table.Row key={slotData.title}>
|
||||
<Table.Cell textAlign='center'>{slotData.title}</Table.Cell>
|
||||
<Table.Cell textAlign='center'>{slotData.current_positions}</Table.Cell>
|
||||
<Table.Cell textAlign='center'>{slotData.total_positions}</Table.Cell>
|
||||
<Table.Cell textAlign='center'>
|
||||
{slotData.total_positions > slotData.current_positions && (
|
||||
<Table.Cell textAlign="center">
|
||||
{slotData.title}
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign="center">
|
||||
{slotData.current_positions}
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign="center">
|
||||
{slotData.total_positions}
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign="center">
|
||||
{slotData.total_positions
|
||||
> slotData.current_positions && (
|
||||
<Box color="green">
|
||||
{slotData.total_positions - slotData.current_positions}
|
||||
{slotData.total_positions
|
||||
- slotData.current_positions}
|
||||
</Box>
|
||||
) || (
|
||||
<Box color="red">
|
||||
@@ -303,21 +340,21 @@ export const CardComputer = (props, context) => {
|
||||
</Box>
|
||||
)}
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign='center'>
|
||||
<Table.Cell textAlign="center">
|
||||
<Button
|
||||
content="-"
|
||||
disabled={data.cooldown_time || !slotData.can_close}
|
||||
onClick={() => act("make_job_unavailable",
|
||||
{ job: slotData.title })} />
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign='center'>
|
||||
<Table.Cell textAlign="center">
|
||||
<Button
|
||||
content="+"
|
||||
disabled={data.cooldown_time || !slotData.can_open}
|
||||
onClick={() => act("make_job_available",
|
||||
{ job: slotData.title })} />
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign='center'>
|
||||
<Table.Cell textAlign="center">
|
||||
{data.target_dept && (
|
||||
<Box color="green">
|
||||
{data.priority_jobs.indexOf(slotData.title) > -1
|
||||
@@ -325,17 +362,17 @@ export const CardComputer = (props, context) => {
|
||||
: ""}
|
||||
</Box>
|
||||
) || (
|
||||
<Button
|
||||
content="Priority"
|
||||
selected={
|
||||
data.priority_jobs.indexOf(slotData.title) > -1
|
||||
}
|
||||
disabled={
|
||||
data.cooldown_time || !slotData.can_prioritize
|
||||
}
|
||||
onClick={() => act("prioritize_job",
|
||||
{ job: slotData.title })} />
|
||||
)}
|
||||
<Button
|
||||
content="Priority"
|
||||
selected={
|
||||
data.priority_jobs.indexOf(slotData.title) > -1
|
||||
}
|
||||
disabled={
|
||||
data.cooldown_time || !slotData.can_prioritize
|
||||
}
|
||||
onClick={() => act("prioritize_job",
|
||||
{ job: slotData.title })} />
|
||||
)}
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
@@ -446,6 +483,42 @@ export const CardComputer = (props, context) => {
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 4: // demote
|
||||
if (!data.authenticated) {
|
||||
bodyBlock = (
|
||||
<Section title="Warning" color="red">
|
||||
Not logged in.
|
||||
</Section>
|
||||
);
|
||||
} else {
|
||||
bodyBlock = (
|
||||
<Section title="Remote Demotion">
|
||||
<Table>
|
||||
<Table.Row>
|
||||
<Table.Cell bold>Name</Table.Cell>
|
||||
<Table.Cell bold>Rank</Table.Cell>
|
||||
<Table.Cell bold>Sec Status</Table.Cell>
|
||||
<Table.Cell bold>Actions</Table.Cell>
|
||||
</Table.Row>
|
||||
{data.people_dept.map(record => (
|
||||
<Table.Row key={record.title}>
|
||||
<Table.Cell>{record.name}</Table.Cell>
|
||||
<Table.Cell>{record.title}</Table.Cell>
|
||||
<Table.Cell>{record.crimstat}</Table.Cell>
|
||||
<Table.Cell>
|
||||
<Button
|
||||
content={record.buttontext}
|
||||
disabled={!record.demotable}
|
||||
onClick={() => act("remote_demote",
|
||||
{ remote_demote: record.name })} />
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bodyBlock = "Unknown Mode.";
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user