Skip to content

Commit

Permalink
Reapply "alot"
Browse files Browse the repository at this point in the history
This reverts commit 9f1f446.
  • Loading branch information
FalloutFalcon committed May 28, 2024
1 parent 9f1f446 commit 9ea5e32
Show file tree
Hide file tree
Showing 19 changed files with 943 additions and 43 deletions.
16 changes: 8 additions & 8 deletions code/controllers/subsystem/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,9 @@ SUBSYSTEM_DEF(datacore)
G.fields[DATACORE_AGE] = H.age
G.fields[DATACORE_SPECIES] = H.dna.species.name
G.fields[DATACORE_FINGERPRINT] = md5(H.dna.uni_identity)
G.fields[DATACORE_PHYSICAL_HEALTH] = "Active"
G.fields[DATACORE_MENTAL_HEALTH] = "Stable"
G.fields[DATACORE_PHYSICAL_HEALTH] = PHYSICAL_ACTIVE
G.fields[DATACORE_MENTAL_HEALTH] = MENTAL_STABLE
G.fields[DATACORE_GENDER] = H.gender
if(H.gender == "male")
G.fields[DATACORE_GENDER] = "Male"
else if(H.gender == "female")
G.fields[DATACORE_GENDER] = "Female"
else
G.fields[DATACORE_GENDER] = "Other"
G.fields[DATACORE_APPEARANCE] = character_appearance

G.fields[DATACORE_BLOOD_TYPE] = H.dna.blood_type.name
Expand All @@ -211,6 +205,12 @@ SUBSYSTEM_DEF(datacore)
else
library[custom_library].inject_record(G)

/datum/controller/subsystem/datacore/proc/create_record(library_target, name)
var/datum/data/record/new_record = new /datum/data/record
new_record.fields[DATACORE_NAME] = name
library[library_target].inject_record(new_record)
return new_record

/**
* Supporing proc for getting general records
* and using them as pAI ui data. This gets
Expand Down
34 changes: 34 additions & 0 deletions code/game/machinery/computer/record/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,39 @@
circuit = /obj/item/circuitboard/computer/med_data
light_color = LIGHT_COLOR_BLUE

/obj/machinery/computer/records/med/ui_interact(mob/user, datum/tgui/ui)
. = ..()
if(.)
return
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "MedicalRecords")
ui.set_autoupdate(FALSE)
ui.open()

/obj/machinery/computer/records/med/ui_data(mob/user)
var/list/data = ..()

var/list/records = list()
for(var/datum/data/record/target in SSdatacore.get_records(linked_ship))
records += list(list(
age = target.fields[DATACORE_AGE],
blood_type = target.fields[DATACORE_BLOOD_TYPE],
record_ref = REF(target),
dna = target.fields[DATACORE_BLOOD_DNA],
gender = target.fields[DATACORE_GENDER],
disabilities = target.fields[DATACORE_DISABILITIES],
physical_status = target.fields[DATACORE_PHYSICAL_HEALTH],
mental_status = target.fields[DATACORE_MENTAL_HEALTH],
name = target.fields[DATACORE_NAME],
rank = target.fields[DATACORE_RANK],
species = target.fields[DATACORE_SPECIES],
))

data["records"] = records

return data

/obj/machinery/computer/records/med/syndie
icon_keyboard = "syndie_key"

Expand All @@ -20,3 +53,4 @@
icon_keyboard = "laptop_key"
pass_flags = PASSTABLE
unique_icon = TRUE

95 changes: 66 additions & 29 deletions code/game/machinery/computer/record/records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
. = ..()
linked_ship = null

/obj/machinery/computer/records/ui_interact(mob/user, datum/tgui/ui)
/*
/obj/machinery/computer/records/attacked_by(obj/item/attacking_item, mob/living/user)
. = ..()
if(.)
if(!istype(attacking_item, /obj/item/photo))
return
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "Records")
ui.set_autoupdate(FALSE)
ui.open()
insert_new_record(user, attacking_item)
*/

/obj/machinery/computer/records/ui_static_data(mob/user)
var/list/data = list()
Expand All @@ -43,24 +41,6 @@
if(!has_access)
return data

var/list/records = list()
for(var/datum/data/record/target in SSdatacore.get_records(linked_ship))
records += list(list(
age = target.fields[DATACORE_AGE],
blood_type = target.fields[DATACORE_BLOOD_TYPE],
record_ref = REF(target),
dna = target.fields[DATACORE_BLOOD_DNA],
gender = target.fields[DATACORE_GENDER],
disabilities = target.fields[DATACORE_DISABILITIES],
physical_status = target.fields[DATACORE_PHYSICAL_HEALTH],
mental_status = target.fields[DATACORE_MENTAL_HEALTH],
name = target.fields[DATACORE_NAME],
rank = target.fields[DATACORE_RANK],
species = target.fields[DATACORE_SPECIES],
))

data["records"] = records

return data

/obj/machinery/computer/records/ui_act(action, list/params, datum/tgui/ui)
Expand All @@ -81,7 +61,19 @@
expunge_record_info(target)
balloon_alert(user, "record expunged")
investigate_log("[key_name(user)] expunged the record of [target[DATACORE_NAME]].", INVESTIGATE_RECORDS)
return TRUE

if("purge_records")
SSdatacore.wipe_records(linked_ship)
return TRUE

if("new_record")
var/name = stripped_input(user, "Enter the name of the new record.", "New Record", "", MAX_NAME_LEN)
if(!name)
return FALSE

SSdatacore.create_record(linked_ship, name)
balloon_alert(user, "record created")
return TRUE

