mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-17 20:47:29 +00:00
It will search list/L for a /datum/data/record with fields[field] == value, and return it. This removes a vast amount of copypasta (there's still so much left in there though). It also removes all the locate(\ref[record]) I could find, which were normal used with topic(), meaning it was susceptible to abuse. Secbots, ed209s and turrets are now smarter with their record-checks. They now prefer to use our face-name rather than id-name. ICly, this is the bot using facial recognition. This fixes an issue where it'd try to use the name variable which could be in the format "Unknown (as their id name)" when they were disfigured, etc. causing record-lookup to fail. Additionally, these bots will treat those without a valid record in the security database, to be treated like criminals.
85 lines
2.7 KiB
Plaintext
85 lines
2.7 KiB
Plaintext
|
|
/obj/effect/datacore/proc/manifest(var/nosleep = 0)
|
|
spawn()
|
|
if(!nosleep)
|
|
sleep(40)
|
|
for(var/mob/living/carbon/human/H in player_list)
|
|
manifest_inject(H)
|
|
return
|
|
|
|
/obj/effect/datacore/proc/manifest_modify(var/name, var/assignment)
|
|
var/datum/data/record/foundrecord = find_record("name", name, data_core.general)
|
|
if(foundrecord)
|
|
foundrecord.fields["rank"] = assignment
|
|
|
|
var/record_id_num = 1001
|
|
/obj/effect/datacore/proc/manifest_inject(var/mob/living/carbon/human/H)
|
|
if(H.mind && (H.mind.assigned_role != "MODE"))
|
|
var/assignment
|
|
if(H.mind.assigned_role)
|
|
assignment = H.mind.assigned_role
|
|
else if(H.job)
|
|
assignment = H.job
|
|
else
|
|
assignment = "Unassigned"
|
|
|
|
var/id = num2hex(record_id_num++,6)
|
|
|
|
//These records should ~really~ be merged or something
|
|
//General Record
|
|
var/datum/data/record/G = new()
|
|
G.fields["id"] = id
|
|
G.fields["name"] = H.real_name
|
|
G.fields["rank"] = assignment
|
|
G.fields["age"] = H.age
|
|
G.fields["fingerprint"] = md5(H.dna.uni_identity)
|
|
G.fields["p_stat"] = "Active"
|
|
G.fields["m_stat"] = "Stable"
|
|
G.fields["sex"] = H.gender
|
|
general += G
|
|
|
|
//Medical Record
|
|
var/datum/data/record/M = new()
|
|
M.fields["id"] = id
|
|
M.fields["name"] = H.real_name
|
|
M.fields["blood_type"] = H.blood_type
|
|
M.fields["b_dna"] = H.dna.unique_enzymes
|
|
M.fields["mi_dis"] = "None"
|
|
M.fields["mi_dis_d"] = "No minor disabilities have been declared."
|
|
M.fields["ma_dis"] = "None"
|
|
M.fields["ma_dis_d"] = "No major disabilities have been diagnosed."
|
|
M.fields["alg"] = "None"
|
|
M.fields["alg_d"] = "No allergies have been detected in this patient."
|
|
M.fields["cdi"] = "None"
|
|
M.fields["cdi_d"] = "No diseases have been diagnosed at the moment."
|
|
M.fields["notes"] = "No notes."
|
|
medical += M
|
|
|
|
//Security Record
|
|
var/datum/data/record/S = new()
|
|
S.fields["id"] = id
|
|
S.fields["name"] = H.real_name
|
|
S.fields["criminal"] = "None"
|
|
S.fields["mi_crim"] = "None"
|
|
S.fields["mi_crim_d"] = "No minor crime convictions."
|
|
S.fields["ma_crim"] = "None"
|
|
S.fields["ma_crim_d"] = "No major crime convictions."
|
|
S.fields["notes"] = "No notes."
|
|
security += S
|
|
|
|
//Locked Record
|
|
var/datum/data/record/L = new()
|
|
L.fields["id"] = md5("[H.real_name][H.mind.assigned_role]") //surely this should just be id, like the others?
|
|
L.fields["name"] = H.real_name
|
|
L.fields["rank"] = H.mind.assigned_role
|
|
L.fields["age"] = H.age
|
|
L.fields["sex"] = H.gender
|
|
L.fields["blood_type"] = H.blood_type
|
|
L.fields["b_dna"] = H.dna.unique_enzymes
|
|
L.fields["enzymes"] = H.dna.struc_enzymes
|
|
L.fields["identity"] = H.dna.uni_identity
|
|
L.fields["image"] = getFlatIcon(H,0) //This is god-awful
|
|
locked += L
|
|
return
|
|
|