-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Copy pathmedical.dm
159 lines (130 loc) · 4.22 KB
/
medical.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/obj/machinery/computer/records/medical
name = "medical records console"
desc = "This can be used to check medical records."
icon_screen = "medcomp"
icon_keyboard = "med_key"
req_one_access = list(ACCESS_MEDICAL, ACCESS_DETECTIVE, ACCESS_GENETICS)
circuit = /obj/item/circuitboard/computer/med_data
light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/records/medical/syndie
icon_keyboard = "syndie_key"
req_one_access = list(ACCESS_SYNDICATE)
/obj/machinery/computer/records/medical/laptop
name = "medical laptop"
desc = "A cheap Nanotrasen medical laptop, it functions as a medical records computer. It's bolted to the table."
icon_state = "laptop"
icon_screen = "medlaptop"
icon_keyboard = "laptop_key"
pass_flags = PASSTABLE
/obj/machinery/computer/records/medical/attacked_by(obj/item/attacking_item, mob/living/user)
. = ..()
if(!istype(attacking_item, /obj/item/photo))
return
insert_new_record(user, attacking_item)
/obj/machinery/computer/records/medical/ui_interact(mob/user, datum/tgui/ui)
. = ..()
if(.)
return
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
create_character_preview_view(user)
ui = new(user, src, "MedicalRecords")
ui.set_autoupdate(FALSE)
ui.open()
/obj/machinery/computer/records/medical/ui_data(mob/user)
var/list/data = ..()
var/list/records = list()
for(var/datum/record/crew/target in GLOB.manifest.general)
var/list/notes = list()
for(var/datum/medical_note/note in target.medical_notes)
notes += list(list(
author = note.author,
content = note.content,
note_ref = REF(note),
time = note.time,
))
records += list(list(
age = target.age,
blood_type = target.blood_type,
crew_ref = REF(target),
dna = target.dna_string,
gender = target.gender,
major_disabilities = target.major_disabilities_desc,
minor_disabilities = target.minor_disabilities_desc,
physical_status = target.physical_status,
mental_status = target.mental_status,
name = target.name,
notes = notes,
quirk_notes = target.quirk_notes,
rank = target.rank,
species = target.species,
))
data["records"] = records
return data
/obj/machinery/computer/records/medical/ui_static_data(mob/user)
var/list/data = list()
data["min_age"] = AGE_MIN
data["max_age"] = AGE_MAX
data["physical_statuses"] = PHYSICAL_STATUSES
data["mental_statuses"] = MENTAL_STATUSES
return data
/obj/machinery/computer/records/medical/ui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
return
var/datum/record/crew/target
if(params["crew_ref"])
target = locate(params["crew_ref"]) in GLOB.manifest.general
if(!target)
return FALSE
switch(action)
if("add_note")
if(!params["content"])
return FALSE
var/content = trim(params["content"], MAX_MESSAGE_LEN)
var/datum/medical_note/new_note = new(usr.name, content)
while(length(target.medical_notes) > 2)
target.medical_notes.Cut(1, 2)
target.medical_notes += new_note
return TRUE
if("delete_note")
var/datum/medical_note/old_note = locate(params["note_ref"]) in target.medical_notes
if(!old_note)
return FALSE
target.medical_notes -= old_note
qdel(old_note)
return TRUE
if("set_physical_status")
var/physical_status = params["physical_status"]
if(!physical_status || !(physical_status in PHYSICAL_STATUSES))
return FALSE
target.physical_status = physical_status
return TRUE
if("set_mental_status")
var/mental_status = params["mental_status"]
if(!mental_status || !(mental_status in MENTAL_STATUSES))
return FALSE
target.mental_status = mental_status
return TRUE
return FALSE
/// Deletes medical information from a record.
/obj/machinery/computer/records/medical/expunge_record_info(datum/record/crew/target)
if(!target)
return FALSE
target.age = 18
target.blood_type = pick(list("A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-"))
target.dna_string = "Unknown"
target.gender = "Unknown"
target.major_disabilities = ""
target.major_disabilities_desc = ""
target.medical_notes.Cut()
target.minor_disabilities = ""
target.minor_disabilities_desc = ""
target.physical_status = ""
target.mental_status = ""
target.name = "Unknown"
target.quirk_notes = ""
target.rank = "Unknown"
target.species = "Unknown"
target.trim = "Unknown"
return TRUE