Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crowbar764 committed Oct 7, 2023
1 parent ddf684a commit 7f6e95b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
42 changes: 21 additions & 21 deletions code/game/machinery/computer/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
icon_state = "security"
req_access = list(ACCESS_MARINE_BRIG)
circuit = /obj/item/circuitboard/computer/secure_data
var/obj/item/device/clue_scanner/scanner = null
var/obj/item/device/clue_scanner/scanner

// For optimisation, we keep track of the viewed record and only send detailed data for it.
var/active_record_ref= null
var/datum/data/record/active_record_general = null
var/datum/data/record/active_record_security = null
var/active_record_ref
var/datum/data/record/active_record_general
var/datum/data/record/active_record_security

/obj/structure/machinery/computer/secure_data/attackby(obj/item/held_object as obj, user as mob)
if(istype(held_object, /obj/item/device/clue_scanner) && !scanner)
Expand Down Expand Up @@ -160,11 +160,11 @@
if (!sanity_check(params["ref"]))
return

var/sanitised_name = reject_bad_name(tgui_input_text(usr, "Enter a new name", "New Name", active_record_general.fields["name"]))
var/sanitised_name = reject_bad_name(tgui_input_text(ui.user, "Enter a new name", "New Name", active_record_general.fields["name"]))
if (!sanitised_name || !sanity_check(params["ref"]))
return

message_admins("[key_name(usr)] has changed the record name of [active_record_general.fields["name"]] to [sanitised_name]")
message_admins("[key_name(ui.user)] has changed the record name of [active_record_general.fields["name"]] to [sanitised_name]")
active_record_general.fields["name"] = sanitised_name

if("toggle_sex")
Expand All @@ -183,7 +183,7 @@
// New records have a string in their age field which will break this input.
var/default_age = active_record_general.fields["age"] == "Unknown" ? 0 : active_record_general.fields["age"]

var/input = tgui_input_number(usr, "Enter a new age", "New Age", default_age, AGE_MAX, AGE_MIN)
var/input = tgui_input_number(ui.user, "Enter a new age", "New Age", default_age, AGE_MAX, AGE_MIN)
if (!input || !sanity_check(params["ref"]))
return

Expand All @@ -209,20 +209,20 @@
if (!istype(active_record_security, /datum/data/record) || !sanity_check(params["ref"]))
return

var/input = tgui_input_text(usr, "Your name and time will be added to this new comment", "New Comment", multiline = TRUE)
var/input = tgui_input_text(ui.user, "Your name and time will be added to this new comment", "New Comment", multiline = TRUE)
if (!input || !istype(active_record_security, /datum/data/record) || !sanity_check(params["ref"]))
return

var/created_at = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), game_year)

var/created_by_name = ""
var/created_by_rank = ""
if(istype(usr, /mob/living/carbon/human))
var/mob/living/carbon/human/human = usr
if(istype(ui.user, /mob/living/carbon/human))
var/mob/living/carbon/human/human = ui.user
created_by_name = human.get_authentification_name()
created_by_rank = human.get_assignment()
else if(istype(usr, /mob/living/silicon/robot))
var/mob/living/silicon/robot/robot = usr
else if(istype(ui.user, /mob/living/silicon/robot))
var/mob/living/silicon/robot/robot = ui.user
created_by_name = robot.name
created_by_rank = "[robot.modtype] [robot.braintype]"

Expand All @@ -237,14 +237,14 @@

active_record_security.fields["comments"] += list(new_comment)

to_chat(usr, text("You have added a new comment to the Security Record of [].", active_record_security.fields["name"]))
to_chat(ui.user, text("You have added a new comment to the Security Record of [].", active_record_security.fields["name"]))

if("edit_comment")
if (!istype(active_record_security, /datum/data/record) || !sanity_check(params["ref"]))
return

var/old_content = active_record_security.fields["comments"][params["comment_id"]]["entry"]
var/new_comment = tgui_input_text(usr, "Edit the comment", "Edit Comment", html_decode(old_content), multiline = TRUE)
var/new_comment = tgui_input_text(ui.user, "Edit the comment", "Edit Comment", html_decode(old_content), multiline = TRUE)
if (!new_comment || !istype(active_record_security, /datum/data/record) || !sanity_check(params["ref"]))
return

Expand All @@ -255,19 +255,19 @@
return

var/deleter = ""
if (istype(usr, /mob/living/carbon/human))
var/mob/living/carbon/human/human = usr
if (istype(ui.user, /mob/living/carbon/human))
var/mob/living/carbon/human/human = ui.user
deleter = "[human.get_authentification_name()] ([human.get_assignment()])"
else if (istype(usr, /mob/living/silicon/robot))
var/mob/living/silicon/robot/robot = usr
else if (istype(ui.user, /mob/living/silicon/robot))
var/mob/living/silicon/robot/robot = ui.user
deleter = "[robot.name] ([robot.modtype] [robot.braintype])"

var/deleted_at = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), game_year)

active_record_security.fields["comments"][params["comment_id"]]["deleted_by"] = deleter
active_record_security.fields["comments"][params["comment_id"]]["deleted_at"] = deleted_at

to_chat(usr, text("You have deleted a comment from the Security Record of [].", active_record_security.fields["name"]))
to_chat(ui.user, text("You have deleted a comment from the Security Record of [].", active_record_security.fields["name"]))

if ("print_active_record")
if (!istype(active_record_general, /datum/data/record))
Expand All @@ -287,7 +287,7 @@
if (!scanner || !length(scanner.print_list))
return

var/obj/item/paper/fingerprint/print_paper = new /obj/item/paper/fingerprint(src, null, scanner.print_list)
var/obj/item/paper/fingerprint/print_paper = new(src, null, scanner.print_list)
print_paper.forceMove(loc)
var/refkey = ""
for(var/obj/effect/decal/prints/print as anything in scanner.print_list)
Expand All @@ -305,7 +305,7 @@
scanner = null
update_static_data_for_all_viewers()

add_fingerprint(usr)
add_fingerprint(ui.user)
updateUsrDialog()
. = TRUE

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/sentencing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@
var/datum/data/record/found_record = R

var/list/charge_list = list()
for(var/datum/law/L in incident.charges)
charge_list += L.name
for(var/datum/law/law in incident.charges)
charge_list += law.name

found_record.fields["incidents"] += list(list("crimes" = charge_list, "summary" = incident.notes))

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@

for(var/datum/data/record/security_record as anything in GLOB.data_core.security)
if(security_record.fields["id"] != general_record.fields["id"])
return
continue


var/text = "<br><b>Name:</b> [security_record.fields["name"]]<br><br><b>Criminal Status:</b> [security_record.fields["criminal"]]<br><br>"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/filingcabinet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
if(!security_record)
continue

var/obj/item/paper/paper = new /obj/item/paper(src)
var/obj/item/paper/paper = new(src)
paper.name = "Security Record ([general_record.fields["name"]])"
paper.info = "<CENTER><B>Security Record</B></CENTER><BR>"
paper.info += "Name: [general_record.fields["name"]] ID: [general_record.fields["id"]]<BR>\nSex: [general_record.fields["sex"]]<BR>\nAge: [general_record.fields["age"]]<BR>\nPhysical Status: [general_record.fields["p_stat"]]<BR>\nMental Status: [general_record.fields["m_stat"]]<BR>"
Expand Down

0 comments on commit 7f6e95b

Please sign in to comment.