if("login")
Expand Down Expand Up @@ -136,10 +128,6 @@

return FALSE

/// Expunges info from a record.
/obj/machinery/computer/records/proc/expunge_record_info(datum/record/target)
return

/obj/machinery/computer/records/proc/secure_login(mob/user)
if(!is_operational)
return FALSE
Expand All @@ -152,3 +140,52 @@
playsound(src, 'sound/machines/terminal_on.ogg', 70, TRUE)

return TRUE

/// Deletes medical information from a record.
/obj/machinery/computer/records/proc/expunge_record_info(datum/data/record/target)
if(!target)
return FALSE

target.fields[DATACORE_NAME] = "Unknown"
target.fields[DATACORE_AGE] = 18
target.fields[DATACORE_GENDER] = "Unknown"
target.fields[DATACORE_SPECIES] = "Unknown"
target.fields[DATACORE_BLOOD_TYPE] = pick(list("A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-"))
target.fields[DATACORE_BLOOD_DNA] = "Unknown"
target.fields[DATACORE_DISABILITIES] = ""
target.fields[DATACORE_DISABILITIES_DETAILS] = ""
target.fields[DATACORE_PHYSICAL_HEALTH] = ""
target.fields[DATACORE_MENTAL_HEALTH] = ""
target.fields[DATACORE_RANK] = "Unknown"

return TRUE

/*
/obj/machinery/computer/records/proc/insert_new_record(mob/user, obj/item/photo/mugshot)
if(!mugshot || !is_operational)
return FALSE
if(!authenticated && !allowed(user))
balloon_alert(user, "access denied")
playsound(src, 'sound/machines/terminal_error.ogg', 70, TRUE)
return FALSE
if(mugshot.picture.psize_x > world.icon_size || mugshot.picture.psize_y > world.icon_size)
balloon_alert(user, "photo too large!")
playsound(src, 'sound/machines/terminal_error.ogg', 70, TRUE)
return FALSE
var/trimmed = copytext(mugshot.name, 9, MAX_NAME_LEN) // Remove "photo - "
var/name = stripped_input(user, "Enter the name of the new record.", "New Record", trimmed, MAX_NAME_LEN)
if(!name || !is_operational || !mugshot || QDELETED(mugshot) || QDELETED(src))
return FALSE
var/datum/data/record/new_record = SSdatacore.create_record(linked_ship, name)
new_record.fields[DATACORE_APPEARANCE] = mugshot.picture.picture_image
balloon_alert(user, "record created")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 70, TRUE)
qdel(mugshot)
return TRUE
*/
42 changes: 42 additions & 0 deletions code/game/machinery/computer/record/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,48 @@
circuit = /obj/item/circuitboard/computer/secure_data
light_color = COLOR_SOFT_RED

/obj/machinery/computer/records/sec/ui_interact(mob/user, datum/tgui/ui)
. = ..()
if(.)
return
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "SecurityRecords")
ui.set_autoupdate(FALSE)
ui.open()

/obj/machinery/computer/records/med/ui_data(mob/user)
var/list/data = ..()

data["available_statuses"] = WANTED_STATUSES()
data["current_user"] = user.name

var/list/records = list()
for(var/datum/data/record/target in SSdatacore.get_records(linked_ship))
var/list/crimes = list()
for(var/datum/data/crime/crime in target.fields[DATACORE_CRIMES])
crimes += list(list(
author = crime.author,
crime_ref = REF(crime),
details = crime.crimeDetails,
name = crime.crimeName,
time = crime.time,
))
records += list(list(
age = target.fields[DATACORE_AGE],
record_ref = REF(target),
fingerprint = target.fields[DATACORE_FINGERPRINT],
gender = target.fields[DATACORE_GENDER],
name = target.fields[DATACORE_NAME],
rank = target.fields[DATACORE_RANK],
species = target.fields[DATACORE_SPECIES],
wanted_status = target.fields[DATACORE_CRIMINAL_STATUS],
))

data["records"] = records

return data

/obj/machinery/computer/records/sec/syndie
icon_keyboard = "syndie_key"

Expand Down
4 changes: 2 additions & 2 deletions code/modules/photography/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@
if(!isturf(target_turf))
blending = FALSE
return FALSE
size_x = clamp(size_x, CAMERA_PICTURE_SIZE_HARD_MINIMUM, CAMERA_PICTURE_SIZE_HARD_LIMIT)
size_y = clamp(size_y, CAMERA_PICTURE_SIZE_HARD_MINIMUM, CAMERA_PICTURE_SIZE_HARD_LIMIT)
size_x = clamp(size_x, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
size_y = clamp(size_y, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
var/list/desc = list("This is a photo of an area of [size_x+1] meters by [size_y+1] meters.")
var/list/mobs_spotted = list()
var/list/dead_spotted = list()
Expand Down
Binary file added sound/machines/terminal_error.ogg
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export const MedicalRecordTabs = (props, context) => {
<Stack fill>
<Stack.Item>
<Button
disabled
content="Create"
onClick={() => act('new_record')}
icon="plus"
tooltip="Add new records by inserting a 1 by 1 meter photo into the terminal. You do not need this screen open."
tooltip="New Record."
>
Create
</Button>
</Stack.Item>
<Stack.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MedicalRecordData } from './types';
import { MedicalRecordTabs } from './RecordTabs';
import { MedicalRecordView } from './RecordView';

export const Records = (props, context) => {
export const MedicalRecords = (props, context) => {
const { data } = useBackend<MedicalRecordData>(context);
const { authenticated } = data;

Expand Down
Loading

0 comments on commit 9ea5e32

Please sign in to comment.