From 68e5413136e2c16a263c311fb8e2136f9d939209 Mon Sep 17 00:00:00 2001 From: spookerton Date: Wed, 30 Jun 2021 17:58:26 +0100 Subject: [PATCH] add descriptor scaling, gives humans numbers --- .../human/descriptors/descriptors_generic.dm | 6 ++++ .../mob/living/carbon/human/update_icons.dm | 33 +++++++++++++++---- .../mob/new_player/preferences_setup.dm | 8 +++++ 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/living/carbon/human/descriptors/descriptors_generic.dm b/code/modules/mob/living/carbon/human/descriptors/descriptors_generic.dm index 9c019b9de99..5deb32534d4 100644 --- a/code/modules/mob/living/carbon/human/descriptors/descriptors_generic.dm +++ b/code/modules/mob/living/carbon/human/descriptors/descriptors_generic.dm @@ -20,6 +20,9 @@ "much taller than you", "towering over you" ) + var/list/scale_effect = list( + SPECIES_HUMAN = list(-7, -4, 0, 4, 7) + ) /datum/mob_descriptor/build name = "build" @@ -43,3 +46,6 @@ "built much larger than you", "dwarfing you" ) + var/list/scale_effect = list( + SPECIES_HUMAN = list(-7.5, 0, 0, 0, 7.5) + ) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 341dd9feb61..6de2d8e5dd9 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -189,16 +189,37 @@ Please contact me on #coderbus IRC. ~Carn x overlays = overlays_to_apply - var/matrix/M = matrix() - if(lying) + var/matrix/M = new + var/list/scale = get_scale() + M.Scale(scale[1], scale[2]) + if (lying) M.Turn(90) - M.Scale(size_multiplier) - M.Translate(1, -6-default_pixel_z) + M.Translate(1, -6 - default_pixel_z) else - M.Scale(size_multiplier) - M.Translate(0, 16*(size_multiplier-1)) + M.Translate(0, 16 * (scale[2] - 1)) animate(src, transform = M, time = ANIM_LYING_TIME) + +/mob/living/carbon/human/proc/get_scale() + var/h_mul = LAZYACCESS(descriptors, "height") + if (h_mul) + var/datum/mob_descriptor/height/H = species.descriptors["height"] + if (H) + var/list/scale_effect = H.scale_effect[species.name] + if (scale_effect) + h_mul = 0.01 * scale_effect[h_mul] + var/b_mul = LAZYACCESS(descriptors, "build") + if (b_mul) + var/datum/mob_descriptor/build/B = species.descriptors["build"] + if (B) + var/list/scale_effect = B.scale_effect[species.name] + if (scale_effect) + b_mul = 0.01 * scale_effect[b_mul] + return list( + (1 + b_mul) * size_multiplier, + (1 + h_mul) * size_multiplier + ) + var/global/list/damage_icon_parts = list() /mob/living/carbon/human/proc/get_lying_offset(var/image/I) diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index a1fab642f14..e51e268383f 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -104,16 +104,24 @@ preview_icon = icon('icons/effects/128x48.dmi', bgstate) preview_icon.Scale(48+32, 16+32) + if(LAZYLEN(mannequin.descriptors)) + for(var/entry in body_descriptors) + mannequin.descriptors[entry] = body_descriptors[entry] + var/list/scale = mannequin.get_scale() + mannequin.dir = NORTH var/icon/stamp = getFlatIcon(mannequin, NORTH, always_use_defdir = 1) + stamp.Scale(scale[1] * stamp.Width(), scale[2] * stamp.Height()) preview_icon.Blend(stamp, ICON_OVERLAY, 25, 17) mannequin.dir = WEST stamp = getFlatIcon(mannequin, WEST, always_use_defdir = 1) + stamp.Scale(scale[1] * stamp.Width(), scale[2] * stamp.Height()) preview_icon.Blend(stamp, ICON_OVERLAY, 1, 9) mannequin.dir = SOUTH stamp = getFlatIcon(mannequin, SOUTH, always_use_defdir = 1) + stamp.Scale(scale[1] * stamp.Width(), scale[2] * stamp.Height()) preview_icon.Blend(stamp, ICON_OVERLAY, 49, 1) preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) // Scaling here to prevent blurring in the browser.