Skip to content

Commit

Permalink
welp time to give up
Browse files Browse the repository at this point in the history
  • Loading branch information
Superlagg committed Jun 16, 2024
1 parent ee20300 commit 4a471b1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 36 deletions.
8 changes: 6 additions & 2 deletions code/_globalvars/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,12 @@ GLOBAL_LIST_INIT(bodypart_names, list(num2text(HEAD) = "Head", num2text(CHEST) =
GLOBAL_LIST_INIT(bodypart_values, list("Head" = num2text(HEAD), "Chest" = num2text(CHEST), "Left Leg" = num2text(LEG_LEFT), "Right Leg" = num2text(LEG_RIGHT), "Left Arm" = num2text(ARM_LEFT), "Right Arm" = num2text(ARM_RIGHT)))

GLOBAL_LIST_INIT(limb_mask_key_icons, list(
"yinglet" = 'icons/mob/mam/citadel/yinglet_masks.dmi'
))
"yinglet" = list(
BODY_ZONE_L_ARM = 'icons/mob/mam/citadel/yinglet_masks.dmi',
BODY_ZONE_R_ARM = 'icons/mob/mam/citadel/yinglet_masks.dmi',
BODY_ZONE_L_LEG = 'icons/mob/mam/citadel/yinglet_masks.dmi',
BODY_ZONE_R_LEG = 'icons/mob/mam/citadel/yinglet_masks.dmi',
)))

#define ALL_TYPICAL_BIO_LIMB_IDS "mammal","aquatic","avian", "human", "shadekin", "yinglet"
#define ALL_TYPICAL_SYNTH_LIMB_IDS ALL_TYPICAL_BIO_LIMB_IDS, "protectron", "golem"
Expand Down
75 changes: 42 additions & 33 deletions code/modules/surgery/bodyparts/_bodyparts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,6 @@
digitigrade_type = lowertext(H.dna.features["legs"])
if(digitigrade_type == "yinglet")
digitigrade_type = "digitigrade"
mask_key = "Yinglet"
else
digitigrade_type = null

Expand Down Expand Up @@ -815,6 +814,28 @@
I.pixel_y = px_y
add_overlay(standing)

/obj/item/bodypart/proc/get_limb_mask_icon()
if(!mask_key)
return
var/list/paquet = LAZYACCESS(GLOB.limb_mask_key_icons, lowertext(mask_key))
if(!LAZYLEN(paquet))
return
return LAZYACCESS(paquet, body_zone)

/obj/item/bodypart/proc/apply_alpha_mask(image/imgin, state_override, layer_value, direction)
if(!mask_key || !imgin)
return imgin
var/mask_icon = get_limb_mask_icon()
if(!mask_icon)
return imgin
var/st8 = (state_override || "[body_zone]_mask")
var/image/mask = image(mask_icon, st8)
return mask
// imgin.overlays += mask
// // mask.render_source = st8
// // imgin.filters += filter(type="alpha", render_source=st8, flags=MASK_INVERSE)
// return imgin

//Gives you a proper icon appearance for the dismembered limb
/obj/item/bodypart/proc/get_limb_icon(dropped)
cut_overlays()
Expand All @@ -825,7 +846,6 @@
var/image_dir = 0
var/icon_gender = (body_gender == FEMALE) ? "f" : "m" //gender of the icon, if applicable
var/digitype = digitigrade_type
var/icon/mask_icon = mask_key ? GLOB.limb_mask_key_icons[lowertext(mask_key)] : null //get the mask icon for the limb

if(dropped)
image_dir = SOUTH
Expand All @@ -846,10 +866,7 @@
markimage = image(marking_list[1], "[marking_list[2]]_[body_zone]", -onmob_markings_layer, image_dir)
else
markimage = image(marking_list[1], "[marking_list[2]]_[digitype]_[use_digitigrade]_[body_zone]", -onmob_markings_layer, image_dir)
if(mask_icon) // yes yes
var/image/I2 = image(mask_icon, "[body_zone]_mask", -onmob_markings_layer, image_dir)
markimage.filters += filter(type = "alpha", icon = I2)
. += markimage
. += apply_alpha_mask(markimage, null, -onmob_markings_layer, image_dir)

var/image/limb = image(layer = -onmob_layer, dir = image_dir)
var/image/second_limb
Expand Down Expand Up @@ -885,9 +902,7 @@
limb.icon_state = "[species_id]_[digitype]_[use_digitigrade]_[body_zone]"
else
limb.icon_state = "[species_id]_[body_zone]"
if(mask_icon)
var/image/I = image(mask_icon, "[body_zone]_mask", -onmob_markings_layer, image_dir)
limb.filters += filter(type = "alpha", icon = I)
limb = apply_alpha_mask(limb, null, -onmob_layer, image_dir)

if(istype(src, /obj/item/bodypart/l_leg) || istype(src, /obj/item/bodypart/r_leg))
second_limb = image(layer = -BODYPARTS_LAYER, dir = image_dir)
Expand All @@ -903,44 +918,42 @@
else
for(var/list/marking_list in body_markings_list)
// marking stores icon and value for the specific bodypart
var/image/mark
if(!use_digitigrade)
if(body_zone == BODY_ZONE_CHEST)
markings_list.Add(image(marking_list[1], "[marking_list[2]]_[body_zone]_[icon_gender]", -onmob_markings_layer, image_dir))
mark = (image(marking_list[1], "[marking_list[2]]_[body_zone]_[icon_gender]", -onmob_markings_layer, image_dir))
else
markings_list.Add(image(marking_list[1], "[marking_list[2]]_[body_zone]", -onmob_markings_layer, image_dir))
mark = (image(marking_list[1], "[marking_list[2]]_[body_zone]", -onmob_markings_layer, image_dir))
else
markings_list.Add(image(marking_list[1], "[marking_list[2]]_[digitype]_[use_digitigrade]_[body_zone]", -onmob_markings_layer, image_dir))
mark = (image(marking_list[1], "[marking_list[2]]_[digitype]_[use_digitigrade]_[body_zone]", -onmob_markings_layer, image_dir))

