diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 6b8961c9769..62d1d8a6538 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -7,8 +7,12 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s var/lefthand_file = 'icons/mob/inhands/items_lefthand.dmi' var/righthand_file = 'icons/mob/inhands/items_righthand.dmi' - //Dimensions of the lefthand_file and righthand_file vars + //Dimensions of the icon file used when this item is worn, eg: hats.dmi //eg: 32x32 sprite, 64x64 sprite, etc. + //allows inhands/worn sprites to be of any size, but still centered on a mob properly + var/worn_x_dimension = 32 + var/worn_y_dimension = 32 + //Same as above but for inhands, uses the lefthand_ and righthand_ file vars var/inhand_x_dimension = 32 var/inhand_y_dimension = 32 @@ -37,7 +41,9 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s //Since any item can now be a piece of clothing, this has to be put here so all items share it. var/flags_inv //This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc. - var/item_color = null + + var/item_color = null //this needs deprecating, soonish + var/body_parts_covered = 0 //see setup.dm for appropriate bit flags //var/heat_transfer_coefficient = 1 //0 prevents all transfers, 1 is invisible var/gas_transfer_coefficient = 1 // for leaking gas from turf to mask and vice-versa (for masks right now, but at some point, i'd like to include space helmets) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 4083cdc90ff..dc8a5aec3b5 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -76,6 +76,14 @@ BLIND // can't see anything strip_delay = 20 put_on_delay = 40 + +/obj/item/clothing/gloves/worn_overlays(var/isinhands = FALSE) + . = list() + if(!isinhands) + if(blood_DNA) + . += image("icon"='icons/effects/blood.dmi', "icon_state"="bloodyhands") + + // Called just before an attack_hand(), in mob/UnarmedAttack() /obj/item/clothing/gloves/proc/Touch(atom/A, proximity) return 0 // return 1 to cancel attack_hand() @@ -89,6 +97,13 @@ BLIND // can't see anything var/blockTracking = 0 //For AI tracking var/can_toggle = null + +/obj/item/clothing/head/worn_overlays(var/isinhands = FALSE) + . = list() + if(!isinhands) + if(blood_DNA) + . += image("icon"='icons/effects/blood.dmi', "icon_state"="helmetblood") + //Mask /obj/item/clothing/mask name = "mask" @@ -101,6 +116,13 @@ BLIND // can't see anything var/ignore_maskadjust = 1 var/adjusted_flags = null + +/obj/item/clothing/mask/worn_overlays(var/isinhands = FALSE) + . = list() + if(!isinhands) + if(blood_DNA && (body_parts_covered & HEAD)) + . += image("icon"='icons/effects/blood.dmi', "icon_state"="maskblood") + //Override this to modify speech like luchador masks. /obj/item/clothing/mask/proc/speechModification(message) return message @@ -152,10 +174,28 @@ BLIND // can't see anything var/blood_state = BLOOD_STATE_NOT_BLOODY var/list/bloody_shoes = list(BLOOD_STATE_HUMAN = 0,BLOOD_STATE_XENO = 0, BLOOD_STATE_OIL = 0, BLOOD_STATE_NOT_BLOODY = 0) + +/obj/item/clothing/shoes/worn_overlays(var/isinhands = FALSE) + . = list() + if(!isinhands) + var/bloody = 0 + if(blood_DNA) + bloody = 1 + else + bloody = bloody_shoes[BLOOD_STATE_HUMAN] + + if(bloody) + . += image("icon"='icons/effects/blood.dmi', "icon_state"="shoeblood") + + /obj/item/clothing/shoes/clean_blood() ..() bloody_shoes = list(BLOOD_STATE_HUMAN = 0,BLOOD_STATE_XENO = 0, BLOOD_STATE_OIL = 0, BLOOD_STATE_NOT_BLOODY = 0) blood_state = BLOOD_STATE_NOT_BLOODY + if(ismob(loc)) + var/mob/M = loc + M.update_inv_shoes() + /obj/item/proc/negates_gravity() return 0 @@ -171,6 +211,15 @@ BLIND // can't see anything var/blood_overlay_type = "suit" var/togglename = null + +/obj/item/clothing/suit/worn_overlays(var/isinhands = FALSE) + . = list() + if(!isinhands) + if(blood_DNA) + . += image("icon"='icons/effects/blood.dmi', "icon_state"="[blood_overlay_type]blood") + + + //Spacesuit //Note: Everything in modules/clothing/spacesuits should have the entire suit grouped together. // Meaning the the suit is defined directly after the corrisponding helmet. Just like below! @@ -234,6 +283,21 @@ BLIND // can't see anything var/suit_color = null var/obj/item/clothing/tie/hastie = null + +/obj/item/clothing/under/worn_overlays(var/isinhands = FALSE) + . = list() + + if(!isinhands) + if(blood_DNA) + . += image("icon"='icons/effects/blood.dmi', "icon_state"="uniformblood") + + if(hastie) + var/tie_color = hastie.item_color + if(!tie_color) + tie_color = hastie.icon_state + . += image("icon"='icons/mob/ties.dmi', "icon_state"="[tie_color]") + + /obj/item/clothing/under/New() if(random_sensor) sensor_mode = pick(0,1,2,3) @@ -287,8 +351,8 @@ BLIND // can't see anything if(hastie) user << "\A [hastie] is attached to it." -atom/proc/generate_female_clothing(index,t_color,icon,type) - var/icon/female_clothing_icon = icon("icon"=icon, "icon_state"="[t_color]_s") +/proc/generate_female_clothing(index,t_color,icon,type) + var/icon/female_clothing_icon = icon("icon"=icon, "icon_state"=t_color) var/icon/female_s = icon("icon"='icons/mob/uniform.dmi', "icon_state"="[(type == FEMALE_UNIFORM_FULL) ? "female_full" : "female_top"]") female_clothing_icon.Blend(female_s, ICON_MULTIPLY) female_clothing_icon = fcopy_rsc(female_clothing_icon) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 23a29789fea..b3d455f009d 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -248,7 +248,7 @@ var/datum/sprite_accessory/undershirt/U2 = undershirt_list[H.undershirt] if(U2) if(H.dna.species.sexes && H.gender == FEMALE) - standing += H.wear_female_version(U2.icon_state, U2.icon, BODY_LAYER) + standing += wear_female_version(U2.icon_state, U2.icon, BODY_LAYER) else standing += image("icon"=U2.icon, "icon_state"="[U2.icon_state]_s", "layer"=-BODY_LAYER) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index b2230ae11eb..e28ec1d5a3c 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -176,40 +176,22 @@ Please contact me on #coderbus IRC. ~Carnie x if(wear_suit && (wear_suit.flags_inv & HIDEJUMPSUIT)) return + var/t_color = w_uniform.item_color - if(!t_color) t_color = icon_state + if(!t_color) t_color = w_uniform.icon_state var/image/standing - var/iconfile2use //Which icon file to use to generate the overlay and any female alterations. - var/layer2use - - if(U.alternate_worn_icon) - iconfile2use = U.alternate_worn_icon - if(!iconfile2use) - iconfile2use = 'icons/mob/uniform.dmi' - if(U.alternate_worn_layer) - layer2use = U.alternate_worn_layer - if(!layer2use) - layer2use = UNIFORM_LAYER - - standing = image("icon"=iconfile2use, "icon_state"="[t_color]_s", "layer"=-layer2use) - - overlays_standing[UNIFORM_LAYER] = standing - if(dna && dna.species.sexes) var/G = (gender == FEMALE) ? "f" : "m" if(G == "f" && U.fitted != NO_FEMALE_UNIFORM) - standing = wear_female_version(t_color, iconfile2use, UNIFORM_LAYER, U.fitted) - overlays_standing[UNIFORM_LAYER] = standing + standing = U.build_worn_icon(state = "[t_color]_s", default_layer = UNIFORM_LAYER, default_icon_file = 'icons/mob/uniform.dmi', isinhands = FALSE, femaleuniform = U.fitted) - if(w_uniform.blood_DNA) - standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="uniformblood") + if(!standing) + standing = U.build_worn_icon(state = "[t_color]_s", default_layer = UNIFORM_LAYER, default_icon_file = 'icons/mob/uniform.dmi', isinhands = FALSE) + + overlays_standing[UNIFORM_LAYER] = standing - if(U.hastie) - var/tie_color = U.hastie.item_color - if(!tie_color) tie_color = U.hastie.icon_state - standing.overlays += image("icon"='icons/mob/ties.dmi', "icon_state"="[tie_color]") else // Automatically drop anything in store / id / belt if you're not wearing a uniform. //CHECK IF NECESARRY for(var/obj/item/thing in list(r_store, l_store, wear_id, belt)) // @@ -225,7 +207,9 @@ Please contact me on #coderbus IRC. ~Carnie x if(client && hud_used) client.screen += wear_id - overlays_standing[ID_LAYER] = image("icon"='icons/mob/mob.dmi', "icon_state"="id", "layer"=-ID_LAYER) + //TODO: add an icon file for ID slot stuff, so it's less snowflakey + var/image/standing = wear_id.build_worn_icon(state = wear_id.item_state, default_layer = ID_LAYER, default_icon_file = 'icons/mob/mob.dmi') + overlays_standing[ID_LAYER] = standing apply_overlay(ID_LAYER) @@ -241,23 +225,10 @@ Please contact me on #coderbus IRC. ~Carnie x var/t_state = gloves.item_state if(!t_state) t_state = gloves.icon_state - var/layer2use - if(gloves.alternate_worn_layer) - layer2use = gloves.alternate_worn_layer - if(!layer2use) - layer2use = GLOVES_LAYER - - var/image/standing - if(gloves.alternate_worn_icon) - standing = image("icon"=gloves.alternate_worn_icon, "icon_state"="[t_state]", "layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/hands.dmi', "icon_state"="[t_state]", "layer"=-layer2use) + var/image/standing = gloves.build_worn_icon(state = t_state, default_layer = GLOVES_LAYER, default_icon_file = 'icons/mob/hands.dmi') overlays_standing[GLOVES_LAYER] = standing - if(gloves.blood_DNA) - standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="bloodyhands") - else if(blood_DNA) overlays_standing[GLOVES_LAYER] = image("icon"='icons/effects/blood.dmi', "icon_state"="bloodyhands", "layer"=-GLOVES_LAYER) @@ -276,18 +247,8 @@ Please contact me on #coderbus IRC. ~Carnie x client.screen += glasses //Either way, add the item to the HUD if(!(head && (head.flags_inv & HIDEEYES))) - var/layer2use - if(glasses.alternate_worn_layer) - layer2use = glasses.alternate_worn_layer - if(!layer2use) - layer2use = GLASSES_LAYER - - var/image/standing - if(glasses.alternate_worn_icon) - standing = image("icon"=glasses.alternate_worn_icon, "icon_state"="[glasses.icon_state]","layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/eyes.dmi', "icon_state"="[glasses.icon_state]", "layer"=-layer2use) + var/image/standing = glasses.build_worn_icon(state = glasses.icon_state, default_layer = GLASSES_LAYER, default_icon_file = 'icons/mob/eyes.dmi') overlays_standing[GLASSES_LAYER] = standing apply_overlay(GLASSES_LAYER) @@ -302,18 +263,7 @@ Please contact me on #coderbus IRC. ~Carnie x ears.screen_loc = ui_ears //...draw the item in the inventory screen client.screen += ears //Either way, add the item to the HUD - var/layer2use - if(ears.alternate_worn_layer) - layer2use = ears.alternate_worn_layer - if(!layer2use) - layer2use = EARS_LAYER - - var/image/standing - if(ears.alternate_worn_icon) - standing = image("icon"=ears.alternate_worn_icon, "icon_state"="[ears.icon_state]", "layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/ears.dmi', "icon_state"="[ears.icon_state]", "layer"=-layer2use) - + var/image/standing = ears.build_worn_icon(state = ears.icon_state, default_layer = EARS_LAYER, default_icon_file = 'icons/mob/ears.dmi') overlays_standing[EARS_LAYER] = standing apply_overlay(EARS_LAYER) @@ -328,30 +278,9 @@ Please contact me on #coderbus IRC. ~Carnie x shoes.screen_loc = ui_shoes //...draw the item in the inventory screen client.screen += shoes //Either way, add the item to the HUD - var/layer2use - if(shoes.alternate_worn_layer) - layer2use = shoes.alternate_worn_layer - if(!layer2use) - layer2use = SHOES_LAYER - - var/image/standing - if(shoes.alternate_worn_icon) - standing = image("icon"=shoes.alternate_worn_icon, "icon_state"="[shoes.icon_state]","layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/feet.dmi', "icon_state"="[shoes.icon_state]", "layer"=-layer2use) + var/image/standing = shoes.build_worn_icon(state = shoes.icon_state, default_layer = SHOES_LAYER, default_icon_file = 'icons/mob/feet.dmi') overlays_standing[SHOES_LAYER] = standing - //Bloody shoes - var/obj/item/clothing/shoes/S = shoes - var/bloody = 0 - if(shoes.blood_DNA) - bloody = 1 - else - bloody = S.bloody_shoes[BLOOD_STATE_HUMAN] - - if(bloody) - standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="shoeblood") - apply_overlay(SHOES_LAYER) @@ -391,23 +320,14 @@ Please contact me on #coderbus IRC. ~Carnie x if(client && hud_used) client.screen += belt + var/t_state = belt.item_state if(!t_state) t_state = belt.icon_state - var/layer2use - if(belt.alternate_worn_layer) - layer2use = belt.alternate_worn_layer - if(!layer2use) - layer2use = BELT_LAYER - - var/image/standing - if(belt.alternate_worn_icon) - standing = image("icon"=belt.alternate_worn_icon, "icon_state"="[t_state]", "layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/belt.dmi', "icon_state"="[t_state]", "layer"=-layer2use) - + var/image/standing = belt.build_worn_icon(state = t_state, default_layer = BELT_LAYER, default_icon_file = 'icons/mob/belt.dmi') overlays_standing[BELT_LAYER] = standing + apply_overlay(BELT_LAYER) @@ -421,18 +341,7 @@ Please contact me on #coderbus IRC. ~Carnie x wear_suit.screen_loc = ui_oclothing //TODO //...draw the item in the inventory screen client.screen += wear_suit //Either way, add the item to the HUD - - var/layer2use - if(wear_suit.alternate_worn_layer) - layer2use = wear_suit.alternate_worn_layer - if(!layer2use) - layer2use = SUIT_LAYER - - var/image/standing - if(wear_suit.alternate_worn_icon) - standing = image("icon"=wear_suit.alternate_worn_icon, "icon_state"="[wear_suit.icon_state]", "layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/suit.dmi', "icon_state"="[wear_suit.icon_state]", "layer"=-layer2use) + var/image/standing = wear_suit.build_worn_icon(state = wear_suit.icon_state, default_layer = SUIT_LAYER, default_icon_file = 'icons/mob/suit.dmi') overlays_standing[SUIT_LAYER] = standing if(istype(wear_suit, /obj/item/clothing/suit/straight_jacket)) @@ -440,10 +349,6 @@ Please contact me on #coderbus IRC. ~Carnie x drop_l_hand() drop_r_hand() - if(wear_suit.blood_DNA) - var/obj/item/clothing/suit/S = wear_suit - standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="[S.blood_overlay_type]blood") - src.update_hair() src.update_mutant_bodyparts() @@ -498,7 +403,7 @@ Please contact me on #coderbus IRC. ~Carnie x hud_used.hidden_inventory_update() //Updates the screenloc of the items on the 'other' inventory bar -/mob/living/carbon/human/proc/wear_female_version(t_color, icon, layer, type) +/proc/wear_female_version(t_color, icon, layer, type) var/index = "[t_color]_s" var/icon/female_clothing_icon = female_clothing_icons[index] if(!female_clothing_icon) //Create standing/laying icons if they don't exist @@ -513,4 +418,68 @@ Please contact me on #coderbus IRC. ~Carnie x if(i in unwantedLayers) continue out += overlays_standing[i] - return out \ No newline at end of file + return out + + + + +/* +Does everything in relation to building the /image used in the mob's overlays list +covers: + inhands and any other form of worn item + centering large images + layering images on custom layers + building images from custom icon files + +By Remie Richards (yes I'm taking credit because this just removed 90% of the copypaste in update_icons()) + +state: A string to use as the state, this is FAR too complex to solve in this proc thanks to shitty old code +so it's specified as an argument instead. + +default_layer: The layer to draw this on if no other layer is specified + +default_icon_file: The icon file to draw states from if no other icon file is specified + +isinhands: If true then alternate_worn_icon is skipped so that default_icon_file is used, +in this situation default_icon_file is expected to match either the lefthand_ or righthand_ file var + +femalueuniform: A value matching a uniform item's fitted var, if this is anything but NO_FEMALE_UNIFORM, we +generate/load female uniform sprites matching all previously decided variables + + +*/ +/obj/item/proc/build_worn_icon(var/state = "", var/default_layer = 0, var/default_icon_file = null, var/isinhands = FALSE, var/femaleuniform = NO_FEMALE_UNIFORM) + + //Find a valid icon file from variables+arguments + var/file2use + if(!isinhands && alternate_worn_icon) + file2use = alternate_worn_icon + if(!file2use) + file2use = default_icon_file + + //Find a valid layer from variables+arguments + var/layer2use + if(alternate_worn_layer) + layer2use = alternate_worn_layer + if(!layer2use) + layer2use = default_layer + + var/image/standing + if(femaleuniform) + standing = wear_female_version(state,file2use,layer2use,femaleuniform) + if(!standing) + standing = image("icon"=file2use, "icon_state"=state,"layer"=-layer2use) + + //Get the overlay images for this item when it's being worn + //eg: ammo counters, primed grenade flashes, etc. + var/list/worn_overlays = worn_overlays(isinhands) + if(worn_overlays && worn_overlays.len) + standing.overlays.Add(worn_overlays) + + standing = center_image(standing, isinhands ? inhand_x_dimension : worn_x_dimension, isinhands ? inhand_y_dimension : worn_y_dimension) + + standing.alpha = alpha + standing.color = color + + return standing + diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm index 7c6c62f0fb0..22b438cc53e 100644 --- a/code/modules/mob/living/carbon/update_icons.dm +++ b/code/modules/mob/living/carbon/update_icons.dm @@ -49,13 +49,13 @@ r_hand.screen_loc = ui_rhand if(client && hud_used) client.screen += r_hand + var/t_state = r_hand.item_state if(!t_state) t_state = r_hand.icon_state - var/image/I = image("icon" = r_hand.righthand_file, "icon_state"="[t_state]", "layer"=-R_HAND_LAYER) - I = center_image(I, r_hand.inhand_x_dimension, r_hand.inhand_y_dimension) - overlays_standing[R_HAND_LAYER] = I + var/image/standing = r_hand.build_worn_icon(state = t_state, default_layer = R_HAND_LAYER, default_icon_file = r_hand.righthand_file, isinhands = TRUE) + overlays_standing[R_HAND_LAYER] = standing apply_overlay(R_HAND_LAYER) @@ -68,13 +68,13 @@ l_hand.screen_loc = ui_lhand if(client && hud_used) client.screen += l_hand + var/t_state = l_hand.item_state if(!t_state) t_state = l_hand.icon_state - var/image/I = image("icon" = l_hand.lefthand_file, "icon_state"="[t_state]", "layer"=-L_HAND_LAYER) - I = center_image(I, l_hand.inhand_x_dimension, l_hand.inhand_y_dimension) - overlays_standing[L_HAND_LAYER] = I + var/image/standing = l_hand.build_worn_icon(state = t_state, default_layer = L_HAND_LAYER, default_icon_file = l_hand.lefthand_file, isinhands = TRUE) + overlays_standing[L_HAND_LAYER] = standing apply_overlay(L_HAND_LAYER) @@ -105,40 +105,16 @@ if(istype(wear_mask, /obj/item/clothing/mask)) if(!(head && (head.flags_inv & HIDEMASK))) - var/layer2use - if(wear_mask.alternate_worn_layer) - layer2use = wear_mask.alternate_worn_layer - if(!layer2use) - layer2use = FACEMASK_LAYER - - var/image/standing - if(wear_mask.alternate_worn_icon) - standing = image("icon"=wear_mask.alternate_worn_icon, "icon_state"="[wear_mask.icon_state]", "layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/mask.dmi', "icon_state"="[wear_mask.icon_state]", "layer"=-layer2use) + var/image/standing = wear_mask.build_worn_icon(state = wear_mask.icon_state, default_layer = FACEMASK_LAYER, default_icon_file = 'icons/mob/mask.dmi') overlays_standing[FACEMASK_LAYER] = standing - - if(wear_mask.blood_DNA && (wear_mask.body_parts_covered & HEAD)) - standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="maskblood") return wear_mask /mob/living/carbon/update_inv_back() remove_overlay(BACK_LAYER) if(back) - var/layer2use - if(back.alternate_worn_layer) - layer2use = back.alternate_worn_layer - if(!layer2use) - layer2use = BACK_LAYER - - var/image/standing - if(back.alternate_worn_icon) - standing = image("icon"=back.alternate_worn_icon, "icon_state"="[back.icon_state]", "layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/back.dmi', "icon_state"="[back.icon_state]", "layer"=-layer2use) - + var/image/standing = back.build_worn_icon(state = back.icon_state, default_layer = BACK_LAYER, default_icon_file = 'icons/mob/back.dmi') overlays_standing[BACK_LAYER] = standing return back @@ -147,24 +123,8 @@ remove_overlay(HEAD_LAYER) if(head) - var/layer2use - if(head.alternate_worn_layer) - layer2use = head.alternate_worn_layer - if(!layer2use) - layer2use = HEAD_LAYER - - var/image/standing - if(head.alternate_worn_icon) - standing = image("icon"=head.alternate_worn_icon, "icon_state"="[head.icon_state]", "layer"=-layer2use) - if(!standing) - standing = image("icon"='icons/mob/head.dmi', "icon_state"="[head.icon_state]", "layer"=-layer2use) - standing.color = head.color // For now, this is here solely for kitty ears, but everything should do this eventually - standing.alpha = head.alpha - + var/image/standing = head.build_worn_icon(state = head.icon_state, default_layer = HEAD_LAYER, default_icon_file = 'icons/mob/head.dmi') overlays_standing[HEAD_LAYER] = standing - - if(head.blood_DNA) - standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="helmetblood") return head /mob/living/carbon/update_inv_handcuffed() @@ -188,6 +148,12 @@ +//Overlays for the worn overlay so you can overlay while you overlay +//eg: ammo counters, primed grenade flashing, etc. +/obj/item/proc/worn_overlays(var/isinhands = FALSE) + . = list() + + diff --git a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm index 4f941d1582c..e1a4aa46aac 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm @@ -25,13 +25,14 @@ var/y_shift = getItemPixelShiftY() if(r_hand) + var/r_state = r_hand.item_state if(!r_state) r_state = r_hand.icon_state - var/image/r_hand_image = image("icon" = r_hand.righthand_file, "icon_state"="[r_state]", "layer"=-DRONE_HANDS_LAYER) - if(y_shift != 0) - r_hand_image.pixel_y = y_shift + var/image/r_hand_image = r_hand.build_worn_icon(state = r_state, default_layer = DRONE_HANDS_LAYER, default_icon_file = r_hand.righthand_file, isinhands = TRUE) + if(y_shift) + r_hand_image.pixel_y += y_shift hands_overlays += r_hand_image @@ -41,13 +42,14 @@ client.screen |= r_hand if(l_hand) + var/l_state = l_hand.item_state if(!l_state) l_state = l_hand.icon_state - var/image/l_hand_image = image("icon" = l_hand.lefthand_file, "icon_state"="[l_state]", "layer"=-DRONE_HANDS_LAYER) - if(y_shift != 0) - l_hand_image.pixel_y = y_shift + var/image/l_hand_image = l_hand.build_worn_icon(state = l_state, default_layer = DRONE_HANDS_LAYER, default_icon_file = l_hand.righthand_file, isinhands = TRUE) + if(y_shift) + l_hand_image.pixel_y += y_shift hands_overlays += l_hand_image @@ -76,13 +78,8 @@ head.screen_loc = ui_drone_head client.screen += head - - var/image/head_overlay = image("icon"='icons/mob/head.dmi', "icon_state"="[head.icon_state]", "layer"=-DRONE_HEAD_LAYER) - if(istype(head, /obj/item/clothing/mask)) - head_overlay.icon = 'icons/mob/mask.dmi' - head_overlay.color = head.color - head_overlay.alpha = head.alpha - head_overlay.pixel_y = -15 + var/image/head_overlay = head.build_worn_icon(state = icon_state, default_layer = DRONE_HEAD_LAYER, default_icon_file = 'icons/mob/head.dmi') + head_overlay.pixel_y += -15 drone_overlays[DRONE_HEAD_LAYER] = head_overlay diff --git a/icons/mob/mob.dmi b/icons/mob/mob.dmi index f5a78d01cdd..9b28bc46533 100644 Binary files a/icons/mob/mob.dmi and b/icons/mob/mob.dmi differ