From 783536d2784928e06f408e6c73938f9f204d672a Mon Sep 17 00:00:00 2001 From: Krausus Date: Thu, 7 Jul 2016 01:25:56 -0400 Subject: [PATCH 1/2] Replaces ID photos with bicons --- code/datums/datacore.dm | 2 ++ code/game/machinery/computer/medical.dm | 7 ++---- code/game/machinery/computer/security.dm | 8 ++----- code/game/machinery/computer/skills.dm | 8 ++----- code/game/objects/items/weapons/cards_ids.dm | 23 +++++++++----------- code/modules/computer3/computers/medical.dm | 7 ++---- code/modules/computer3/computers/security.dm | 8 ++----- 7 files changed, 22 insertions(+), 41 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index d07b6e3eb73..ff081676b43 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -66,6 +66,8 @@ G.fields["sex"] = capitalize(H.gender) G.fields["species"] = H.get_species() G.fields["photo"] = get_id_photo(H) + G.fields["photo-south"] = "'data:image/png;base64,[icon2base64(icon(G.fields["photo"], dir = SOUTH))]'" + G.fields["photo-west"] = "'data:image/png;base64,[icon2base64(icon(G.fields["photo"], dir = WEST))]'" if(H.gen_record && !jobban_isbanned(H, "Records")) G.fields["notes"] = H.gen_record else diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 6e331d46cf3..4727953e5df 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -54,10 +54,6 @@ if(3.0) dat += text("Records Maintenance
\nBackup To Disk
\nUpload From disk
\nDelete All Records
\n
\nBack", src, src, src, src) if(4.0) - var/icon/front = new(active1.fields["photo"], dir = SOUTH) - var/icon/side = new(active1.fields["photo"], dir = WEST) - user << browse_rsc(front, "front.png") - user << browse_rsc(side, "side.png") dat += "
Medical Record

" if ((istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1))) dat += "
Name: [active1.fields["name"]] \ @@ -67,7 +63,8 @@ Fingerprint: [active1.fields["fingerprint"]]
\n \ Physical Status: [active1.fields["p_stat"]]
\n \ Mental Status: [active1.fields["m_stat"]]
\ - Photo:
" + Photo:
\ + " else dat += "General Record Lost!
" if ((istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2))) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 6f285930ab7..f1c475a122b 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -165,10 +165,6 @@ if(3.0) dat += "
Security Record

" if ((istype(active1, /datum/data/record) && data_core.general.Find(active1))) - var/icon/front = new(active1.fields["photo"], dir = SOUTH) - var/icon/side = new(active1.fields["photo"], dir = WEST) - user << browse_rsc(front, "front.png") - user << browse_rsc(side, "side.png") dat += {"
Name: [active1.fields["name"]]
@@ -182,8 +178,8 @@
Photo:
- -
+ +
Print Photo
"} else diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index ddcfeed9a74..1d5e0ce53dd 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -87,10 +87,6 @@ if(3.0) dat += "
Employment Record

" if ((istype(active1, /datum/data/record) && data_core.general.Find(active1))) - var/icon/front = new(active1.fields["photo"], dir = SOUTH) - var/icon/side = new(active1.fields["photo"], dir = WEST) - user << browse_rsc(front, "front.png") - user << browse_rsc(side, "side.png") dat += text(" \ -
\ Name: [active1.fields["name"]]
\ ID: [active1.fields["id"]]
\n \ @@ -101,8 +97,8 @@ Physical Status: [active1.fields["p_stat"]]
\n \ Mental Status: [active1.fields["m_stat"]]

\n \ Employment/skills summary:
[active1.fields["notes"]]
Photo:
\ -
") + Photo:
\ + ") else dat += "General Record Lost!
" dat += text("\nDelete Record (ALL)

\nPrint Record
\nBack
", src, src, src) diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 97f66ec6a72..85c25d2b98a 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -103,8 +103,6 @@ var/sex var/age var/photo - var/icon/front - var/icon/side var/dat var/stamped = 0 @@ -137,12 +135,6 @@ var/datum/asset/assets = get_asset_datum(/datum/asset/simple/paper) assets.send(user) - if(!front) - front = new(photo, dir = SOUTH) - if(!side) - side = new(photo, dir = WEST) - user << browse_rsc(front, "front.png") - user << browse_rsc(side, "side.png") var/datum/browser/popup = new(user, "idcard", name, 600, 400) popup.set_content(dat) popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state)) @@ -170,6 +162,9 @@ dna_hash = H.dna.unique_enzymes fingerprint_hash = md5(H.dna.uni_identity) + var/photo_front = "'data:image/png;base64,[icon2base64(icon(photo, dir = SOUTH))]'" + var/photo_side = "'data:image/png;base64,[icon2base64(icon(photo, dir = WEST))]'" + dat = ("
") dat += text("Name: []
", registered_name) dat += text("Sex: []
\n", sex) @@ -178,8 +173,8 @@ dat += text("Fingerprint: []
\n", fingerprint_hash) dat += text("Blood Type: []
\n", blood_type) dat += text("DNA Hash: []

\n", dna_hash) - dat +="
Photo:
\ -
" + dat +="Photo:
\ + " /obj/item/weapon/card/id/GetAccess() if(!guest_pass) @@ -341,7 +336,7 @@ if("Show") return ..() if("Edit") - switch(input(user,"What would you like to edit on \the [src]?") in list("Name","Photo","Appearance","Sex","Age","Occupation","Money Account","Blood Type","DNA Hash","Fingerprint Hash","Reset Card")) + switch(input(user,"What would you like to edit on \the [src]?") in list("Name","Appearance","Sex","Age","Occupation","Money Account","Blood Type","DNA Hash","Fingerprint Hash","Reset Card")) if("Name") var/new_name = reject_bad_name(input(user,"What name would you like to put on this card?","Agent Card Name", ishuman(user) ? user.real_name : user.name)) if(!Adjacent(user)) @@ -350,13 +345,15 @@ UpdateName() to_chat(user, "Name changed to [new_name].") + // This option is now disabled. I had to comment out the front/side lines. + // It didn't work anyway, so nothing of value was lost! if("Photo") if(!Adjacent(user)) return photo = fake_id_photo(user) var/icon/photoside = fake_id_photo(user,1) - front = new(photo) - side = new(photoside) + // front = new(photo) + // side = new(photoside) if(photo && photoside) to_chat(user, "Photo changed.") diff --git a/code/modules/computer3/computers/medical.dm b/code/modules/computer3/computers/medical.dm index 5d283af5b53..b3feb23c6a5 100644 --- a/code/modules/computer3/computers/medical.dm +++ b/code/modules/computer3/computers/medical.dm @@ -86,10 +86,6 @@ if(3.0) dat += text("Records Maintenance
\nBackup To Disk
\nUpload From disk
\nDelete All Records
\n
\nBack", src, src, src, src) if(4.0) - var/icon/front = new(active1.fields["photo"], dir = SOUTH) - var/icon/side = new(active1.fields["photo"], dir = WEST) - usr << browse_rsc(front, "front.png") - usr << browse_rsc(side, "side.png") dat += "
Medical Record

" if ((istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1))) dat += "
Name: [active1.fields["name"]] \ @@ -99,7 +95,8 @@ Fingerprint: [active1.fields["fingerprint"]]
\n \ Physical Status: [active1.fields["p_stat"]]
\n \ Mental Status: [active1.fields["m_stat"]]
\ - Photo:
" + Photo:
\ + " else dat += "General Record Lost!
" if ((istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2))) diff --git a/code/modules/computer3/computers/security.dm b/code/modules/computer3/computers/security.dm index ebb218b5cee..57e8de72a79 100644 --- a/code/modules/computer3/computers/security.dm +++ b/code/modules/computer3/computers/security.dm @@ -127,10 +127,6 @@ if(3.0) dat += "
Security Record

" if ((istype(active1, /datum/data/record) && data_core.general.Find(active1))) - var/icon/front = new(active1.fields["photo"], dir = SOUTH) - var/icon/side = new(active1.fields["photo"], dir = WEST) - usr << browse_rsc(front, "front.png") - usr << browse_rsc(side, "side.png") dat += text(" \ -
\ Name: [active1.fields["name"]]
\ ID: [active1.fields["id"]]
\n \ @@ -140,8 +136,8 @@ Fingerprint: [active1.fields["fingerprint"]]
\n \ Physical Status: [active1.fields["p_stat"]]
\n \ Mental Status: [active1.fields["m_stat"]]
Photo:
\ -
") + Photo:
\ + ") else dat += "General Record Lost!
" if ((istype(active2, /datum/data/record) && data_core.security.Find(active2))) From d6dd9075f37c2cf10e47394a81b7f02d0349a94a Mon Sep 17 00:00:00 2001 From: Krausus Date: Thu, 7 Jul 2016 10:21:58 -0400 Subject: [PATCH 2/2] Fixes agent ID HTML not updating --- code/game/objects/items/weapons/cards_ids.dm | 74 +++++++++++--------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 85c25d2b98a..68efca49825 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -162,19 +162,22 @@ dna_hash = H.dna.unique_enzymes fingerprint_hash = md5(H.dna.uni_identity) + RebuildHTML() + +/obj/item/weapon/card/id/proc/RebuildHTML() var/photo_front = "'data:image/png;base64,[icon2base64(icon(photo, dir = SOUTH))]'" var/photo_side = "'data:image/png;base64,[icon2base64(icon(photo, dir = WEST))]'" - dat = ("
") - dat += text("Name: []
", registered_name) - dat += text("Sex: []
\n", sex) - dat += text("Age: []
\n", age) - dat += text("Rank: []
\n", assignment) - dat += text("Fingerprint: []
\n", fingerprint_hash) - dat += text("Blood Type: []
\n", blood_type) - dat += text("DNA Hash: []

\n", dna_hash) - dat +="
Photo:
\ -
" + dat = {"
+ Name: [registered_name]
+ Sex: [sex]
+ Age: [age]
+ Rank: [assignment]
+ Fingerprint: [fingerprint_hash]
+ Blood Type: [blood_type]
+ DNA Hash: [dna_hash]

+
Photo:
+
"} /obj/item/weapon/card/id/GetAccess() if(!guest_pass) @@ -287,27 +290,22 @@ to_chat(usr, "The card's microscanners activate as you pass it over \the [I], copying its access.") src.access |= I.access //Don't copy access if user isn't an antag -- to prevent metagaming -/obj/item/weapon/card/id/syndicate/proc/fake_id_photo(var/mob/living/carbon/human/H, var/side=0)//get_id_photo wouldn't work correctly +/obj/item/weapon/card/id/syndicate/proc/fake_id_photo(var/mob/living/carbon/human/H)//get_id_photo wouldn't work correctly if(!istype(H)) return var/storedDir = H.dir //don't want to lose track of this - var/icon/faked - if(!side) - if(!H.equip_to_slot_if_possible(src, slot_l_store, 0, 1)) - to_chat(H, "You need to empty your pockets before taking the ID picture.") - return + var/icon/faked = new() + if(!H.equip_to_slot_if_possible(src, slot_l_store, 0, 1)) + to_chat(H, "You need to empty your pockets before taking the ID picture.") + return - if(side) - H.dir = WEST //ensure the icon is actually the proper direction before copying it - faked = getFlatIcon(H) - H.dir = storedDir //reset the user back to their original direction, not even noticable they changed - H.equip_to_slot_if_possible(src, slot_l_hand, 0, 1) - - else - H.dir = SOUTH - faked = getFlatIcon(H) - H.dir = storedDir + H.dir = WEST //ensure the icon is actually the proper direction before copying it + faked.Insert(getFlatIcon(H), dir = WEST) + H.dir = SOUTH + faked.Insert(getFlatIcon(H), dir = SOUTH) + H.dir = storedDir + H.equip_to_slot_if_possible(src, slot_l_hand, 0, 1) return faked @@ -336,7 +334,7 @@ if("Show") return ..() if("Edit") - switch(input(user,"What would you like to edit on \the [src]?") in list("Name","Appearance","Sex","Age","Occupation","Money Account","Blood Type","DNA Hash","Fingerprint Hash","Reset Card")) + switch(input(user,"What would you like to edit on \the [src]?") in list("Name","Photo","Appearance","Sex","Age","Occupation","Money Account","Blood Type","DNA Hash","Fingerprint Hash","Reset Card")) if("Name") var/new_name = reject_bad_name(input(user,"What name would you like to put on this card?","Agent Card Name", ishuman(user) ? user.real_name : user.name)) if(!Adjacent(user)) @@ -344,18 +342,17 @@ src.registered_name = new_name UpdateName() to_chat(user, "Name changed to [new_name].") + RebuildHTML() - // This option is now disabled. I had to comment out the front/side lines. - // It didn't work anyway, so nothing of value was lost! if("Photo") if(!Adjacent(user)) return - photo = fake_id_photo(user) - var/icon/photoside = fake_id_photo(user,1) - // front = new(photo) - // side = new(photoside) - if(photo && photoside) - to_chat(user, "Photo changed.") + var/icon/newphoto = fake_id_photo(user) + if(!newphoto) + return + photo = newphoto + to_chat(user, "Photo changed.") + RebuildHTML() if("Appearance") var/list/appearances = list( @@ -400,6 +397,7 @@ return src.sex = new_sex to_chat(user, "Sex changed to [new_sex].") + RebuildHTML() if("Age") var/new_age = sanitize(stripped_input(user,"What age would you like to put on this card?","Agent Card Age","21", MAX_MESSAGE_LEN)) @@ -407,6 +405,7 @@ return src.age = new_age to_chat(user, "Age changed to [new_age].") + RebuildHTML() if("Occupation") var/new_job = sanitize(stripped_input(user,"What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation", "Civilian", MAX_MESSAGE_LEN)) @@ -415,6 +414,7 @@ src.assignment = new_job to_chat(user, "Occupation changed to [new_job].") UpdateName() + RebuildHTML() if("Money Account") var/new_account = input(user,"What money account would you like to link to this card?","Agent Card Account",12345) as num @@ -435,6 +435,7 @@ return src.blood_type = new_blood_type to_chat(user, "Blood type changed to [new_blood_type].") + RebuildHTML() if("DNA Hash") var/default = "\[UNSET\]" @@ -448,6 +449,7 @@ return src.dna_hash = new_dna_hash to_chat(user, "DNA hash changed to [new_dna_hash].") + RebuildHTML() if("Fingerprint Hash") var/default = "\[UNSET\]" @@ -461,6 +463,7 @@ return src.fingerprint_hash = new_fingerprint_hash to_chat(user, "Fingerprint hash changed to [new_fingerprint_hash].") + RebuildHTML() if("Reset Card") name = initial(name) @@ -477,6 +480,7 @@ registered_user = null to_chat(user, "All information has been deleted from \the [src].") + RebuildHTML() else ..()