From c04c1c17ca56b26d01c6191e4bffef059cac2388 Mon Sep 17 00:00:00 2001 From: Geeves Date: Thu, 9 Jul 2020 11:13:06 +0200 Subject: [PATCH] Handy Overlays (#9290) --- code/_onclick/hud/human.dm | 2 ++ code/_onclick/hud/screen_objects.dm | 25 +++++++++++++++--- .../mob/living/carbon/human/update_icons.dm | 8 +++--- code/modules/organs/organ_external.dm | 1 + code/modules/organs/subtypes/standard.dm | 9 +++++++ html/changelogs/geeves-handy.yml | 6 +++++ icons/mob/screen_gen.dmi | Bin 358 -> 892 bytes 7 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 html/changelogs/geeves-handy.yml diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 00cc6c52cae..554169b5acd 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -187,6 +187,8 @@ src.l_hand_hud_object = inv_box src.adding += inv_box + target.update_hud_hands() + using = new /obj/screen/inventory() using.name = "hand" using.icon = ui_style diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 00b2a8efb87..8810a62f8d9 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -448,6 +448,8 @@ // Hand slots are special to handle the handcuffs overlay /obj/screen/inventory/hand var/image/handcuff_overlay + var/image/disabled_hand_overlay + var/image/removed_hand_overlay /obj/screen/inventory/hand/update_icon() ..() @@ -456,8 +458,23 @@ if(!handcuff_overlay) var/state = (hud.l_hand_hud_object == src) ? "l_hand_hud_handcuffs" : "r_hand_hud_handcuffs" handcuff_overlay = image("icon"='icons/mob/screen_gen.dmi', "icon_state" = state) + if(!disabled_hand_overlay) + var/state = (hud.l_hand_hud_object == src) ? "l_hand_disabled" : "r_hand_disabled" + disabled_hand_overlay = image("icon" = 'icons/mob/screen_gen.dmi', "icon_state" = state) + if(!removed_hand_overlay) + var/state = (hud.l_hand_hud_object == src) ? "l_hand_removed" : "r_hand_removed" + removed_hand_overlay = image("icon" = 'icons/mob/screen_gen.dmi', "icon_state" = state) overlays.Cut() - if(hud.mymob && iscarbon(hud.mymob)) - var/mob/living/carbon/C = hud.mymob - if(C.handcuffed) - overlays |= handcuff_overlay + if(hud.mymob && ishuman(hud.mymob)) + var/mob/living/carbon/human/H = hud.mymob + var/obj/item/organ/external/O + if(hud.l_hand_hud_object == src) + O = H.organs_by_name[BP_L_HAND] + else + O = H.organs_by_name[BP_R_HAND] + if(!O || O.is_stump()) + add_overlay(removed_hand_overlay) + else if(O && (!O.is_usable() || O.is_malfunctioning())) + add_overlay(disabled_hand_overlay) + if(H.handcuffed) + add_overlay(handcuff_overlay) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 703ea42c53d..3b77826f653 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -1070,12 +1070,14 @@ There are several things that need to be remembered: if(client) client.screen |= contents if(hud_used) + update_hud_hands() hud_used.hidden_inventory_update() //Updates the screenloc of the items on the 'other' inventory bar //update whether handcuffs appears on our hud. -/mob/living/carbon/proc/update_hud_handcuffed() - if(hud_used && hud_used.l_hand_hud_object && hud_used.r_hand_hud_object) +/mob/living/carbon/proc/update_hud_hands() + if(hud_used?.l_hand_hud_object) hud_used.l_hand_hud_object.update_icon() + if(hud_used?.r_hand_hud_object) hud_used.r_hand_hud_object.update_icon() /mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1) @@ -1098,7 +1100,7 @@ There are several things that need to be remembered: else overlays_raw[HANDCUFF_LAYER] = null - update_hud_handcuffed() + update_hud_hands() if(update_icons) update_icons() diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 1b866e36dbc..780a6db64c1 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -587,6 +587,7 @@ This function completely restores a damaged organ to perfect condition. to_chat(owner, "You feel \the [suit] constrict about your [name], supporting it.") status |= ORGAN_SPLINTED suit.supporting_limbs |= src + owner.update_hud_hands() //Updating germ levels. Handles organ germ levels and necrosis. /* diff --git a/code/modules/organs/subtypes/standard.dm b/code/modules/organs/subtypes/standard.dm index 42545fd75d3..695b4b3f61f 100644 --- a/code/modules/organs/subtypes/standard.dm +++ b/code/modules/organs/subtypes/standard.dm @@ -137,8 +137,17 @@ maim_bonus = 1 augment_limit = 1 +/obj/item/organ/external/hand/take_damage(brute, burn, damage_flags, used_weapon, list/forbidden_limbs, silent) + . = ..() + owner.update_hud_hands() + +/obj/item/organ/external/hand/sever_tendon() + . = ..() + owner.update_hud_hands() + /obj/item/organ/external/hand/removed() owner.drop_from_inventory(owner.gloves) + owner.update_hud_hands() if(body_part == HAND_LEFT) owner.drop_l_hand() else diff --git a/html/changelogs/geeves-handy.yml b/html/changelogs/geeves-handy.yml new file mode 100644 index 00000000000..b83771c22eb --- /dev/null +++ b/html/changelogs/geeves-handy.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Added a HUD overlay to the hand slots which indicate whether the hand is disabled, stumped, or removed." \ No newline at end of file diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index 0700b5e8aa116b2af933cb1e96d153bfbc2a329a..11cef591c1eac02f6de236f3d7a6700faccc005f 100644 GIT binary patch delta 796 zcmV+%1LOSW0{jMliBL{Q4GJ0x0000DNk~Le0001B0000$2m=5B0MhD$JOBUyPEbr# zMF0Q*tCmO@fIg_WfV9e5xP^XhT(Z_X|<%$C`hEOHQ9U5X2TwhTX zb0{W<;{jV;I$bpOOo`E74#FJT?-Mp;VdWa2vI`u~t<-N5#_lqZ+G+Yb4TO4{fBs&B z)cL#mTb|LL6-ahCrLKXmCB%B3)=%7}yKvHTZ_jz&11{7lkXPtQehMkQXcsnh(TMp*ZkuVLdYrDjeU?oU{f+tPel^gBi8YA+eB*F`_~^%d2FVdQ&MBb@0Eq}% AUH||9