diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 709117de8c5..57e1e4bb6ad 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -158,7 +158,8 @@ using.alpha = ui_alpha src.adding += using - inv_box = new /obj/screen/inventory() + inv_box = new /obj/screen/inventory/hand() + inv_box.hud = src inv_box.name = "r_hand" inv_box.icon = ui_style inv_box.icon_state = "r_hand_inactive" @@ -173,7 +174,8 @@ src.r_hand_hud_object = inv_box src.adding += inv_box - inv_box = new /obj/screen/inventory() + inv_box = new /obj/screen/inventory/hand() + inv_box.hud = src inv_box.name = "l_hand" inv_box.icon = ui_style inv_box.icon_state = "l_hand_inactive" diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index d899f620499..3f6758c6ad2 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -12,6 +12,7 @@ layer = 20.0 unacidable = 1 var/obj/master = null //A reference to the object in the slot. Grabs or items, generally. + var/datum/hud/hud = null // A reference to the owner HUD, if any. /obj/screen/Destroy() master = null @@ -507,3 +508,20 @@ usr.update_inv_l_hand(0) usr.update_inv_r_hand(0) return 1 + +// Hand slots are special to handle the handcuffs overlay +/obj/screen/inventory/hand + var/image/handcuff_overlay + +/obj/screen/inventory/hand/update_icon() + ..() + if(!hud) + return + 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) + overlays.Cut() + if(hud.mymob && iscarbon(hud.mymob)) + var/mob/living/carbon/C = hud.mymob + if(C.handcuffed) + overlays |= handcuff_overlay diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 6f586d764e0..2a29d2d1d97 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -895,6 +895,11 @@ var/global/list/damage_icon_parts = list() if(hud_used) 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) + hud_used.l_hand_hud_object.update_icon() + hud_used.r_hand_hud_object.update_icon() /mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1) if(handcuffed) @@ -913,6 +918,8 @@ var/global/list/damage_icon_parts = list() else overlays_standing[HANDCUFF_LAYER] = null + + update_hud_handcuffed() if(update_icons) update_icons() /mob/living/carbon/human/update_inv_legcuffed(var/update_icons=1) diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index cf74d73796c..2071c634d13 100644 Binary files a/icons/mob/screen_gen.dmi and b/icons/mob/screen_gen.dmi differ