[MIRROR] Improves Records code to use existing humans instead of dummies to create security record mugshots [MDB IGNORE] (#15242)

* Improves Records code to use existing humans instead of dummies to create security record mugshots (#68706)

* Adds get_flat_existing_human_icon()

* Improves on manifest_inject() by using get_flat_existing_human_icon() instead of get_flat_human_icon()

* Improves Records code to use existing humans instead of dummies to create security record mugshots

* I don't like having to do that, but you gotta do what you gotta do

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
SkyratBot
2022-07-31 03:44:06 +02:00
committed by GitHub
parent 3a6afad423
commit 04bc0df465
2 changed files with 40 additions and 33 deletions

View File

@@ -1033,6 +1033,35 @@ GLOBAL_LIST_EMPTY(friendly_animal_types)
return out_icon
/**
* A simpler version of get_flat_human_icon() that uses an existing human as a base to create the icon.
* Does not feature caching yet, since I could not think of a good way to cache them without having a possibility
* of using the cached version when we don't want to, so only use this proc if you just need this flat icon
* generated once.
*
* Arguments:
* * existing_human - The human we want to get a flat icon out of.
* * directions_to_output - The directions of the resulting flat icon, defaults to all cardinal directions.
*/
/proc/get_flat_existing_human_icon(mob/living/carbon/human/existing_human, directions_to_output = GLOB.cardinals)
RETURN_TYPE(/icon)
if(!existing_human || !istype(existing_human))
CRASH("Attempted to call get_flat_existing_human_icon on a [existing_human ? existing_human.type : "null"].")
// We need to force the dir of the human so we can take those pictures, we'll set it back afterwards.
var/initial_human_dir = existing_human.dir
existing_human.dir = SOUTH
var/icon/out_icon = icon('icons/effects/effects.dmi', "nothing")
COMPILE_OVERLAYS(existing_human)
for(var/direction in directions_to_output)
var/icon/partial = getFlatIcon(existing_human, defdir = direction)
out_icon.Insert(partial, dir = direction)
existing_human.dir = initial_human_dir
return out_icon
//Hook, override to run code on- wait this is images
//Images have dir without being an atom, so they get their own definition.
//Lame.