From b26868a6b7a44c7f8fd7fd82f3f43efd7d9a40ba Mon Sep 17 00:00:00 2001 From: Robustin Date: Sat, 31 Mar 2018 00:02:09 -0400 Subject: [PATCH 1/2] Get_Flat_Human_Icon no longer draws asses that nobody wants (#36781) * Argument to limit excess icon work * 50% less icon for your icon * 75% less icon for your icon * Correction * statics the list, tweaks a default arg * Cardinal argument list * correct GLOB name --- code/__HELPERS/icons.dm | 27 ++++++--------------------- code/datums/datacore.dm | 14 +++++++++----- code/modules/antagonists/cult/cult.dm | 2 +- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 0e5fff082c..be886298a7 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1041,7 +1041,7 @@ GLOBAL_LIST_EMPTY(friendly_animal_types) return 0 //For creating consistent icons for human looking simple animals -/proc/get_flat_human_icon(icon_id, datum/job/J, datum/preferences/prefs, dummy_key) +/proc/get_flat_human_icon(icon_id, datum/job/J, datum/preferences/prefs, dummy_key, showDirs = GLOB.cardinals) var/static/list/humanoid_icon_cache = list() if(!icon_id || !humanoid_icon_cache[icon_id]) var/mob/living/carbon/human/dummy/body = generate_or_wait_for_human_dummy(dummy_key) @@ -1053,26 +1053,11 @@ GLOBAL_LIST_EMPTY(friendly_animal_types) var/icon/out_icon = icon('icons/effects/effects.dmi', "nothing") - - body.setDir(NORTH) - COMPILE_OVERLAYS(body) - var/icon/partial = getFlatIcon(body) - out_icon.Insert(partial,dir=NORTH) - - body.setDir(SOUTH) - COMPILE_OVERLAYS(body) - partial = getFlatIcon(body) - out_icon.Insert(partial,dir=SOUTH) - - body.setDir(WEST) - COMPILE_OVERLAYS(body) - partial = getFlatIcon(body) - out_icon.Insert(partial,dir=WEST) - - body.setDir(EAST) - COMPILE_OVERLAYS(body) - partial = getFlatIcon(body) - out_icon.Insert(partial,dir=EAST) + for(var/D in showDirs) + body.setDir(D) + COMPILE_OVERLAYS(body) + var/icon/partial = getFlatIcon(body) + out_icon.Insert(partial,dir=D) humanoid_icon_cache[icon_id] = out_icon dummy_key? unset_busy_human_dummy(dummy_key) : qdel(body) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index c22af19396..c88a86c092 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -199,6 +199,7 @@ /datum/datacore/proc/manifest_inject(mob/living/carbon/human/H, client/C) set waitfor = FALSE + var/static/list/show_directions = list(SOUTH, WEST) if(H.mind && (H.mind.assigned_role != H.mind.special_role)) var/assignment if(H.mind.assigned_role) @@ -212,11 +213,14 @@ var/id = num2hex(record_id_num++,6) if(!C) C = H.client - var/image = get_id_photo(H, C) + var/image = get_id_photo(H, C, show_directions) var/obj/item/photo/photo_front = new() var/obj/item/photo/photo_side = new() - photo_front.photocreate(null, icon(image, dir = SOUTH)) - photo_side.photocreate(null, icon(image, dir = WEST)) + for(var/D in show_directions) + if(D == SOUTH) + photo_front.photocreate(null, icon(image, dir = D)) + if(D == WEST || D == EAST) + photo_side.photocreate(null, icon(image, dir = D)) //These records should ~really~ be merged or something //General Record @@ -279,11 +283,11 @@ locked += L return -/datum/datacore/proc/get_id_photo(mob/living/carbon/human/H, client/C) +/datum/datacore/proc/get_id_photo(mob/living/carbon/human/H, client/C, show_directions = list(SOUTH)) var/datum/job/J = SSjob.GetJob(H.mind.assigned_role) var/datum/preferences/P if(!C) C = H.client if(C) P = C.prefs - return get_flat_human_icon(null, J, P, DUMMY_HUMAN_SLOT_MANIFEST) + return get_flat_human_icon(null, J, P, DUMMY_HUMAN_SLOT_MANIFEST, show_directions) diff --git a/code/modules/antagonists/cult/cult.dm b/code/modules/antagonists/cult/cult.dm index ae8bec2537..80947fec16 100644 --- a/code/modules/antagonists/cult/cult.dm +++ b/code/modules/antagonists/cult/cult.dm @@ -241,7 +241,7 @@ var/datum/job/sacjob = SSjob.GetJob(sac_objective.target.assigned_role) var/datum/preferences/sacface = sac_objective.target.current.client.prefs - var/icon/reshape = get_flat_human_icon(null, sacjob, sacface) + var/icon/reshape = get_flat_human_icon(null, sacjob, sacface, list(SOUTH)) reshape.Shift(SOUTH, 4) reshape.Shift(EAST, 1) reshape.Crop(7,4,26,31)