mark = apply_alpha_mask(mark, null, -onmob_markings_layer, image_dir)
markings_list += mark
if(color_src && length(marking_list) == 3)
var/image/I = markings_list[length(markings_list)]
I.color = marking_list[3]

. += markings_list

// Citadel End

if(aux_icons)
for(var/I in aux_icons)
var/aux_layer = aux_icons[I]
aux += image(limb.icon, "[species_id]_[I]", -aux_layer, image_dir)
var/image/auximg = image(limb.icon, "[species_id]_[I]", -aux_layer, image_dir)
auximg = apply_alpha_mask(auximg, I, -aux_layer, image_dir)
aux += auximg
if(species_id == "husk")
auxmarking += image('icons/mob/mam/citadel/markings_notmammals.dmi', "husk_[I]", -aux_layer, image_dir)
else
for(var/marking_list in body_markings_list)
var/image/aux_marking_image = image(marking_list[1], "[marking_list[2]]_[I]", -aux_layer, image_dir)
if(length(marking_list) == 3)
aux_marking_image.color = marking_list[3]
aux_marking_image = apply_alpha_mask(aux_marking_image, I, -aux_layer, image_dir)
auxmarking += aux_marking_image
. += aux
. += auxmarking
if(mask_icon)
for(var/image/img in aux)
var/image/mask = image(mask_icon, "[body_zone]_mask", -img.layer, img.dir)
if(mask)
img.filters += filter(type = "alpha", icon = mask)
for(var/image/img in auxmarking)
var/image/mask = image(mask_icon, "[body_zone]_mask", -img.layer, img.dir)
if(mask)
img.filters += filter(type = "alpha", icon = mask)


else
Expand All @@ -953,14 +966,17 @@
if(aux_icons)
for(var/I in aux_icons)
var/aux_layer = aux_icons[I]
aux += image(limb.icon, "[I]", -aux_layer, image_dir)
var/image/auximg = image(limb.icon, "[I]", -aux_layer, image_dir)
auximg = apply_alpha_mask(auximg, null, -aux_layer, image_dir)
aux += auximg
if(species_id == "husk")
auxmarking += image('icons/mob/mam/citadel/markings_notmammals.dmi', "husk_[I]", -aux_layer, image_dir)
else
for(var/marking_list in body_markings_list)
var/image/aux_marking_image = image(marking_list[1], "[marking_list[2]]_[I]", -aux_layer, image_dir)
if(length(marking_list) == 3)
aux_marking_image.color = marking_list[3]
aux_marking_image = apply_alpha_mask(aux_marking_image, null, -aux_layer, image_dir)
auxmarking += aux_marking_image
. += auxmarking
. += aux
Expand All @@ -981,9 +997,7 @@
MK = image(marking_list[1], "[marking_list[2]]_[body_zone]", -onmob_markings_layer, image_dir)
else
MK = image(marking_list[1], "[marking_list[2]]_[digitype]_[use_digitigrade]_[body_zone]", -onmob_markings_layer, image_dir)
if(mask_icon)
var/image/I = image(mask_icon, "[body_zone]_mask", -onmob_markings_layer, image_dir)
MK.filters += filter(type = "alpha", icon = I)
MK = apply_alpha_mask(MK, null, -onmob_markings_layer, image_dir)
. += MK
return

Expand Down Expand Up @@ -1021,13 +1035,8 @@
limb.icon_state = "[original_state]_front"
second_limb.icon_state = "[original_state]_behind"
second_limb.color = limb.color
if(mask_icon)
var/image/L1 = image(mask_icon, "[original_state]_front_mask", -onmob_markings_layer, image_dir)
if(L1)
limb.filters += filter(type = "alpha", icon = L1)
var/image/L2 = image(mask_icon, "[original_state]_behind_mask", -onmob_markings_layer, image_dir)
if(L2)
second_limb.filters += filter(type = "alpha", icon = L2)
limb = apply_alpha_mask(limb, "[original_state]_front", -onmob_layer, image_dir)
second_limb = apply_alpha_mask(second_limb, "[original_state]_behind", -onmob_layer, image_dir)

/obj/item/bodypart/deconstruct(disassembled = TRUE)
drop_organs()
Expand Down
6 changes: 5 additions & 1 deletion code/modules/surgery/bodyparts/helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,14 @@
/mob/living/carbon/proc/Digitigrade_Leg_Swap(swap_back)
for(var/X in bodyparts)
var/obj/item/bodypart/O = X
O.mask_key = dna.features["legs"]
if(swap_back)
O.mask_key = null
else
O.mask_key = dna.features["legs"]
O.update_limb(FALSE, src)
if((O.body_part == LEG_LEFT || O.body_part == LEG_RIGHT) && ((!O.use_digitigrade && !swap_back) || (O.use_digitigrade && swap_back)))
O.use_digitigrade = swap_back ? NOT_DIGITIGRADE : FULL_DIGITIGRADE
update_body()

if(ishuman(src))
var/mob/living/carbon/human/H = src
Expand Down
Binary file modified icons/mob/mam/citadel/yinglet_masks.dmi
Binary file not shown.

0 comments on commit 4a471b1

Please sign in to comment.