[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
🆑
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.
/🆑

* Fixes envelope & reagent holder interaction

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-03-23 16:47:38 -04:00
committed by GitHub
co-authored by SyncIt21
parent a7bb978a7f
commit 8ef05e7cc1
3 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -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
@@ -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))
@@ -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))