mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 14:37:04 +01:00
fix centcom computers, add crew transfer log feature
This commit is contained in:
@@ -8,6 +8,8 @@ SUBSYSTEM_DEF(jobs)
|
||||
var/list/name_occupations = list() //Dict of all jobs, keys are titles
|
||||
var/list/type_occupations = list() //Dict of all jobs, keys are types
|
||||
var/list/prioritized_jobs = list() // List of jobs set to priority by HoP/Captain
|
||||
var/list/id_change_records = list() // List of all job transfer records
|
||||
var/list/id_change_counter = 1
|
||||
//Players who need jobs
|
||||
var/list/unassigned = list()
|
||||
//Debug info
|
||||
@@ -615,4 +617,61 @@ SUBSYSTEM_DEF(jobs)
|
||||
jobs_to_formats[job.title] = "linkEncourage" // jobs with nobody doing them at all are encouraged
|
||||
else if(job.total_positions >= 0 && job.current_positions >= job.total_positions)
|
||||
jobs_to_formats[job.title] = "linkDiscourage" // jobs that are full (no free positions) are discouraged
|
||||
return jobs_to_formats
|
||||
return jobs_to_formats
|
||||
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/log_job_transfer(transferee, oldvalue, newvalue, whodidit)
|
||||
id_change_records["[id_change_counter]"] = list("transferee" = transferee, "oldvalue" = oldvalue, "newvalue" = newvalue, "whodidit" = whodidit, "timestamp" = station_time_timestamp())
|
||||
id_change_counter++
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/fetch_transfer_record_html(var/centcom)
|
||||
var/record_html = "<TABLE border=\"1\">"
|
||||
|
||||
var/table_headers = list("Crewman", "Old Rank", "New Rank", "Authorized By", "Time")
|
||||
var/hidden_fields = list("deletedby")
|
||||
if(centcom)
|
||||
table_headers += "<span class='bad'>Deleted By</span>"
|
||||
record_html += "<TR>"
|
||||
for(var/thisheader in table_headers)
|
||||
record_html += "<TD><B>[thisheader]</B></TD>"
|
||||
record_html += "</TR>"
|
||||
|
||||
var/visible_record_count = 0
|
||||
for(var/thisid in id_change_records)
|
||||
var/thisrecord = id_change_records[thisid]
|
||||
|
||||
if(thisrecord["deletedby"] && !centcom)
|
||||
continue
|
||||
|
||||
record_html += "<TR>"
|
||||
for(var/lkey in thisrecord)
|
||||
if(lkey in hidden_fields)
|
||||
if(centcom)
|
||||
record_html += "<TD><span class='bad'>[thisrecord[lkey]]<span></TD>"
|
||||
else
|
||||
continue
|
||||
else
|
||||
record_html += "<TD>[thisrecord[lkey]]</TD>"
|
||||
record_html += "</TR>"
|
||||
visible_record_count++
|
||||
|
||||
record_html += "</TABLE>"
|
||||
|
||||
if(!visible_record_count)
|
||||
return "No records on file yet."
|
||||
return record_html
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/delete_log_records(sourceuser, delete_all)
|
||||
. = 0
|
||||
if(!sourceuser)
|
||||
return
|
||||
var/list/new_id_change_records = list()
|
||||
for(var/thisid in id_change_records)
|
||||
var/thisrecord = id_change_records[thisid]
|
||||
if(!thisrecord["deletedby"])
|
||||
if(delete_all || thisrecord["whodidit"] == sourceuser)
|
||||
thisrecord["deletedby"] = sourceuser
|
||||
.++
|
||||
new_id_change_records["[id_change_counter]"] = thisrecord
|
||||
id_change_counter++
|
||||
id_change_records = new_id_change_records
|
||||
@@ -243,6 +243,7 @@ var/time_last_changed_position = 0
|
||||
data["target_owner"] = modify && modify.registered_name ? modify.registered_name : "-----"
|
||||
data["target_rank"] = get_target_rank()
|
||||
data["scan_name"] = scan ? scan.name : "-----"
|
||||
data["scan_owner"] = scan && scan.registered_name ? scan.registered_name : null
|
||||
data["authenticated"] = is_authenticated(user)
|
||||
data["has_modify"] = !!modify
|
||||
data["account_number"] = modify ? modify.associated_account_number : null
|
||||
@@ -273,6 +274,9 @@ var/time_last_changed_position = 0
|
||||
data["cooldown_mins"] = mins
|
||||
data["cooldown_secs"] = (seconds < 10) ? "0[seconds]" : seconds
|
||||
|
||||
if(mode == 3 && is_authenticated(user))
|
||||
data["id_change_html"] = SSjobs.fetch_transfer_record_html(is_centcom())
|
||||
|
||||
if(modify)
|
||||
data["current_skin"] = modify.icon_state
|
||||
|
||||
@@ -378,11 +382,12 @@ var/time_last_changed_position = 0
|
||||
var/temp_t = sanitize(copytext(input("Enter a custom job assignment.","Assignment"),1,MAX_MESSAGE_LEN))
|
||||
//let custom jobs function as an impromptu alt title, mainly for sechuds
|
||||
if(temp_t && modify)
|
||||
SSjobs.log_job_transfer(modify.registered_name, modify.getRankAndAssignment(), temp_t, scan.registered_name)
|
||||
modify.assignment = temp_t
|
||||
log_game("[key_name(usr)] has given \"[modify.registered_name]\" the custom job title \"[temp_t]\".")
|
||||
else
|
||||
var/list/access = list()
|
||||
if(is_centcom())
|
||||
if(is_centcom() && islist(get_centcom_access(t1)))
|
||||
access = get_centcom_access(t1)
|
||||
else
|
||||
var/datum/job/jobdatum
|
||||
@@ -402,6 +407,8 @@ var/time_last_changed_position = 0
|
||||
if(t1 == "Civilian")
|
||||
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)
|
||||
|
||||
var/mob/living/carbon/human/H = modify.getPlayer()
|
||||
if(istype(H))
|
||||
if(jobban_isbanned(H, t1))
|
||||
@@ -409,6 +416,7 @@ var/time_last_changed_position = 0
|
||||
if(H.mind)
|
||||
H.mind.playtime_role = t1
|
||||
|
||||
|
||||
modify.access = access
|
||||
modify.rank = t1
|
||||
modify.assignment = t1
|
||||
@@ -438,6 +446,20 @@ var/time_last_changed_position = 0
|
||||
if("mode")
|
||||
mode = text2num(href_list["mode_target"])
|
||||
|
||||
if("wipe_my_logs")
|
||||
if(is_authenticated(usr))
|
||||
var/delcount = SSjobs.delete_log_records(scan.registered_name, FALSE)
|
||||
if(delcount)
|
||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
if("wipe_all_logs")
|
||||
if(is_authenticated(usr) && !target_dept)
|
||||
var/delcount = SSjobs.delete_log_records(scan.registered_name, TRUE)
|
||||
if(delcount)
|
||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
if("print")
|
||||
if(!printing && !target_dept)
|
||||
printing = 1
|
||||
@@ -476,6 +498,7 @@ var/time_last_changed_position = 0
|
||||
var/jobnamedata = modify.getRankAndAssignment()
|
||||
log_game("[key_name(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".")
|
||||
message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".")
|
||||
SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Terminated", scan.registered_name)
|
||||
modify.assignment = "Terminated"
|
||||
modify.access = list()
|
||||
callHook("terminate_employee", list(modify))
|
||||
@@ -496,6 +519,7 @@ var/time_last_changed_position = 0
|
||||
var/jobnamedata = modify.getRankAndAssignment()
|
||||
log_game("[key_name(usr)] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" to \"Civilian (Demoted)\".")
|
||||
message_admins("[key_name_admin(usr)] has demoted \"[modify.registered_name]\" the \"[jobnamedata]\" to \"Civilian (Demoted)\".")
|
||||
SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Demoted", scan.registered_name)
|
||||
|
||||
modify.access = access
|
||||
modify.rank = "Civilian"
|
||||
|
||||
@@ -224,11 +224,12 @@
|
||||
var/temp_t = sanitize(copytext(input("Enter a custom job assignment.","Assignment"),1,MAX_MESSAGE_LEN))
|
||||
//let custom jobs function as an impromptu alt title, mainly for sechuds
|
||||
if(temp_t && modify)
|
||||
SSjobs.log_job_transfer(modify.registered_name, modify.getRankAndAssignment(), temp_t, scan.registered_name)
|
||||
modify.assignment = temp_t
|
||||
log_game("[key_name(usr)] has given \"[modify.registered_name]\" the custom job title \"[temp_t]\".")
|
||||
else
|
||||
var/list/access = list()
|
||||
if(is_centcom)
|
||||
if(is_centcom && islist(get_centcom_access(t1)))
|
||||
access = get_centcom_access(t1)
|
||||
else
|
||||
var/datum/job/jobdatum
|
||||
@@ -248,6 +249,7 @@
|
||||
if(t1 == "Civilian")
|
||||
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)
|
||||
var/mob/living/carbon/human/H = modify.getPlayer()
|
||||
if(istype(H))
|
||||
if(jobban_isbanned(H, t1))
|
||||
@@ -277,6 +279,18 @@
|
||||
if("PRG_mode")
|
||||
mode = text2num(href_list["mode_target"])
|
||||
|
||||
if("PRG_wipe_my_logs")
|
||||
if(is_authenticated(usr))
|
||||
var/delcount = SSjobs.delete_log_records(scan.registered_name, FALSE)
|
||||
if(delcount)
|
||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||
|
||||
if("PRG_wipe_all_logs")
|
||||
if(is_authenticated(usr))
|
||||
var/delcount = SSjobs.delete_log_records(scan.registered_name, TRUE)
|
||||
if(delcount)
|
||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||
|
||||
if("PRG_print")
|
||||
if(!printing && computer)
|
||||
printing = 1
|
||||
@@ -318,6 +332,7 @@
|
||||
var/jobnamedata = modify.getRankAndAssignment()
|
||||
log_game("[key_name(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".")
|
||||
message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".")
|
||||
SSjobs.log_job_transfer(modify.registered_name, jobnamedata, "Terminated", scan.registered_name)
|
||||
modify.assignment = "Terminated"
|
||||
modify.access = list()
|
||||
callHook("terminate_employee", list(modify))
|
||||
@@ -404,6 +419,7 @@
|
||||
data["target_owner"] = modify && modify.registered_name ? modify.registered_name : "-----"
|
||||
data["target_rank"] = get_target_rank()
|
||||
data["scan_name"] = scan ? scan.name : "-----"
|
||||
data["scan_owner"] = scan && scan.registered_name ? scan.registered_name : null
|
||||
data["authenticated"] = is_authenticated(user)
|
||||
data["has_modify"] = !!modify
|
||||
data["account_number"] = modify ? modify.associated_account_number : null
|
||||
@@ -432,6 +448,9 @@
|
||||
data["cooldown_mins"] = mins
|
||||
data["cooldown_secs"] = (seconds < 10) ? "0[seconds]" : seconds
|
||||
|
||||
if(mode == 3 && is_authenticated(user))
|
||||
data["id_change_html"] = SSjobs.fetch_transfer_record_html(is_centcom)
|
||||
|
||||
if(modify)
|
||||
data["current_skin"] = modify.icon_state
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
{{:helper.link('Job Management', 'gear', {'action' : 'PRG_mode', 'mode_target' : 1}, data.mode == 1 ? 'disabled' : null)}}
|
||||
{{:helper.link('Crew Manifest', 'folder-open', {'action' : 'PRG_mode', 'mode_target' : 2}, data.mode == 2 ? 'disabled' : null)}}
|
||||
{{:helper.link('Print', 'print', {'action' : 'PRG_print'}, data.printer && (data.mode == 2 || data.has_modify && !data.mode) ? null : 'disabled')}}
|
||||
{{:helper.link('Records', 'file', {'action' : 'PRG_mode', 'mode_target' : 3}, (data.mode == 3) ? 'disabled' : null)}}
|
||||
|
||||
{{if data.mode == 1}}
|
||||
<div class='item'>
|
||||
@@ -52,6 +53,29 @@
|
||||
<div class='item'>
|
||||
{{:data.manifest}}
|
||||
</div>
|
||||
{{else data.mode == 3}}
|
||||
<div class='item'>
|
||||
<h2>Records</h2>
|
||||
</div>
|
||||
<div class='item'>
|
||||
<div class='itemLabel'>
|
||||
Authorized Identity:
|
||||
</div>
|
||||
<div class='itemContent'>
|
||||
{{:helper.link(data.scan_name, 'eject', {'action' : 'scan'})}}
|
||||
</div>
|
||||
</div>
|
||||
<div class='item'>
|
||||
{{if data.authenticated}}
|
||||
{{:data.id_change_html}}
|
||||
{{:helper.link('Delete Records By: ' + data.scan_owner, null, {'action' : 'PRG_wipe_my_logs'}, null, 'linkDanger')}}
|
||||
{{if !data.target_dept}}
|
||||
{{:helper.link('Delete ALL Records', null, {'action' : 'PRG_wipe_all_logs'}, null, 'linkDanger')}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<span class='exclamation-triangle'><i>Please insert an authorized ID into the terminal to proceed.</i></span><br>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class='item'>
|
||||
<h2>Access Modification</h2>
|
||||
@@ -152,7 +176,7 @@
|
||||
{{if data.target_rank == "Terminated"}}
|
||||
<span class='bad'>{{:data.target_owner}} has already been terminated!</span>
|
||||
{{else}}
|
||||
{{:helper.link('Terminate ' + data.target_owner, 'gear', {'choice' : 'terminate'}, data.target_rank == "Terminated" ? 'disabled' : null, data.target_rank == "Terminated" ? 'disabled' : 'linkDanger')}}
|
||||
{{:helper.link('Terminate ' + data.target_owner, 'gear', {'action' : 'PRG_terminate'}, data.target_rank == "Terminated" ? 'disabled' : null, data.target_rank == "Terminated" ? 'disabled' : 'linkDanger')}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -173,7 +197,7 @@
|
||||
<th>Special</th>
|
||||
<td>
|
||||
{{for data.top_jobs}}
|
||||
{{:helper.link(value.display_name, '', {'choice' : 'assign', 'assign_target' : value.job}, value.jlinkformat == 'disabled' ? 'disabled' : null, value.jlinkformat ? value.jlinkformat : null)}}
|
||||
{{:helper.link(value.display_name, '', {'action' : 'PRG_assign', 'assign_target' : value.job}, value.jlinkformat == 'disabled' ? 'disabled' : null, value.jlinkformat ? value.jlinkformat : null)}}
|
||||
{{/for}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
{{if !data.target_dept}}{{:helper.link('Job Management', 'gear', {'choice' : 'mode', 'mode_target' : 1}, data.mode == 1 ? 'disabled' : null)}}{{/if}}
|
||||
{{:helper.link('Crew Manifest', 'folder-open', {'choice' : 'mode', 'mode_target' : 2}, data.mode == 2 ? 'disabled' : null)}}
|
||||
{{if !data.target_dept}}{{:helper.link('Print', 'print', {'choice' : 'print'}, (data.mode == 2 || data.has_modify && !data.mode) ? null : 'disabled')}}{{/if}}
|
||||
|
||||
{{:helper.link('Records', 'file', {'choice' : 'mode', 'mode_target' : 3}, (data.mode == 3) ? 'disabled' : null)}}
|
||||
|
||||
{{if data.mode == 1 && !data.target_dept}}
|
||||
<div class='item'>
|
||||
<h2>Job Management</h2>
|
||||
@@ -52,6 +53,29 @@
|
||||
<div class='item'>
|
||||
{{:data.manifest}}
|
||||
</div>
|
||||
{{else data.mode == 3}}
|
||||
<div class='item'>
|
||||
<h2>Records</h2>
|
||||
</div>
|
||||
<div class='item'>
|
||||
<div class='itemLabel'>
|
||||
Authorized Identity:
|
||||
</div>
|
||||
<div class='itemContent'>
|
||||
{{:helper.link(data.scan_name, 'eject', {'choice' : 'scan'})}}
|
||||
</div>
|
||||
</div>
|
||||
<div class='item'>
|
||||
{{if data.authenticated}}
|
||||
{{:data.id_change_html}}
|
||||
{{:helper.link('Delete Records By: ' + data.scan_owner, null, {'choice' : 'wipe_my_logs'}, null, 'linkDanger')}}
|
||||
{{if !data.target_dept}}
|
||||
{{:helper.link('Delete ALL Records', null, {'choice' : 'wipe_all_logs'}, null, 'linkDanger')}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<span class='exclamation-triangle'><i>Please insert an authorized ID into the terminal to proceed.</i></span><br>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class='item'>
|
||||
<h2>Access Modification</h2>
|
||||
|
||||
Reference in New Issue
Block a user