Skip to content

Commit

Permalink
IDs take advantage of 515 technology (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kapu1178 authored Mar 30, 2024
1 parent c129e64 commit 93a7e33
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
12 changes: 12 additions & 0 deletions code/controllers/subsystem/overlays.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,15 @@ SUBSYSTEM_DEF(overlays)
overlays |= cached_other
else if(cut_old)
cut_overlays()

/// Recursively removes overlays that do not render to the game plane from an appearance.
/proc/remove_non_canon_overlays(mutable_appearance/appearance)
for(var/mutable_appearance/overlay as anything in appearance.overlays)
if(overlay.plane != GAME_PLANE && overlay.plane != FLOAT_PLANE)
appearance.overlays -= overlay

if(length(overlay.overlays))
appearance.overlays -= overlay
appearance.overlays += .(new /mutable_appearance(overlay))

return appearance
1 change: 1 addition & 0 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
C = H.client

var/mutable_appearance/character_appearance = new(H.appearance)
remove_non_canon_overlays(character_appearance)

//These records should ~really~ be merged or something
//General Record
Expand Down
32 changes: 15 additions & 17 deletions code/game/objects/items/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
/// Registered owner's blood type.
var/blood_type = "UNSET"
// Images to store in the ID, based on the datacore.
var/icon/front_image
var/icon/side_image
var/mutable_appearance/front_image
var/mutable_appearance/side_image

/// The job name registered on the card (for example: Assistant). Set by trim usually.
var/assignment
Expand Down Expand Up @@ -473,14 +473,10 @@
content += "Fingerprint: [fingerprint]<br>"
content += "DNA Hash: [dna_hash]<br>"
if(front_image && side_image)
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>"
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>"
content += "</tr></table>"
content = jointext(content, null)

if(front_image && side_image)
user << browse_rsc(front_image, "front.png")
user << browse_rsc(side_image, "side.png")

var/datum/browser/popup = new(user, "idcard", name, 660, 270)
popup.set_content(content)
popup.open()
Expand Down Expand Up @@ -534,18 +530,15 @@

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

CHECK_TICK //Lots of GFI calls happen at once during roundstart, stagger them out a bit
if(R)
var/obj/item/photo/side = R.get_side_photo()
CHECK_TICK
var/obj/item/photo/front = R.get_front_photo()
side_image = new(R.fields["character_appearance"])
side_image.dir = WEST
front_image = new(side_image)
front_image.dir = SOUTH

side_image = side.picture.picture_image
front_image = front.picture.picture_image
else
if(!mob_appearance)
var/mob/M = src
Expand All @@ -554,9 +547,14 @@
if(!M)
return
mob_appearance = new(M)
front_image = getFlatIcon(mob_appearance, WEST)
CHECK_TICK
side_image = getFlatIcon(mob_appearance, SOUTH)

remove_non_canon_overlays(mob_appearance)

mob_appearance.dir = SOUTH
front_image = mob_appearance

side_image = new(front_image)
side_image.dir = WEST

/// Returns the trim assignment name.
/obj/item/card/id/proc/get_trim_assignment()
Expand Down

0 comments on commit 93a7e33

Please sign in to comment.