mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 20:17:15 +01:00
Merge pull request #3076 from Leshana/handcuffs-hud
Fix handcuff hud icons appearing on the left and right hand inventory hud slots when handcuffed.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user