Skip to content

Commit 93a7e33

Browse files
authored
IDs take advantage of 515 technology (#898)
1 parent c129e64 commit 93a7e33

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

code/controllers/subsystem/overlays.dm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,15 @@ SUBSYSTEM_DEF(overlays)
121121
overlays |= cached_other
122122
else if(cut_old)
123123
cut_overlays()
124+
125+
/// Recursively removes overlays that do not render to the game plane from an appearance.
126+
/proc/remove_non_canon_overlays(mutable_appearance/appearance)
127+
for(var/mutable_appearance/overlay as anything in appearance.overlays)
128+
if(overlay.plane != GAME_PLANE && overlay.plane != FLOAT_PLANE)
129+
appearance.overlays -= overlay
130+
131+
if(length(overlay.overlays))
132+
appearance.overlays -= overlay
133+
appearance.overlays += .(new /mutable_appearance(overlay))
134+
135+
return appearance

code/datums/datacore.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
296296
C = H.client
297297

298298
var/mutable_appearance/character_appearance = new(H.appearance)
299+
remove_non_canon_overlays(character_appearance)
299300

300301
//These records should ~really~ be merged or something
301302
//General Record

code/game/objects/items/cards_ids.dm

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
/// Registered owner's blood type.
7474
var/blood_type = "UNSET"
7575
// Images to store in the ID, based on the datacore.
76-
var/icon/front_image
77-
var/icon/side_image
76+
var/mutable_appearance/front_image
77+
var/mutable_appearance/side_image
7878

7979
/// The job name registered on the card (for example: Assistant). Set by trim usually.
8080
var/assignment
@@ -473,14 +473,10 @@
473473
content += "Fingerprint: [fingerprint]<br>"
474474
content += "DNA Hash: [dna_hash]<br>"
475475
if(front_image && side_image)
476-
content +="<td style='text-align:center; vertical-align:top'>Photo:<br><img src=front.png height=128 width=128 border=4 style='image-rendering: pixelated;-ms-interpolation-mode: nearest-neighbor'><img src=side.png height=128 width=128 border=4 style='image-rendering: pixelated;-ms-interpolation-mode: nearest-neighbor'></td>"
476+
content +="<td style='text-align:center; vertical-align:top'>Photo:<br><img src=\ref[front_image.appearance] height=128 width=128 border=4 style='image-rendering: pixelated;-ms-interpolation-mode: nearest-neighbor'><img src=\ref[side_image.appearance] height=128 width=128 border=4 style='image-rendering: pixelated;-ms-interpolation-mode: nearest-neighbor'></td>"
477477
content += "</tr></table>"
478478
content = jointext(content, null)
479479

480-
if(front_image && side_image)
481-
user << browse_rsc(front_image, "front.png")
482-
user << browse_rsc(side_image, "side.png")
483-
484480
var/datum/browser/popup = new(user, "idcard", name, 660, 270)
485481
popup.set_content(content)
486482
popup.open()
@@ -534,18 +530,15 @@
534530

535531
/// Sets the UI icon of the ID to their datacore entry, or their current appearance if no record is found.
536532
/obj/item/card/id/proc/set_icon(datum/data/record/R, mutable_appearance/mob_appearance)
537-
set waitfor = FALSE
538533
if(ismob(mob_appearance))
539534
mob_appearance = new(mob_appearance)
540535

541-
CHECK_TICK //Lots of GFI calls happen at once during roundstart, stagger them out a bit
542536
if(R)
543-
var/obj/item/photo/side = R.get_side_photo()
544-
CHECK_TICK
545-
var/obj/item/photo/front = R.get_front_photo()
537+
side_image = new(R.fields["character_appearance"])
538+
side_image.dir = WEST
539+
front_image = new(side_image)
540+
front_image.dir = SOUTH
546541

547-
side_image = side.picture.picture_image
548-
front_image = front.picture.picture_image
549542
else
550543
if(!mob_appearance)
551544
var/mob/M = src
@@ -554,9 +547,14 @@
554547
if(!M)
555548
return
556549
mob_appearance = new(M)
557-
front_image = getFlatIcon(mob_appearance, WEST)
558-
CHECK_TICK
559-
side_image = getFlatIcon(mob_appearance, SOUTH)
550+
551+
remove_non_canon_overlays(mob_appearance)
552+
553+
mob_appearance.dir = SOUTH
554+
front_image = mob_appearance
555+
556+
side_image = new(front_image)
557+
side_image.dir = WEST
560558

561559
/// Returns the trim assignment name.
562560
/obj/item/card/id/proc/get_trim_assignment()

0 commit comments

Comments
 (0)