diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 1ca1fe01036..c307716c374 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -238,6 +238,32 @@ proc/age2agedescription(age) if(70 to INFINITY) return "elderly" else return "unknown" +proc/set_criminal_status(mob/living/user, datum/data/record/target_records , criminal_status, comment, user_rank, var/list/authcard_access = list()) + var/status = criminal_status + var/their_name = target_records.fields["name"] + var/their_rank = target_records.fields["rank"] + switch(criminal_status) + if("arrest") + status = "*Arrest*" + if("none") + status = "None" + if("execute") + if((access_magistrate in authcard_access) || (access_armory in authcard_access)) + status = "*Execute*" + message_admins("[ADMIN_FULLMONTY(usr)] authorized EXECUTION for [their_rank] [their_name], with comment: [comment]") + else + return 0 + if("incarcerated") + status = "Incarcerated" + if("parolled") + status = "Parolled" + if("released") + status = "Released" + target_records.fields["criminal"] = status + log_admin("[key_name_admin(user)] set secstatus of [their_rank] [their_name] to [status], comment: [comment]") + target_records.fields["comments"] += "Set to [status] by [user.name] ([user_rank]) on [current_date_string] [station_time_timestamp()], comment: [comment]" + update_all_mob_security_hud() + return 1 /* Proc for attack log creation, because really why not diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index d489a559b38..a6bf35e397f 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -324,6 +324,7 @@ var/record_id_num = 1001 S.fields["notes"] = H.sec_record else S.fields["notes"] = "No notes." + S.fields["comments"] = list() security += S //Locked Record diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index e31fc239580..c0c8c2d349e 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -169,41 +169,16 @@ screen = SEC_DATA_R_LIST if("criminal") if(active2) - var/their_name = active2.fields["name"] - var/their_rank = active2.fields["rank"] var/t1 if(temp_href[2] == "execute") t1 = copytext(trim(sanitize(input("Explain why they are being executed. Include a list of their crimes, and victims.", "EXECUTION ORDER", null, null) as text)), 1, MAX_MESSAGE_LEN) else t1 = copytext(trim(sanitize(input("Enter Reason:", "Secure. records", null, null) as text)), 1, MAX_MESSAGE_LEN) - var/visible_reason - if(t1) - visible_reason = t1 - else + if(!t1) t1 = "(none)" - visible_reason = "NO REASON PROVIDED" - switch(temp_href[2]) - if("none") - active2.fields["criminal"] = "None" - if("arrest") - active2.fields["criminal"] = "*Arrest*" - if("execute") - if((access_magistrate in authcard_access) || (access_armory in authcard_access)) - active2.fields["criminal"] = "*Execute*" - message_admins("[ADMIN_FULLMONTY(usr)] authorized EXECUTION for [their_rank] [their_name], with comment: [visible_reason]") - else - setTemp("

Error: permission denied.

") - return 1 - if("incarcerated") - active2.fields["criminal"] = "Incarcerated" - if("parolled") - active2.fields["criminal"] = "Parolled" - if("released") - active2.fields["criminal"] = "Released" - var/newstatus = active2.fields["criminal"] - log_admin("[key_name_admin(usr)] set secstatus of [their_rank] [their_name] to [newstatus], comment: [t1]") - active2.fields["comments"] += "Set to [newstatus] by [usr.name] ([rank]) on [current_date_string] [station_time_timestamp()], comment: [t1]" - update_all_mob_security_hud() + if(!set_criminal_status(usr, active2, temp_href[2], t1, rank, authcard_access)) + setTemp("

Error: permission denied.

") + return 1 if("rank") if(active1) active1.fields["rank"] = temp_href[2] diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index ea51f819390..f552cfff25b 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -731,25 +731,22 @@ if(hasHUD(usr, "security") && setcriminal != "Cancel") found_record = 1 - var/their_name = R.fields["name"] - var/their_rank = R.fields["rank"] if(R.fields["criminal"] == "*Execute*") to_chat(usr, "Unable to modify the sec status of a person with an active Execution order. Use a security computer instead.") - else + else + var/rank if(ishuman(usr)) var/mob/living/carbon/human/U = usr - R.fields["comments"] += "Set to [setcriminal] by [U.get_authentification_name()] ([U.get_assignment()]) on [current_date_string] [station_time_timestamp()] with comment: [t1]
" - if(isrobot(usr)) + rank = U.get_assignment() + else if(isrobot(usr)) var/mob/living/silicon/robot/U = usr - R.fields["comments"] += "Set to [setcriminal] by [U.name] ([U.modtype] [U.braintype]) on [current_date_string] [station_time_timestamp()] with comment: [t1]
" - if(isAI(usr)) - var/mob/living/silicon/ai/U = usr - R.fields["comments"] += "Set to [setcriminal] by [U.name] (artificial intelligence) on [current_date_string] [station_time_timestamp()] with comment: [t1]
" - - R.fields["criminal"] = setcriminal - log_admin("[key_name_admin(usr)] set secstatus of [their_rank] [their_name] to [setcriminal], comment: [t1]") - spawn() - sec_hud_set_security_status() + rank = "[U.modtype] [U.braintype]" + else if(isAI(usr)) + rank = "AI" + set_criminal_status(usr, R, setcriminal, t1, rank) + break // Git out of the securiy records loop! + if(found_record) + break // Git out of the general records if(!found_record) to_chat(usr, "Unable to locate a data core entry for this person.")