Merge pull request #4910 from Krausus/bicon-photos

Replaces File-Based ID Photos With Bicons
This commit is contained in:
TheDZD
2016-07-07 16:46:58 -04:00
committed by GitHub
7 changed files with 53 additions and 68 deletions
+2
View File
@@ -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
+2 -5
View File
@@ -54,10 +54,6 @@
if(3.0)
dat += text("<B>Records Maintenance</B><HR>\n<A href='?src=\ref[];back=1'>Backup To Disk</A><BR>\n<A href='?src=\ref[];u_load=1'>Upload From disk</A><BR>\n<A href='?src=\ref[];del_all=1'>Delete All Records</A><BR>\n<BR>\n<A href='?src=\ref[];screen=1'>Back</A>", 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 += "<CENTER><B>Medical Record</B></CENTER><BR>"
if ((istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1)))
dat += "<table><tr><td>Name: [active1.fields["name"]] \
@@ -67,7 +63,8 @@
Fingerprint: <A href='?src=\ref[src];field=fingerprint'>[active1.fields["fingerprint"]]</A><BR>\n \
Physical Status: <A href='?src=\ref[src];field=p_stat'>[active1.fields["p_stat"]]</A><BR>\n \
Mental Status: <A href='?src=\ref[src];field=m_stat'>[active1.fields["m_stat"]]</A><BR></td><td align = center valign = top> \
Photo:<br><img src=front.png height=64 width=64 border=5><img src=side.png height=64 width=64 border=5></td></tr></table>"
Photo:<br><img src=[active1.fields["photo-south"]] height=64 width=64 border=5> \
<img src=[active1.fields["photo-west"]] height=64 width=64 border=5></td></tr></table>"
else
dat += "<B>General Record Lost!</B><BR>"
if ((istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2)))
+2 -6
View File
@@ -165,10 +165,6 @@
if(3.0)
dat += "<CENTER><B>Security Record</B></CENTER><BR>"
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 += {"
<table><tr><td>
Name: <A href='?src=\ref[src];choice=Edit Field;field=name'>[active1.fields["name"]]</A><BR>
@@ -182,8 +178,8 @@
</td>
<td align = center valign = top>
Photo:<br>
<img src=front.png height=80 width=80 border=4>
<img src=side.png height=80 width=80 border=4><br>
<img src=[active1.fields["photo-south"]] height=80 width=80 border=4>
<img src=[active1.fields["photo-west"]] height=80 width=80 border=4><br>
<a href='?src=\ref[src];choice=Print Photo'>Print Photo</a>
</td></tr></table>"}
else
+2 -6
View File
@@ -87,10 +87,6 @@
if(3.0)
dat += "<CENTER><B>Employment Record</B></CENTER><BR>"
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("<table><tr><td> \
Name: <A href='?src=\ref[src];choice=Edit Field;field=name'>[active1.fields["name"]]</A><BR> \
ID: <A href='?src=\ref[src];choice=Edit Field;field=id'>[active1.fields["id"]]</A><BR>\n \
@@ -101,8 +97,8 @@
Physical Status: [active1.fields["p_stat"]]<BR>\n \
Mental Status: [active1.fields["m_stat"]]<BR><BR>\n \
Employment/skills summary:<BR> [active1.fields["notes"]]<BR></td> \
<td align = center valign = top>Photo:<br><img src=front.png height=80 width=80 border=4> \
<img src=side.png height=80 width=80 border=4></td></tr></table>")
<td align = center valign = top>Photo:<br><img src=[active1.fields["photo-south"]] height=80 width=80 border=4> \
<img src=[active1.fields["photo-west"]] height=80 width=80 border=4></td></tr></table>")
else
dat += "<B>General Record Lost!</B><BR>"
dat += text("\n<A href='?src=\ref[];choice=Delete Record (ALL)'>Delete Record (ALL)</A><BR><BR>\n<A href='?src=\ref[];choice=Print Record'>Print Record</A><BR>\n<A href='?src=\ref[];choice=Return'>Back</A><BR>", src, src, src)
+41 -40
View File
@@ -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,16 +162,22 @@
dna_hash = H.dna.unique_enzymes
fingerprint_hash = md5(H.dna.uni_identity)
dat = ("<table><tr><td>")
dat += text("Name: []</A><BR>", registered_name)
dat += text("Sex: []</A><BR>\n", sex)
dat += text("Age: []</A><BR>\n", age)
dat += text("Rank: []</A><BR>\n", assignment)
dat += text("Fingerprint: []</A><BR>\n", fingerprint_hash)
dat += text("Blood Type: []<BR>\n", blood_type)
dat += text("DNA Hash: []<BR><BR>\n", dna_hash)
dat +="<td align = center valign = top>Photo:<br><img src=front.png height=80 width=80 border=4> \
<img src=side.png height=80 width=80 border=4></td></tr></table>"
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 = {"<table><tr><td>
Name: [registered_name]</A><BR>
Sex: [sex]</A><BR>
Age: [age]</A><BR>
Rank: [assignment]</A><BR>
Fingerprint: [fingerprint_hash]</A><BR>
Blood Type: [blood_type]<BR>
DNA Hash: [dna_hash]<BR><BR>
<td align = center valign = top>Photo:<br><img src=[photo_front] height=80 width=80 border=4>
<img src=[photo_side] height=80 width=80 border=4></td></tr></table>"}
/obj/item/weapon/card/id/GetAccess()
if(!guest_pass)
@@ -292,27 +290,22 @@
to_chat(usr, "<span class='notice'>The card's microscanners activate as you pass it over \the [I], copying its access.</span>")
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, "<span class='warning'>You need to empty your pockets before taking the ID picture.</span>")
return
var/icon/faked = new()
if(!H.equip_to_slot_if_possible(src, slot_l_store, 0, 1))
to_chat(H, "<span class='warning'>You need to empty your pockets before taking the ID picture.</span>")
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
@@ -349,16 +342,17 @@
src.registered_name = new_name
UpdateName()
to_chat(user, "<span class='notice'>Name changed to [new_name].</span>")
RebuildHTML()
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, "<span class='notice'>Photo changed.</span>")
var/icon/newphoto = fake_id_photo(user)
if(!newphoto)
return
photo = newphoto
to_chat(user, "<span class='notice'>Photo changed.</span>")
RebuildHTML()
if("Appearance")
var/list/appearances = list(
@@ -403,6 +397,7 @@
return
src.sex = new_sex
to_chat(user, "<span class='notice'>Sex changed to [new_sex].</span>")
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))
@@ -410,6 +405,7 @@
return
src.age = new_age
to_chat(user, "<span class='notice'>Age changed to [new_age].</span>")
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))
@@ -418,6 +414,7 @@
src.assignment = new_job
to_chat(user, "<span class='notice'>Occupation changed to [new_job].</span>")
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
@@ -438,6 +435,7 @@
return
src.blood_type = new_blood_type
to_chat(user, "<span class='notice'>Blood type changed to [new_blood_type].</span>")
RebuildHTML()
if("DNA Hash")
var/default = "\[UNSET\]"
@@ -451,6 +449,7 @@
return
src.dna_hash = new_dna_hash
to_chat(user, "<span class='notice'>DNA hash changed to [new_dna_hash].</span>")
RebuildHTML()
if("Fingerprint Hash")
var/default = "\[UNSET\]"
@@ -464,6 +463,7 @@
return
src.fingerprint_hash = new_fingerprint_hash
to_chat(user, "<span class='notice'>Fingerprint hash changed to [new_fingerprint_hash].</span>")
RebuildHTML()
if("Reset Card")
name = initial(name)
@@ -480,6 +480,7 @@
registered_user = null
to_chat(user, "<span class='notice'>All information has been deleted from \the [src].</span>")
RebuildHTML()
else
..()
+2 -5
View File
@@ -86,10 +86,6 @@
if(3.0)
dat += text("<B>Records Maintenance</B><HR>\n<A href='?src=\ref[];back=1'>Backup To Disk</A><BR>\n<A href='?src=\ref[];u_load=1'>Upload From disk</A><BR>\n<A href='?src=\ref[];del_all=1'>Delete All Records</A><BR>\n<BR>\n<A href='?src=\ref[];screen=1'>Back</A>", 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 += "<CENTER><B>Medical Record</B></CENTER><BR>"
if ((istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1)))
dat += "<table><tr><td>Name: [active1.fields["name"]] \
@@ -99,7 +95,8 @@
Fingerprint: <A href='?src=\ref[src];field=fingerprint'>[active1.fields["fingerprint"]]</A><BR>\n \
Physical Status: <A href='?src=\ref[src];field=p_stat'>[active1.fields["p_stat"]]</A><BR>\n \
Mental Status: <A href='?src=\ref[src];field=m_stat'>[active1.fields["m_stat"]]</A><BR></td><td align = center valign = top> \
Photo:<br><img src=front.png height=64 width=64 border=5><img src=side.png height=64 width=64 border=5></td></tr></table>"
Photo:<br><img src=[active1.fields["photo-south"]] height=64 width=64 border=5> \
<img src=[active1.fields["photo-west"]] height=64 width=64 border=5></td></tr></table>"
else
dat += "<B>General Record Lost!</B><BR>"
if ((istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2)))
+2 -6
View File
@@ -127,10 +127,6 @@
if(3.0)
dat += "<CENTER><B>Security Record</B></CENTER><BR>"
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("<table><tr><td> \
Name: <A href='?src=\ref[src];choice=Edit Field;field=name'>[active1.fields["name"]]</A><BR> \
ID: <A href='?src=\ref[src];choice=Edit Field;field=id'>[active1.fields["id"]]</A><BR>\n \
@@ -140,8 +136,8 @@
Fingerprint: <A href='?src=\ref[src];choice=Edit Field;field=fingerprint'>[active1.fields["fingerprint"]]</A><BR>\n \
Physical Status: [active1.fields["p_stat"]]<BR>\n \
Mental Status: [active1.fields["m_stat"]]<BR></td> \
<td align = center valign = top>Photo:<br><img src=front.png height=80 width=80 border=4> \
<img src=side.png height=80 width=80 border=4></td></tr></table>")
<td align = center valign = top>Photo:<br><img src=[active1.fields["photo-south"]] height=80 width=80 border=4> \
<img src=[active1.fields["photo-west"]] height=80 width=80 border=4></td></tr></table>")
else
dat += "<B>General Record Lost!</B><BR>"
if ((istype(active2, /datum/data/record) && data_core.security.Find(active2)))