From 8ef05e7cc1a30dba43affeaa087790f40a3a669b Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 23 Mar 2024 21:47:38 +0100 Subject: [PATCH] [MIRROR] Fixes envelope & reagent holder interaction (#26976) * Fixes envelope & reagent holder interaction (#82127) ## About The Pull Request - Fixes #82122 This is a 2 part fix. - Reagent holders (cup & syringe the only cases i can find) will update the target appearance only when their action succeeds. This way they don't cause items like envelops to update after every interaction. - Envelope returns the stamp overlay in the return value of `update_overlays()` rather than calling `add_overlay()` so their overlays don't add up but rather get removed & replaced correctly. ## Changelog :cl: fix: reagent containers like cup & syringe only update target appearance if action was successful. fix: envelops don't stack overlays when interacting with cup & syringes. /:cl: * Fixes envelope & reagent holder interaction --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> --- code/game/objects/items/mail.dm | 4 ++-- code/modules/reagents/reagent_containers/cups/_cup.dm | 4 ++-- code/modules/reagents/reagent_containers/syringes.dm | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/code/game/objects/items/mail.dm b/code/game/objects/items/mail.dm index 50b81ab6bc3..3a86d267af2 100644 --- a/code/game/objects/items/mail.dm +++ b/code/game/objects/items/mail.dm @@ -87,8 +87,8 @@ pixel_y = stamp_offset_y + bonus_stamp_offset ) stamp_image.appearance_flags |= RESET_COLOR - add_overlay(stamp_image) bonus_stamp_offset -= 5 + . += stamp_image if(postmarked == TRUE) var/image/postmark_image = image( @@ -98,7 +98,7 @@ pixel_y = stamp_offset_y + rand(bonus_stamp_offset + 3, 1) ) postmark_image.appearance_flags |= RESET_COLOR - add_overlay(postmark_image) + . += postmark_image /obj/item/mail/attackby(obj/item/W, mob/user, params) // Destination tagging diff --git a/code/modules/reagents/reagent_containers/cups/_cup.dm b/code/modules/reagents/reagent_containers/cups/_cup.dm index dde51891e66..66dfa0b68db 100644 --- a/code/modules/reagents/reagent_containers/cups/_cup.dm +++ b/code/modules/reagents/reagent_containers/cups/_cup.dm @@ -127,6 +127,7 @@ var/trans = reagents.trans_to(target, amount_per_transfer_from_this, transferred_by = user) to_chat(user, span_notice("You transfer [trans] unit\s of the solution to [target].")) SEND_SIGNAL(src, COMSIG_REAGENTS_CUP_TRANSFER_TO, target) + target.update_appearance() else if(target.is_drainable()) //A dispenser. Transfer FROM it TO us. if(!target.reagents.total_volume) @@ -140,8 +141,7 @@ var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this, transferred_by = user) to_chat(user, span_notice("You fill [src] with [trans] unit\s of the contents of [target].")) SEND_SIGNAL(src, COMSIG_REAGENTS_CUP_TRANSFER_FROM, target) - - target.update_appearance() + target.update_appearance() /obj/item/reagent_containers/cup/afterattack_secondary(atom/target, mob/user, proximity_flag, click_parameters) if((!proximity_flag) || !check_allowed_items(target, target_self = TRUE)) diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 3bff3a3abba..36424f22cbd 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -82,9 +82,10 @@ living_target.log_message("injected themselves ([contained]) with [name]", LOG_ATTACK, color="orange") else log_combat(user, living_target, "injected", src, addition="which had [contained]") - reagents.trans_to(target, amount_per_transfer_from_this, transferred_by = user, methods = INJECT) - to_chat(user, span_notice("You inject [amount_per_transfer_from_this] units of the solution. The syringe now contains [reagents.total_volume] units.")) - target.update_appearance() + + if(reagents.trans_to(target, amount_per_transfer_from_this, transferred_by = user, methods = INJECT)) + to_chat(user, span_notice("You inject [amount_per_transfer_from_this] units of the solution. The syringe now contains [reagents.total_volume] units.")) + target.update_appearance() /obj/item/reagent_containers/syringe/afterattack_secondary(atom/target, mob/user, proximity_flag, click_parameters) if (!try_syringe(target, user, proximity_flag))