From 72194a4d9f8e6584d753fab93306fc67bc09d2a6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 25 Jul 2016 22:54:00 -0400 Subject: [PATCH] Fixed some objects not appearing in photos if they were facing a certain direction with a cheaper implementation than last time. Fixed photo descriptions describing animals with low maximum health as being hurt even when they were not. --- code/__HELPERS/icons.dm | 14 ++++++++++++-- code/modules/paperwork/photography.dm | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 0f4bf8fa162..db09c2a3dca 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -692,7 +692,11 @@ The _flatIcons list is a cache for generated icon files. var/image/copy // Add the atom's icon itself, without pixel_x/y offsets. if(!noIcon) - copy = image(icon=curicon, icon_state=curstate, layer=A.layer, dir=curdir) + var/icon/copyicon = icon(curicon, curstate, dir=curdir) + if(IsBlankIcon(copyicon)) + curdir = SOUTH + copy = image(icon=curicon, icon_state=curstate, layer=A.layer) + copy.dir = curdir copy.color = A.color copy.alpha = A.alpha copy.blend_mode = curblend @@ -915,6 +919,12 @@ var/global/list/friendly_animal_types = list() final_average = BlendRGB(final_average, colour, 1) return final_average +/proc/IsBlankIcon(icon/I) + for(var/y_pixel = 1 to I.Height()) + for(var/x_pixel = 1 to I.Width()) + if(I.GetPixel(x_pixel, y_pixel)) + return 0 + return 1 //Interface for using DrawBox() to draw 1 pixel on a coordinate. //Returns the same icon specifed in the argument, but with the pixel drawn @@ -1006,4 +1016,4 @@ var/global/list/humanoid_icon_cache = list() //Images have dir without being an atom, so they get their own definition. //Lame. /image/proc/setDir(newdir) - dir = newdir + dir = newdir diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index a23c8b993d9..7004b0afcc9 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -258,9 +258,9 @@ holding = "They are holding \a [L.r_hand]" if(!mob_detail) - mob_detail = "You can see [L] on the photo[L.health < 75 ? " - [L] looks hurt":""].[holding ? " [holding]":"."]. " + mob_detail = "You can see [L] on the photo[L.health < (0.75 * L.maxHealth) ? " - [L] looks hurt":""].[holding ? " [holding]":"."]. " else - mob_detail += "You can also see [L] on the photo[L.health < 75 ? " - [L] looks hurt":""].[holding ? " [holding]":"."]." + mob_detail += "You can also see [L] on the photo[L.health < (0.75 * L.maxHealth) ? " - [L] looks hurt":""].[holding ? " [holding]":"."]." return mob_detail