Add record programs, keeps old consoles to avoid converting main maps. (#7225)

Add record printing (fixes #6042)
This commit is contained in:
Karolis
2019-12-23 09:46:15 +02:00
committed by Erki
parent c586d6a98c
commit 4e56f6e66e
21 changed files with 734 additions and 161 deletions
+64
View File
@@ -11,6 +11,7 @@
var/list/viruses
var/list/excluded_fields
var/list/localized_fields
var/manifest_json
var/list/manifest
@@ -20,6 +21,8 @@
/datum/controller/subsystem/records/Initialize()
..()
for(var/type in localized_fields)
localized_fields[type] = compute_localized_field(type)
InitializeCitizenships()
InitializeReligions()
@@ -30,6 +33,7 @@
warrants = list()
viruses = list()
excluded_fields = list()
localized_fields = list()
manifest = list()
NEW_SS_GLOBAL(SSrecords)
var/datum/D = new()
@@ -37,6 +41,49 @@
excluded_fields[v] = v
excluded_fields["cmp_field"] = "cmp_field"
excluded_fields["excluded_fields"] = "excluded_fields"
excluded_fields["excluded_print_fields"] = "excluded_print_fields"
localized_fields[/datum/record] = list(
"id" = "Id",
"notes" = "Notes"
)
localized_fields[/datum/record/general] = list(
"_parent" = /datum/record,
"name" = "Name",
"rank" = "Rank",
"age" = "Age",
"sex" = "Sex",
"fingerprint" = "Fingerprint",
"physical_status" = "Physical Status",
"mental_status" = "Mental Status",
"species" = "Species",
"citizenship" = "Citizenship",
"employer" = "",
"religion" = "Religion",
"ccia_record" = "CCIA Notes",
"notes" = "Employment/skills summary",
)
localized_fields[/datum/record/medical] = list(
"_parent" = /datum/record,
"blood_type" = "Blood type",
"blood_dna" = "DNA",
"disabilities" = "Disabilities",
"allergies" = "Allergies",
"diseases" = "Diseases",
"comments" = "Comments"
)
localized_fields[/datum/record/security] = list(
"_parent" = /datum/record,
"criminal" = "Criminal Status",
"crimes" = "Crimes",
"incidents" = "Incidents",
"comments" = "Comments"
)
localized_fields[/datum/record/virus] = list(
"_parent" = /datum/record,
"description" = "Description",
"antigen" = "",
"spread_type" = "",
)
/datum/controller/subsystem/records/proc/generate_record(var/mob/living/carbon/human/H)
if(H.mind && SSjobs.ShouldCreateRecords(H.mind))
@@ -271,3 +318,20 @@
var/datum/religion/religion = SSrecords.religions[target_religion]
if(religion)
return religion.get_records_name()
/datum/controller/subsystem/records/proc/compute_localized_field(var/type)
if(!localized_fields[type])
return
if(localized_fields[type]["_parent"])
. = compute_localized_field(localized_fields[type]["_parent"])
else
. = list()
for(var/field in localized_fields[type])
if(field == "_parent")
continue
var/value = localized_fields[type][field]
//if(istype(value))
// .[field] = compute_localized_field(value)
// continue
.[field] = value
+39 -4
View File
@@ -5,6 +5,7 @@
var/cmp_field = "id"
var/list/excluded_fields
var/list/excluded_print_fields
/datum/record/New()
..()
@@ -12,6 +13,10 @@
excluded_fields = list()
for(var/f in tmp_ex)
excluded_fields[f] = f
tmp_ex = excluded_print_fields
excluded_print_fields = list()
for(var/f in tmp_ex)
excluded_print_fields[f] = f
/datum/record/proc/Copy(var/datum/copied)
if(!copied)
@@ -60,10 +65,37 @@
else if(!to_update)
record[variable] = src.vars[variable]
/datum/record/proc/Printify(var/list/excluded = list()) // Mostyl to support old things or to use with serialization
. = ""
var/tmp_ex = excluded
excluded = list()
for(var/e in tmp_ex)
excluded[e] = e
var/exclusions = (SSrecords.excluded_fields | src.excluded_fields | excluded | src.excluded_print_fields)
var/extendedVars = list() // To put last
for(var/variable in src.vars)
if(!exclusions[variable])
if(istype(src.vars[variable], /datum/record))
extendedVars[variable] = src.vars[variable]
// . += "<h3>[variable]</h3>"
// . += src.vars[variable].Printify()
else if(istype(src.vars[variable], /list))
. += "<b>[get_field_name(variable)]:</b><br>"
. += jointext(src.vars[variable], "<br>")
else if(istext(src.vars[variable]) || isnum(src.vars[variable]))
. += "<b>[get_field_name(variable)]:</b> [src.vars[variable]]<br>"
for(var/variable in extendedVars)
. += "<center><h3>[get_field_name(variable)]</h3></center>"
. += src.vars[variable].Printify()
/datum/record/proc/get_field_name(var/field)
. = SSrecords.localized_fields[src.type][field]
if(!.)
return capitalize(replacetext(field, "_", " "))
// Record for storing general data, data tree top level datum
/datum/record/general
var/datum/record/medical/medical
var/datum/record/security/security
var/name = "New Record"
var/real_rank = "Unassigned"
var/rank = "Unassigned"
@@ -80,9 +112,12 @@
var/list/ccia_actions = list()
var/icon/photo_front
var/icon/photo_side
var/list/advanced_fields = list("species", "citizenship", "faction", "religion", "ccia_record", "ccia_actions")
var/datum/record/medical/medical
var/datum/record/security/security
var/list/advanced_fields = list("species", "citizenship", "employer", "religion", "ccia_record", "ccia_actions")
cmp_field = "name"
excluded_fields = list("photo_front", "photo_side", "advanced_fields")
excluded_fields = list("photo_front", "photo_side", "advanced_fields", "real_rank")
excluded_print_fields = list("ccia_actions")
/datum/record/general/New(var/mob/living/carbon/human/H, var/nid)
..()
+3 -1
View File
@@ -289,6 +289,8 @@
* Listener for record changes
*/
/*
/listener/record/rconsole/on_delete(var/datum/record/r)
. = FALSE
var/obj/machinery/computer/records/t = target
@@ -306,4 +308,4 @@
var/obj/machinery/computer/records/t = target
if(istype(t) && !t.isEditing)
if(t.active == r || t.active_virus == r)
SSvueui.check_uis_for_change(t)
SSvueui.check_uis_for_change(t)*/
-143
View File
@@ -1,143 +0,0 @@
//not a computer
obj/machinery/scanner
name = "Identity Analyser"
var/outputdir = 0
icon = 'icons/obj/stationobjs.dmi'
icon_state = "scanner_idle"
density = 1
anchored = 1
var/lastuser = null
obj/machinery/scanner/New()
if(!outputdir)
switch(dir)
if(1)
outputdir = 2
if(2)
outputdir = 1
if(4)
outputdir = 8
if(8)
outputdir = 4
if(!outputdir)
outputdir = 8
/obj/machinery/scanner/machinery_process()
if(stat & NOPOWER)
return
use_power(50)
/obj/machinery/scanner/power_change()
..()
if(stat & NOPOWER)
spawn(rand(0, 15))
icon_state = "scanner_off"
else
icon_state = "scanner_idle"
obj/machinery/scanner/attack_hand(mob/living/carbon/human/user)
if(stat & NOPOWER)
return
if(!ishuman(user) || lastuser == user.real_name)
return
use_power(500)
flick("scanner_on",src)
lastuser = user.real_name
var/mname = user.real_name
var/dna = user.dna.unique_enzymes
var/bloodtype = user.dna.b_type
var/fingerprint = md5(user.dna.uni_identity)
var/list/marks = list()
var/age = user.age
var/gender = user.gender
/* no dbstuff yet
var/DBQuery/cquery = dbcon.NewQuery("SELECT * from jobban WHERE ckey='[user.ckey]'")
if(!cquery.Execute()) return
else
while(cquery.NextRow())
var/list/row = cquery.GetRowData()
marks += row["rank"]
*/
var/text = {"
<font size=4><center>Report</center></font><br>
<b><u>Name</u></b>: [mname]
<b><u>Age</u></b>: [age]
<b><u>Sex</u></b>: [gender]
<b><u>DNA</u></b>: [dna]
<b><u>Blood Type</u></b>: [bloodtype]
<b><u>Fingerprint</u></b>: [fingerprint]
<b><u>Black Marks</u></b>:<br> "}
for(var/A in marks)
text += "<span class='danger'>[A]</span><br>"
to_chat(user, "<span class='notice'>You feel a sting as the scanner extracts some of your blood.</span>")
var/turf/T = get_step(src,outputdir)
var/obj/item/paper/print = new(T)
print.set_content_unsafe("[mname] Report", text)
print.stamped = 1
for(var/datum/data/record/test in data_core.general)
if (test.fields["name"] == mname)
return
var/datum/data/record/G = new()
var/datum/data/record/M = new()
var/datum/data/record/S = new()
var/datum/data/record/L = new()
G.fields["rank"] = "Unassigned"
G.fields["real_rank"] = G.fields["rank"]
G.fields["name"] = mname
G.fields["id"] = generate_record_id()
M.fields["name"] = G.fields["name"]
M.fields["id"] = G.fields["id"]
S.fields["name"] = G.fields["name"]
S.fields["id"] = G.fields["id"]
if(gender == FEMALE)
G.fields["sex"] = "Female"
else
G.fields["sex"] = "Male"
G.fields["age"] = text("[]", age)
G.fields["fingerprint"] = text("[]", fingerprint)
G.fields["p_stat"] = "Active"
G.fields["m_stat"] = "Stable"
M.fields["b_type"] = text("[]", bloodtype)
M.fields["b_dna"] = dna
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."
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."
//Begin locked reporting
L.fields["name"] = mname
L.fields["sex"] = gender
L.fields["age"] = age
L.fields["id"] = md5("[mname][user.mind.assigned_role]")
L.fields["rank"] = "Unknown"
L.fields["real_rank"] = L.fields["rank"]
L.fields["b_type"] = bloodtype
L.fields["b_dna"] = dna
L.fields["enzymes"] = user.dna.struc_enzymes
L.fields["identity"] = user.dna.uni_identity
L.fields["image"] = getFlatIcon(user,0)//What the person looks like. Naked, in this case.
//End locked reporting
data_core.general += G
data_core.medical += M
data_core.security += S
data_core.locked += L
G.inDataCore = 1
M.inDataCore = 1
S.inDataCore = 1
L.inDataCore = 1
@@ -7,6 +7,8 @@
icon = 'icons/obj/modular_laptop.dmi'
icon_state = "laptop-open"
icon_state_broken = "laptop-broken"
randpixel = 6
center_of_mass = list("x"=14, "y"=10)
base_idle_power_usage = 25
base_active_power_usage = 200
max_hardware_size = 2
@@ -22,16 +22,19 @@
// Engineering
/obj/item/modular_computer/console/preset/engineering/
name = "engineering console"
_app_preset_name = "engineering"
enrolled = 1
// Medical
/obj/item/modular_computer/console/preset/medical/
name = "medical console"
_app_preset_name = "medical"
enrolled = 1
// Research
/obj/item/modular_computer/console/preset/research/
name = "research console"
_app_preset_name = "research"
enrolled = 1
@@ -41,6 +44,7 @@
// Command
/obj/item/modular_computer/console/preset/command/
name = "command console"
_app_preset_name = "command"
enrolled = 1
@@ -52,6 +56,7 @@
card_slot = new/obj/item/computer_hardware/card_slot(src)
/obj/item/modular_computer/console/preset/captain/
name = "captain's console"
_app_preset_name = "captain"
enrolled = 1
@@ -64,16 +69,29 @@
// Security
/obj/item/modular_computer/console/preset/security/
name = "security console"
_app_preset_name = "security"
enrolled = 1
/obj/item/modular_computer/console/preset/security/investigations
name = "investigations console"
_app_preset_name = "security_inv"
enrolled = 1
/obj/item/modular_computer/console/preset/security/hos
name = "head of security's console"
_app_preset_name = "security_head"
enrolled = 1
// Civilian
/obj/item/modular_computer/console/preset/civilian/
name = "civilian console"
_app_preset_name = "civilian"
enrolled = 1
// Supply
/obj/item/modular_computer/console/preset/supply/
name = "supply console"
_app_preset_name = "supply"
enrolled = 1
@@ -0,0 +1,107 @@
/obj/item/modular_computer/laptop/preset
anchored = 0
screen_on = 0
icon_state = "laptop-closed"
/obj/item/modular_computer/laptop/preset/install_default_hardware()
..()
processor_unit = new/obj/item/computer_hardware/processor_unit(src)
hard_drive = new/obj/item/computer_hardware/hard_drive(src)
network_card = new/obj/item/computer_hardware/network_card(src)
battery_module = new/obj/item/computer_hardware/battery_module(src)
battery_module.charge_to_full()
nano_printer = new/obj/item/computer_hardware/nano_printer(src)
nano_printer.max_paper = 10
nano_printer.stored_paper = 5
/obj/item/modular_computer/laptop/preset/install_default_programs()
..()
// Engineering
/obj/item/modular_computer/laptop/preset/engineering/
name = "engineering laptop"
desc = "A portable computer belonging to the engineering department. It appears to have been used as a door stop at one point or another."
_app_preset_name = "engineering"
enrolled = 1
/obj/item/modular_computer/laptop/preset/engineering/ce/
name = "chief engineer's laptop"
desc = "A portable computer belonging to the chief engineer."
_app_preset_name = "engineering_head"
// Medical
/obj/item/modular_computer/laptop/preset/medical/
name = "medical laptop"
desc = "A portable computer belonging to the medical department."
_app_preset_name = "medical"
enrolled = 1
/obj/item/modular_computer/laptop/preset/medical/cmo/
name = "chief medical officer's laptop"
desc = "A portable computer belonging to the chief medical officer."
_app_preset_name = "medical_head"
// Research
/obj/item/modular_computer/laptop/preset/research/
name = "research laptop"
desc = "A portable computer belonging to the research department."
_app_preset_name = "research"
enrolled = 1
/obj/item/modular_computer/laptop/preset/research/install_default_hardware()
..()
ai_slot = new/obj/item/computer_hardware/ai_slot(src)
/obj/item/modular_computer/laptop/preset/research/rd/
name = "research director's laptop"
desc = "A portable computer belonging to the research director. The edges are stained and partially melted."
_app_preset_name = "research_head"
// Command
/obj/item/modular_computer/laptop/preset/command/
name = "command laptop"
_app_preset_name = "command"
enrolled = 1
/obj/item/modular_computer/laptop/preset/command/hop/
name = "head of personnel's laptop"
desc = "A portable computer beloning to the head of personnel. The fan is filled with dog hair."
_app_preset_name = "command_hop"
/obj/item/modular_computer/laptop/preset/command/captain/
name = "captain's laptop"
desc = "A portable computer belonging to the captain."
_app_preset_name = "captain"
// Security
/obj/item/modular_computer/laptop/preset/security/
name = "security laptop"
desc = "A portable computer belonging to the security department."
_app_preset_name = "security"
enrolled = 1
/obj/item/modular_computer/laptop/preset/security/hos/
name = "head of security's laptop"
desc = "A portable computer belonging to the head of security. It smells faintly of gunpowder."
_app_preset_name = "security_head"
// Civilian
/obj/item/modular_computer/laptop/preset/civilian/
_app_preset_name = "civilian"
enrolled = 1
// Supply
/obj/item/modular_computer/laptop/preset/supply/
name = "supply laptop"
desc = "A portable computer belonging to cargo."
_app_preset_name = "supply"
enrolled = 1
// Representative
/obj/item/modular_computer/laptop/preset/representative/
name = "representative's laptop"
desc = "A portable computer belonging to the representative's office."
_app_preset_name = "representative"
enrolled = 1
@@ -37,6 +37,28 @@
)
return _prg_list
/datum/modular_computer_app_presets/engineering/ce
name = "engineering_head"
display_name = "Engineering - CE"
description = "Contains the most common engineering programs and command software."
available = 0
/datum/modular_computer_app_presets/engineering/ce/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/power_monitor(),
new/datum/computer_file/program/alarm_monitor(),
new/datum/computer_file/program/atmos_control(),
new/datum/computer_file/program/rcon_console(),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/lighting_control(),
new/datum/computer_file/program/comm(),
new/datum/computer_file/program/records/employment()
)
return _prg_list
/datum/modular_computer_app_presets/medical
name = "medical"
display_name = "Medical"
@@ -47,7 +69,25 @@
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/suit_sensors()
new/datum/computer_file/program/suit_sensors(),
new/datum/computer_file/program/records/medical()
)
return _prg_list
/datum/modular_computer_app_presets/medical/cmo
name = "medical_head"
display_name = "Medical - CMO"
description = "Contains the most common medical programs and command software."
available = 0
/datum/modular_computer_app_presets/medical/cmo/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/suit_sensors(),
new/datum/computer_file/program/comm(),
new/datum/computer_file/program/records/employment(),
new/datum/computer_file/program/records/medical()
)
return _prg_list
@@ -66,6 +106,24 @@
)
return _prg_list
/datum/modular_computer_app_presets/research/rd
name = "research_head"
display_name = "Research - RD"
description = "Contains the most common research programs and command software."
available = 0
/datum/modular_computer_app_presets/research/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/ntnetmonitor(),
new/datum/computer_file/program/aidiag(),
//new/datum/computer_file/program/exosuit_monitor(),
new/datum/computer_file/program/comm(1),
new/datum/computer_file/program/records/employment()
)
return _prg_list
/datum/modular_computer_app_presets/command
name = "command"
display_name = "Command"
@@ -77,7 +135,26 @@
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/card_mod(),
new/datum/computer_file/program/comm(1)
new/datum/computer_file/program/comm(1),
new/datum/computer_file/program/records/employment()
)
return _prg_list
/datum/modular_computer_app_presets/command/hop
name = "command_hop"
display_name = "Command - HoP"
description = "Contains the most common command programs."
available = 0
/datum/modular_computer_app_presets/command/hop/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/civilian/cargocontrol(),
new/datum/computer_file/program/card_mod(),
new/datum/computer_file/program/comm(),
new/datum/computer_file/program/records/employment(),
new/datum/computer_file/program/records/security()
)
return _prg_list
@@ -91,12 +168,15 @@
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/card_mod(),
new/datum/computer_file/program/comm(1,1),
new/datum/computer_file/program/comm(1),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/digitalwarrant(),
new/datum/computer_file/program/civilian/cargocontrol(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/alarm_monitor()
new/datum/computer_file/program/alarm_monitor(),
new/datum/computer_file/program/records/employment(),
new/datum/computer_file/program/records/medical(),
new/datum/computer_file/program/records/security()
)
return _prg_list
@@ -112,7 +192,45 @@
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/comm(),
new/datum/computer_file/program/digitalwarrant()
new/datum/computer_file/program/digitalwarrant(),
new/datum/computer_file/program/records/security(),
new/datum/computer_file/program/records/employment()
)
return _prg_list
/datum/modular_computer_app_presets/security/investigations
name = "security_inv"
display_name = "Security - Investigations"
description = "Contains the most common security and forensics programs."
available = 0
/datum/modular_computer_app_presets/security/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/digitalwarrant(),
new/datum/computer_file/program/records/security(),
new/datum/computer_file/program/records/employment(),
new/datum/computer_file/program/records/medical()
)
return _prg_list
/datum/modular_computer_app_presets/security/hos
name = "security_head"
display_name = "Security - HoS"
description = "Contains the most common security programs and command software."
available = 0
/datum/modular_computer_app_presets/security/hos/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/camera_monitor(),
new/datum/computer_file/program/comm(),
new/datum/computer_file/program/digitalwarrant(),
new/datum/computer_file/program/records/security(),
new/datum/computer_file/program/comm(1),
new/datum/computer_file/program/records/employment()
)
return _prg_list
@@ -159,6 +277,21 @@
)
return _prg_list
/datum/modular_computer_app_presets/representative
name = "representative"
display_name = "Representative"
description = "Contains software intended for representatives."
available = 0
/datum/modular_computer_app_presets/representative/return_install_programs()
var/list/_prg_list = list(
new/datum/computer_file/program/filemanager(),
new/datum/computer_file/program/chatclient(),
new/datum/computer_file/program/game/sudoku(),
new/datum/computer_file/program/civilian/cargoorder(),
new/datum/computer_file/program/records/employment()
)
return _prg_list
/datum/modular_computer_app_presets/wall_generic
name = "wallgeneric"
display_name = "Wall - Generic"
@@ -201,7 +334,8 @@
new/datum/computer_file/program/suit_sensors(),
new/datum/computer_file/program/alarm_monitor(),
new/datum/computer_file/program/lighting_control(),
new/datum/computer_file/program/aidiag()
new/datum/computer_file/program/aidiag(),
new/datum/computer_file/program/records()
)
return _prg_list
@@ -0,0 +1,340 @@
/datum/computer_file/program/records
filename = "record"
filedesc = "Records"
extended_desc = "Used to view, edit and maintain records."
program_icon_state = "generic"
color = LIGHT_COLOR_BLUE
available_on_ntnet = 0
size = 6
requires_ntnet = 1
requires_ntnet_feature = NTNET_SYSTEMCONTROL
requires_access_to_run = PROGRAM_ACCESS_LIST_ONE
var/records_type = RECORD_GENERAL | RECORD_MEDICAL | RECORD_SECURITY | RECORD_VIRUS | RECORD_WARRANT | RECORD_LOCKED
var/edit_type = RECORD_GENERAL | RECORD_MEDICAL | RECORD_SECURITY | RECORD_VIRUS | RECORD_WARRANT | RECORD_LOCKED
var/datum/record/general/active
var/datum/record/virus/active_virus
var/listener/record/rconsole/listener
var/isEditing = FALSE
var/authenticated = 0
var/default_screen = "general"
var/record_prefix = ""
var/typechoices = list(
"physical_status" = list("Active", "*Deceased*", "*SSD*", "Physically Unfit", "Disabled"),
"mental_status" = list("Stable", "*Insane*", "*Unstable*", "*Watch*"),
"medical" = list(
"blood_type" = list("A-", "B-", "AB-", "O-", "A+", "B+", "AB+", "O+")
)
)
/datum/computer_file/program/records/medical
filename = "medrec"
filedesc = "Medical records"
extended_desc = "Used to view, edit and maintain medical records."
record_prefix = "Medical "
required_access_run = list(access_medical_equip, access_forensics_lockers, access_detective, access_hop)
required_access_download = access_heads
available_on_ntnet = 1
records_type = RECORD_MEDICAL | RECORD_VIRUS
edit_type = RECORD_MEDICAL
default_screen = "medical"
program_icon_state = "medical_record"
color = LIGHT_COLOR_CYAN
/datum/computer_file/program/records/security
filename = "secrec"
filedesc = "Security records"
extended_desc = "Used to view, edit and maintain security records"
record_prefix = "Security "
required_access_run = list(access_security, access_forensics_lockers, access_lawyer, access_hop)
required_access_download = access_heads
available_on_ntnet = 1
records_type = RECORD_SECURITY
edit_type = RECORD_SECURITY
default_screen = "security"
program_icon_state = "security_record"
color = LIGHT_COLOR_RED
/datum/computer_file/program/records/employment
filename = "emprec"
filedesc = "Employment records"
extended_desc = "Used to view, edit and maintain employment records."
record_prefix = "Employment "
required_access_run = list(access_security, access_forensics_lockers, access_lawyer, access_hop)
required_access_download = access_heads
available_on_ntnet = 1
records_type = RECORD_GENERAL | RECORD_SECURITY
edit_type = RECORD_GENERAL
program_icon_state = "employment_record"
color = LIGHT_COLOR_BLUE
/datum/computer_file/program/records/New()
. = ..()
listener = new(src)
/datum/computer_file/program/records/ui_interact(mob/user as mob)
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
if (!ui)
ui = new /datum/vueui/modularcomputer(user, src, "records-main", 450, 520, filedesc)
if(!authenticated)
ui.activeui = "records-login"
ui.open()
/datum/computer_file/program/records/vueui_transfer(oldobj)
var/ui_name = "records-main"
if(!authenticated)
ui_name = "records-login"
SSvueui.transfer_uis(oldobj, src, ui_name, 450, 520, filedesc)
return TRUE
/datum/computer_file/program/records/vueui_data_change(list/data, mob/user, datum/vueui/ui)
if(!data)
. = data = list(
"activeview" = "list",
"defaultview" = default_screen,
"editingvalue" = "",
"choices" = typechoices
)
var/headerdata = get_header_data(data["_PC"])
if(headerdata)
data["_PC"] = headerdata
. = data
if(!authenticated)
VUEUI_SET_CHECK(ui.activeui, "records-login", ., data)
else
VUEUI_SET_CHECK(ui.activeui, "records-main", ., data)
VUEUI_SET_CHECK(data["canprint"], !!(computer?.nano_printer), ., data)
VUEUI_SET_CHECK(data["avaivabletypes"], records_type, ., data)
VUEUI_SET_CHECK(data["editable"], edit_type, ., data)
LAZYINITLIST(data["allrecords"])
LAZYINITLIST(data["allrecords_locked"])
LAZYINITLIST(data["record_viruses"])
if(authenticated)
if(data["allrecords"].len != SSrecords.records.len)
data["allrecords"].Cut()
for(var/tR in sortRecord(SSrecords.records))
var/datum/record/general/R = tR
LAZYINITLIST(data["allrecords"][R.id])
VUEUI_SET_CHECK(data["allrecords"][R.id]["id"], R.id, ., data)
VUEUI_SET_CHECK(data["allrecords"][R.id]["name"], R.name, ., data)
VUEUI_SET_CHECK(data["allrecords"][R.id]["rank"], R.rank, ., data)
VUEUI_SET_CHECK(data["allrecords"][R.id]["sex"], R.sex, ., data)
VUEUI_SET_CHECK(data["allrecords"][R.id]["age"], R.age, ., data)
VUEUI_SET_CHECK(data["allrecords"][R.id]["fingerprint"], R.fingerprint, ., data)
if(R.medical)
VUEUI_SET_CHECK(data["allrecords"][R.id]["blood"], R.medical.blood_type, ., data)
VUEUI_SET_CHECK(data["allrecords"][R.id]["dna"], R.medical.blood_dna, ., data)
if(records_type & RECORD_LOCKED)
if(data["allrecords_locked"].len != SSrecords.records_locked.len)
data["allrecords_locked"].Cut()
for(var/tR in sortRecord(SSrecords.records_locked))
var/datum/record/general/R = tR
LAZYINITLIST(data["allrecords_locked"][R.id])
VUEUI_SET_CHECK(data["allrecords_locked"][R.id]["id"], R.id, ., data)
VUEUI_SET_CHECK(data["allrecords_locked"][R.id]["name"], R.name, ., data)
VUEUI_SET_CHECK(data["allrecords_locked"][R.id]["rank"], R.rank, ., data)
if(records_type & RECORD_VIRUS)
if(data["record_viruses"].len != SSrecords.viruses.len)
data["record_viruses"].Cut()
for(var/tR in sortRecord(SSrecords.viruses))
var/datum/record/virus/R = tR
LAZYINITLIST(data["record_viruses"]["[R.id]"])
VUEUI_SET_CHECK(data["record_viruses"]["[R.id]"]["id"], R.id, ., data)
VUEUI_SET_CHECK(data["record_viruses"]["[R.id]"]["name"], R.name, ., data)
if(active_virus)
var/returned = active_virus.Listify(1, list(), data["active_virus"])
if(returned)
data["active_virus"] = returned
. = data
else
if(data["activeview"] == "virus")
VUEUI_SET_CHECK(data["activeview"], "list", ., data)
VUEUI_SET_CHECK(data["active_virus"], 0, ., data)
if(active)
if(!ui.assets["front"] || !ui.assets["side"])
ui.add_asset("front", active.photo_front)
ui.add_asset("side", active.photo_side)
var/excluded = list()
if(!(records_type & RECORD_GENERAL))
excluded += active.advanced_fields
if(!(records_type & RECORD_SECURITY))
excluded += "security"
if(!(records_type & RECORD_MEDICAL))
excluded += "medical"
var/returned = active.Listify(1, excluded, data["active"])
if(returned)
data["active"] = returned
. = data
else
if(data["activeview"] in list("general", "medical", "security"))
VUEUI_SET_CHECK(data["activeview"], "list", ., data)
VUEUI_SET_CHECK(data["active"], 0, ., data)
else
VUEUI_SET_CHECK(data["active_virus"], 0, ., data)
VUEUI_SET_CHECK(data["active"], 0, ., data)
/datum/computer_file/program/records/Topic(href, href_list)
if(..())
return 1
var/datum/vueui/ui = href_list["vueui"]
if(!istype(ui))
return
if(href_list["login"])
if(can_run(usr, TRUE))
authenticated = TRUE
else
to_chat(usr, "[src] beeps: Access Denied")
SSvueui.check_uis_for_change(src)
if(href_list["logout"])
authenticated = 0
active = null
active_virus = null
ui.remove_asset("front")
ui.remove_asset("side")
ui.data = null
SSvueui.check_uis_for_change(src)
if(!authenticated)
return
if(href_list["setactive"])
active = SSrecords.find_record("id", href_list["setactive"])
if(active)
ui.add_asset("front", active.photo_front)
ui.add_asset("side", active.photo_side)
ui.send_asset("front")
ui.send_asset("side")
else
ui.remove_asset("front")
ui.remove_asset("side")
SSvueui.check_uis_for_change(src)
if(href_list["setactive_locked"] && (records_type & RECORD_LOCKED))
active = SSrecords.find_record("id", href_list["setactive_locked"], RECORD_GENERAL | RECORD_LOCKED)
SSvueui.check_uis_for_change(src)
if(href_list["setactive_virus"] && (records_type & RECORD_VIRUS))
active_virus = SSrecords.find_record("id", text2num(href_list["setactive_virus"]), RECORD_VIRUS)
SSvueui.check_uis_for_change(src)
if(href_list["editrecord"])
var/list/key = href_list["editrecord"]["key"]
var/value = sanitize(href_list["editrecord"]["value"], encode = 0, extra = 0)
if(key.len >= 2 && canEdit(key))
if(isnum(obj_query_get(null, src, null, key)))
value = text2num(value)
isEditing = TRUE
obj_query_set(null, src, value, null, key)
obj_query_set(null, ui.data, value, null, key)
SSrecords.onModify(vars[key[1]])
isEditing = FALSE
. = TRUE
if(href_list["deleterecord"])
if(canEdit(list("active", "name")))
var/confirm = alert("Are you sure you want to delete this record?", "Confirm Deletion", "No", "Yes")
if(confirm == "Yes")
isEditing = TRUE
SSrecords.remove_record(active)
ui.data["allrecords"] -= active.id
active = null
ui.data["activeview"] = default_screen
isEditing = FALSE
SSvueui.check_uis_for_change(src)
if(href_list["newrecord"])
if(edit_type & RECORD_GENERAL)
active = new /datum/record/general()
SSrecords.add_record(active)
ui.add_asset("front", active.photo_front)
ui.add_asset("side", active.photo_side)
ui.send_asset("front")
ui.send_asset("side")
SSvueui.check_uis_for_change(src)
if(href_list["addtorecord"])
var/list/key = href_list["addtorecord"]["key"]
var/value = sanitize(href_list["addtorecord"]["value"], encode = 0, extra = 0)
if(key.len >= 2 && canEdit(key))
isEditing = TRUE
obj_query_set(null, src, obj_query_get(null, src, null, key) + value, null, key)
obj_query_set(null, ui.data, obj_query_get(null, ui.data, null, key) + value, null, key)
SSrecords.onModify(vars[key[1]])
isEditing = FALSE
. = TRUE
if(href_list["removefromrecord"])
var/list/key = href_list["removefromrecord"]["key"]
var/value = sanitize(href_list["removefromrecord"]["value"], encode = 0, extra = 0)
if(key.len >= 2 && canEdit(key))
isEditing = TRUE
obj_query_set(null, src, obj_query_get(null, src, null, key) - value, null, key)
obj_query_set(null, ui.data, obj_query_get(null, ui.data, null, key) - value, null, key)
SSrecords.onModify(vars[key[1]])
isEditing = FALSE
. = TRUE
if(href_list["print"])
if(!(href_list["print"] in list("active", "active_virus")))
return
if(computer?.nano_printer && vars[href_list["print"]])
var/excluded = list()
if(href_list["print"] == "active")
if(!(records_type & RECORD_GENERAL))
excluded += active.advanced_fields
if(!(records_type & RECORD_SECURITY))
excluded += "security"
if(!(records_type & RECORD_MEDICAL))
excluded += "medical"
var/out = vars[href_list["print"]].Printify(excluded)
computer.nano_printer.print_text(out, "[record_prefix]Record ([vars[href_list["print"]].name])")
/datum/computer_file/program/records/proc/canEdit(list/key)
if(!(key[1] in list("active", "active_virus")))
return FALSE
if(vars[key[1]] == null)
return FALSE
if(key[1] == "active_virus" && !(edit_type & RECORD_VIRUS))
return FALSE
if(key[1] == "active")
switch(key[2])
if("security")
if(!(edit_type & RECORD_SECURITY))
return FALSE
if("medical")
if(!(edit_type & RECORD_MEDICAL))
return FALSE
else
if(key.len == 2 && !(edit_type & RECORD_GENERAL))
return FALSE
return TRUE
/*
* Listener for record changes
*/
/listener/record/rconsole/on_delete(var/datum/record/r)
. = FALSE
var/datum/computer_file/program/records/t = target
if(istype(t) && !t.isEditing)
if(t.active == r)
t.active = null
. = TRUE
if(t.active_virus == r)
t.active_virus = null
. = TRUE
if(.)
SSvueui.check_uis_for_change(t)
/listener/record/rconsole/on_modify(var/datum/record/r)
var/datum/computer_file/program/records/t = target
if(istype(t) && !t.isEditing)
if(t.active == r || t.active_virus == r)
SSvueui.check_uis_for_change(t)
@@ -25,6 +25,7 @@
if(damage > damage_malfunction)
text_to_print = stars(text_to_print, 100-malfunction_probability)
var/obj/item/paper/P = new /obj/item/paper(get_turf(holder2),text_to_print, paper_title)
P.info = text_to_print
if (paper_color)
P.color = paper_color
-1
View File
@@ -54,7 +54,6 @@
if(title)
name = title
if (text && length(text))
info = html_encode(text)
info = parsepencode(text)
else
info = ""