[MIRROR] Fixes checking a person's inventory requiring a do_after and causing a buckle notification. (#2696)

* Fixes checking a person's inventory requiring a do_after and causing a buckle notification. (#56153)

`/atom/movable/proc/mouse_buckle_handling(mob/living/M, mob/living/user)` has functionality that is too generic for `/mob/living/carbon/human/`

`/mob/living/carbon/human/MouseDrop_T(mob/living/target, mob/living/user)` contains code that is better suited for `mouse_buckle_handling()`

`/mob/living/carbon/human/MouseDrop_T()` results in a call stack that calls the generic `/atom/movable/proc/mouse_buckle_handling()` when the prerequisites for piggybacking or fireman carrying are not satisfied. But this makes no sense and means that when the game state is such that you should be inspecting the inventory, the game state is ALSO such that you are attempting to erroneously buckle a player to yourself.

In addition, `MouseDrop_T()` should really not be holding mouse buckling logic in this scenario. As a result, this proc override has been removed from /living/carbon/human entirely. All functionality has been shifted into an overriden `mouse_buckle_handling()` at the /living/carbon/human level.

Piggybacking and fireman carrying now actually return a value on success.

Finally, if we have successfully handled the MouseDrop_T event through a parent proc call chain, we no longer go on to show the mob's inventory.

All these tweaks combined mean that you can now click-drag to view inventories without a do_after and without attempting buckling, /mob/living/carbon/human buckling logic is now appropriately in `mouse_buckle_handling()` and no longer falls through to generic buckling checks, which is not relevant when trying to air quotes "buckle" a mob to a /mob/living/carbon/human. Successfully buckling a player to yourself (in this scenario through fireman carrying) no longer opens the inventory window.

I have tested the following behaviours and they work as intended.

- [x] Piggybacking
- [x] Fireman carrying
- [x] Inspecting inventory of /mob/living/carbon/human
- [x] Inspecting inventory of /mob/living/simple_animal/pet/dog/corgi/ian
- [x] Buckling /mob/living/carbon/human to a chair.
- [x] Buckling /mob/living/simple_animal/pet/dog/corgi/ian to a dog bed.

* Fixes checking a person's inventory requiring a do_after and causing a buckle notification.

Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
This commit is contained in:
SkyratBot
2021-01-14 21:21:57 +00:00
committed by GitHub
co-authored by Timberpoes
parent 6fb54b6d3b
commit e25784537d
2 changed files with 21 additions and 15 deletions
+15 -15
View File
@@ -1030,25 +1030,25 @@
message_admins(msg)
admin_ticket_log(src, msg)
/mob/living/carbon/human/MouseDrop_T(mob/living/target, mob/living/user)
if(pulling != target || grab_state != GRAB_AGGRESSIVE || stat != CONSCIOUS || a_intent != INTENT_GRAB)
return ..()
//If they dragged themselves and we're currently aggressively grabbing them try to piggyback
if(user == target)
if(can_piggyback(target))
piggyback(target)
//If you dragged them to you and you're aggressively grabbing try to fireman carry them
else if(can_be_firemanned(target))
fireman_carry(target)
/mob/living/carbon/human/limb_attack_self()
var/obj/item/bodypart/arm = hand_bodyparts[active_hand_index]
if(arm)
arm.attack_self(src)
return ..()
/mob/living/carbon/human/mouse_buckle_handling(mob/living/M, mob/living/user)
if(pulling != M || grab_state != GRAB_AGGRESSIVE || stat != CONSCIOUS || a_intent != INTENT_GRAB)
return FALSE
//If they dragged themselves to you and you're currently aggressively grabbing them try to piggyback
if(user == M && can_piggyback(M))
piggyback(M)
return TRUE
//If you dragged them to you and you're aggressively grabbing try to fireman carry them
if(can_be_firemanned(M))
fireman_carry(M)
return TRUE
//src is the user that will be carrying, target is the mob to be carried
/mob/living/carbon/human/proc/can_piggyback(mob/living/carbon/target)
@@ -1091,7 +1091,7 @@
density = old_density
if(target.loc == loc)
buckle_mob(target, TRUE, TRUE, CARRIER_NEEDS_ARM)
return buckle_mob(target, TRUE, TRUE, CARRIER_NEEDS_ARM)
/mob/living/carbon/human/proc/piggyback(mob/living/carbon/target)
if(!can_piggyback(target))
@@ -1107,7 +1107,7 @@
target.visible_message("<span class='warning'>[target] can't hang onto [src]!</span>")
return
buckle_mob(target, TRUE, TRUE, RIDER_NEEDS_ARMS)
return buckle_mob(target, TRUE, TRUE, RIDER_NEEDS_ARMS)
/mob/living/carbon/human/buckle_mob(mob/living/target, force = FALSE, check_loc = TRUE, buckle_mob_flags= NONE)
if(!is_type_in_typecache(target, can_ride_typecache))
+6
View File
@@ -819,6 +819,12 @@
*/
/mob/MouseDrop_T(atom/dropping, atom/user)
. = ..()
// Our mouse drop has already been handled by something else. Most likely buckling code.
// Since it has already been handled, we don't need to show inventory.
if(.)
return
if(ismob(dropping) && src == user && dropping != user)
var/mob/M = dropping
var/mob/U = user