From 62f828e327262fb2fc548930c5a457cb87af69ad Mon Sep 17 00:00:00 2001 From: mikomyazaki <47489928+mikomyazaki@users.noreply.github.com> Date: Sat, 25 Jul 2020 20:28:21 +0100 Subject: [PATCH] Attachable HUDs will now remember the type of glasses they are attached to. (#9446) Fixes #9444 --- code/modules/clothing/glasses/glasses.dm | 2 ++ code/modules/clothing/glasses/hud.dm | 6 ++++-- html/changelogs/detachable_hud_glasses_fix.yml | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 html/changelogs/detachable_hud_glasses_fix.yml diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 6be3316d006..46fb03b43db 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -299,6 +299,7 @@ BLIND // can't see anything to_chat(user, SPAN_NOTICE("You attach a set of medical HUDs to your glasses.")) playsound(src.loc, 'sound/weapons/blade_open.ogg', 50, 1) var/obj/item/clothing/glasses/hud/health/prescription/P = new /obj/item/clothing/glasses/hud/health/prescription(user.loc) + P.glasses_type = src.type user.put_in_hands(P) qdel(src) if(istype(W, /obj/item/clothing/glasses/hud/security)) @@ -307,6 +308,7 @@ BLIND // can't see anything to_chat(user, SPAN_NOTICE("You attach a set of security HUDs to your glasses.")) playsound(src.loc, 'sound/weapons/blade_open.ogg', 50, 1) var/obj/item/clothing/glasses/hud/security/prescription/P = new /obj/item/clothing/glasses/hud/security/prescription(user.loc) + P.glasses_type = src.type user.put_in_hands(P) qdel(src) diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 1ca2054627e..4ccff75ee5c 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -29,11 +29,12 @@ prescription = 1 icon_state = "healthhudpresc" item_state = "healthhudpresc" + var/glasses_type = /obj/item/clothing/glasses/regular /obj/item/clothing/glasses/hud/health/prescription/attack_self(mob/user) to_chat(user, SPAN_NOTICE("You detach a set of medical HUDs from your glasses.")) playsound(src.loc, 'sound/weapons/blade_close.ogg', 50, 1) - var/obj/item/clothing/glasses/regular/R = new /obj/item/clothing/glasses/regular(user.loc) + var/obj/item/clothing/glasses/regular/R = new glasses_type(user.loc) user.put_in_hands(R) var/obj/item/clothing/glasses/hud/health/H = new /obj/item/clothing/glasses/hud/health(user.loc) user.put_in_hands(H) @@ -54,11 +55,12 @@ prescription = 1 icon_state = "sechudpresc" item_state = "sechudpresc" + var/glasses_type = /obj/item/clothing/glasses/regular /obj/item/clothing/glasses/hud/security/prescription/attack_self(mob/user) to_chat(user, SPAN_NOTICE("You detach a set of security HUDs from your glasses.")) playsound(src.loc, 'sound/weapons/blade_close.ogg', 50, 1) - var/obj/item/clothing/glasses/regular/R = new /obj/item/clothing/glasses/regular(user.loc) + var/obj/item/clothing/glasses/regular/R = new glasses_type(user.loc) user.put_in_hands(R) var/obj/item/clothing/glasses/hud/security/S = new /obj/item/clothing/glasses/hud/security(user.loc) user.put_in_hands(S) diff --git a/html/changelogs/detachable_hud_glasses_fix.yml b/html/changelogs/detachable_hud_glasses_fix.yml new file mode 100644 index 00000000000..636edaf2333 --- /dev/null +++ b/html/changelogs/detachable_hud_glasses_fix.yml @@ -0,0 +1,6 @@ +author: mikomyazaki + +delete-after: True + +changes: + - bugfix: "Attachable HUDs will now properly remember the type of glasses they were attached to, and return that type when detached instead of always returning regular prescription glasses." \ No newline at end of file