Files
Bubberstation/code/datums/records/record.dm
John Willard 762779f3f2 Adds a photobooth (#82105)
## About The Pull Request

Adds a photobooth machine to the HoP line which can be used to update
your security records photo.
It updates the records of the person's name, which means hiding your
identity and wearing an ID will let you change other people's photos. If
you aren't hiding your identity and are wearing someone else's ID, it
won't update at all because it will be unable to find your record.
There's 2 variants of this machine, one at the HoP line that's tied
behind Law Office access (so Lawyers have an extra thing they can help
out with if no one's available, but maybe it would be better behind
Library access since Curators are our "photographer" role?), and the
Security one that requires Security access.
The Security one has a special feature that it adds a height chart
behind the player.

![image](https://github.com/tgstation/tgstation/assets/53777086/c4eb0661-d752-4052-8006-2898af78c528)

This machine is used by either right-clicking on it or by pressing a
button, so the HoP can do it remotely from their line (except on Tram
where it's in the library), and after a few delays it'll update your
records automatically to how you look like.

Emagging the machine will remove its access restrictions but every time
it updates your photos it will spam camera flashing and blind you.

Sprites

Open

![image](https://github.com/tgstation/tgstation/assets/53777086/d5e97d84-46d8-40b5-995f-c0ef5c7f18ac)
Closed

![image](https://github.com/tgstation/tgstation/assets/53777086/520e88ed-4630-40d8-9039-4c6dd85a9872)
Security version on the left, has a red tint on it

![image](https://github.com/tgstation/tgstation/assets/53777086/ef71a092-8d1b-4776-bdb4-6718308967c7)

Video demonstration (old sprites):


https://github.com/tgstation/tgstation/assets/53777086/a2e59f08-2d58-4f5b-b081-e137c7606d35

## Why It's Good For The Game

Current security records has no way to change your photo ID, something
that was a feature before it was moved to TGUI. The only alternative is
to fully delete your record and make a new one with a photo and the same
name, but this shares a major issue with the HTML UI: You're immediately
sold out by the fact you have a background. No matter how well you try
to cover your tracks, any security officer looking at records will see
you are the only photo on the manifest that has a background and even a
camera in your hand, which makes it impossible to get away with it
unless security essentially takes pity on you.
This opens up the ability to fully mask yourself in records, finally.

This is also better even for non antagonists because you can now
properly update your photos to match what you look like in the event of
an appearance change or even just a job change, which makes it a benefit
for HoPs who likes to keep records as up-to-date as possible.

## Changelog

🆑 JohnFulpWillard, Twox
add: Added a new photobooth machine to the HoP's line.
fix: Things checking for access now checks your off hand, too.
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-03-27 17:58:01 +13:00

309 lines
9.2 KiB
Plaintext

/**
* Record datum. Used for crew records and admin locked records.
*/
/datum/record
/// Age of the character
var/age
/// Their blood type
var/blood_type
/// Character appearance
var/mutable_appearance/character_appearance
/// DNA string
var/dna_string
/// Fingerprint string (md5)
var/fingerprint
/// The character's gender
var/gender
/// The character's initial rank at roundstart
var/initial_rank
/// The character's name
var/name = "Unknown"
/// The character's rank
var/rank
/// The character's species
var/species
/// The character's ID trim
var/trim
/// The character's voice, if they have one.
var/voice
/datum/record/New(
age = 18,
blood_type = "?",
character_appearance,
dna_string = "Unknown",
fingerprint = "?????",
gender = "Other",
initial_rank = "Unassigned",
name = "Unknown",
rank = "Unassigned",
species = "Human",
trim = "Unassigned",
voice = "?????",
)
src.age = age
src.blood_type = blood_type
src.character_appearance = character_appearance
src.dna_string = dna_string
src.fingerprint = fingerprint
src.gender = gender
src.initial_rank = rank
src.name = name
src.rank = rank
src.species = species
src.trim = trim
/**
* Crew record datum
*/
/datum/record/crew
/// List of citations
var/list/citations = list()
/// List of crimes
var/list/crimes = list()
/// Unique ID generated that is used to fetch lock record
var/lock_ref
/// Names of major disabilities
var/major_disabilities
/// Fancy description of major disabilities
var/major_disabilities_desc
/// List of medical notes
var/list/medical_notes = list()
/// Names of minor disabilities
var/minor_disabilities
/// Fancy description of minor disabilities
var/minor_disabilities_desc
/// Physical status of this person in medical records.
var/physical_status
/// Mental status of this person in medical records.
var/mental_status
/// Positive and neutral quirk strings
var/quirk_notes
/// Security note
var/security_note
/// Current arrest status
var/wanted_status = WANTED_NONE
///Photo used for records, which we store here so we don't have to constantly make more of.
var/list/obj/item/photo/record_photos
/datum/record/crew/New(
age = 18,
blood_type = "?",
character_appearance,
dna_string = "Unknown",
fingerprint = "?????",
gender = "Other",
initial_rank = "Unassigned",
name = "Unknown",
rank = "Unassigned",
species = "Human",
trim = "Unassigned",
/// Crew specific
lock_ref,
major_disabilities = "None",
major_disabilities_desc = "No disabilities have been diagnosed at the moment.",
minor_disabilities = "None",
minor_disabilities_desc = "No disabilities have been diagnosed at the moment.",
physical_status = PHYSICAL_ACTIVE,
mental_status = MENTAL_STABLE,
quirk_notes,
)
. = ..()
src.lock_ref = lock_ref
src.major_disabilities = major_disabilities
src.major_disabilities_desc = major_disabilities_desc
src.minor_disabilities = minor_disabilities
src.minor_disabilities_desc = minor_disabilities_desc
src.physical_status = physical_status
src.mental_status = mental_status
src.quirk_notes = quirk_notes
GLOB.manifest.general += src
/datum/record/crew/Destroy()
GLOB.manifest.general -= src
QDEL_LAZYLIST(record_photos)
return ..()
/**
* Admin locked record
*/
/datum/record/locked
/// Mob's dna
var/datum/dna/locked_dna
/// Mind datum
var/datum/weakref/mind_ref
/// Typepath of species used by player, for usage in respawning via records
var/species_type
/datum/record/locked/New(
age = 18,
blood_type = "?",
character_appearance,
dna_string = "Unknown",
fingerprint = "?????",
gender = "Other",
initial_rank = "Unassigned",
name = "Unknown",
rank = "Unassigned",
species = "Human",
trim = "Unassigned",
/// Locked specific
datum/dna/locked_dna,
datum/mind/mind_ref,
)
. = ..()
src.locked_dna = locked_dna
src.mind_ref = WEAKREF(mind_ref)
species_type = locked_dna.species.type
GLOB.manifest.locked += src
/datum/record/locked/Destroy()
GLOB.manifest.locked -= src
return ..()
/// A helper proc to get the front photo of a character from the record.
/// Handles calling `get_photo()`, read its documentation for more information.
/datum/record/crew/proc/get_front_photo()
return get_photo("photo_front", SOUTH)
/// A helper proc to get the side photo of a character from the record.
/// Handles calling `get_photo()`, read its documentation for more information.
/datum/record/crew/proc/get_side_photo()
return get_photo("photo_side", WEST)
/// A helper proc to recreate all photos of a character from the record.
/datum/record/crew/proc/recreate_manifest_photos(add_height_chart)
delete_photos("photo_front")
make_photo("photo_front", SOUTH, add_height_chart)
delete_photos("photo_side")
make_photo("photo_side", WEST, add_height_chart)
///Deletes the existing photo for field_name
/datum/record/crew/proc/delete_photos(field_name)
var/obj/item/photo/existing_photo = LAZYACCESS(record_photos, field_name)
if(existing_photo)
qdel(existing_photo)
LAZYREMOVE(record_photos, field_name)
/**
* You shouldn't be calling this directly, use `get_front_photo()` or `get_side_photo()`
* instead.
*
* This is the proc that handles either fetching (if it was already generated before) or
* generating (if it wasn't) the specified photo from the specified record. This is only
* intended to be used by records that used to try to access `fields["photo_front"]` or
* `fields["photo_side"]`, and will return an empty icon if there isn't any of the necessary
* fields.
*
* Arguments:
* * field_name - The name of the key in the `fields` list, of the record itself.
* * orientation - The direction in which you want the character appearance to be rotated
* in the outputed photo.
*
* Returns an empty `/icon` if there was no `character_appearance` entry in the `fields` list,
* returns the generated/cached photo otherwise.
*/
/datum/record/crew/proc/get_photo(field_name, orientation = SOUTH)
if(!field_name)
return
if(!character_appearance)
return new /icon()
var/obj/item/photo/existing_photo = LAZYACCESS(record_photos, field_name)
if(!existing_photo)
existing_photo = make_photo(field_name, orientation)
return existing_photo
/**
* make_photo
*
* Called if the person doesn't already have a photo, this will make a photo of the person,
* then make a picture out of it, then finally create a new photo.
*/
/datum/record/crew/proc/make_photo(field_name, orientation, add_height_chart)
var/icon/picture_image
if(!isicon(character_appearance))
var/mutable_appearance/appearance = character_appearance
appearance.setDir(orientation)
if(add_height_chart)
appearance.underlays += mutable_appearance('icons/obj/machines/photobooth.dmi', "height_chart", alpha = 125, appearance_flags = RESET_ALPHA|RESET_COLOR|RESET_TRANSFORM)
picture_image = getFlatIcon(appearance)
else
picture_image = character_appearance
var/datum/picture/picture = new
picture.picture_name = name
picture.picture_desc = "This is [name]."
picture.picture_image = picture_image
var/obj/item/photo/new_photo = new(null, picture)
LAZYSET(record_photos, field_name, new_photo)
return new_photo
/// Returns a paper printout of the current record's crime data.
/datum/record/crew/proc/get_rapsheet(alias, header = "Rapsheet", description = "No further details.")
var/print_count = ++GLOB.manifest.print_count
var/obj/item/paper/printed_paper = new
var/final_paper_text = "<center><b>SR-[print_count]: [header]</b></center><br>"
final_paper_text += "Name: [name]<br>Gender: [gender]<br>Age: [age]<br>"
if(alias != name)
final_paper_text += "Alias: [alias]<br>"
final_paper_text += "Species: [species]<br>Fingerprint: [fingerprint]<br>Wanted Status: [wanted_status]<br><br>"
final_paper_text += "<center><B>Security Data</B></center><br><br>"
final_paper_text += "Crimes:<br>"
final_paper_text += {"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
<th>Crime</th>
<th>Details</th>
<th>Author</th>
<th>Time Added</th>
</tr>"}
for(var/datum/crime/crime in crimes)
if(crime.valid)
final_paper_text += "<tr><td>[crime.name]</td>"
final_paper_text += "<td>[crime.details]</td>"
final_paper_text += "<td>[crime.author]</td>"
final_paper_text += "<td>[crime.time]</td>"
else
for(var/i in 1 to 4)
final_paper_text += "<td>--REDACTED--</td>"
final_paper_text += "</tr>"
final_paper_text += "</table><br><br>"
final_paper_text += "Citations:<br>"
final_paper_text += {"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
<th>Citation</th>
<th>Details</th>
<th>Author</th>
<th>Time Added</th>
<th>Fine</th>
</tr><br>"}
for(var/datum/crime/citation/warrant in citations)
final_paper_text += "<tr><td>[warrant.name]</td>"
final_paper_text += "<td>[warrant.details]</td>"
final_paper_text += "<td>[warrant.author]</td>"
final_paper_text += "<td>[warrant.time]</td>"
final_paper_text += "<td>[warrant.fine]</td>"
final_paper_text += "</tr>"
final_paper_text += "</table><br><br>"
final_paper_text += "<center>Important Notes:</center><br>"
if(security_note)
final_paper_text += "- [security_note]<br>"
if(description)
final_paper_text += "- [description]<br>"
printed_paper.name = "SR-[print_count] '[name]'"
printed_paper.add_raw_text(final_paper_text)
printed_paper.update_appearance()
return printed_paper