Merge pull request #10016 from deathride58/mousedropfixes

Mousedrop fixes - Adds return value to item mousedrop and fixes bugs with the few things that override it
This commit is contained in:
Putnam3145
2019-11-30 22:51:42 -08:00
committed by GitHub
8 changed files with 18 additions and 11 deletions
+3 -2
View File
@@ -393,13 +393,14 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
return
if(over == src)
return usr.client.Click(src, src_location, src_control, params)
var/list/directaccess = usr.DirectAccess()
var/list/directaccess = usr.DirectAccess() //This, specifically, is what requires the copypaste. If this were after the adjacency check, then it'd be impossible to use items in your inventory, among other things.
//If this were before the above checks, then trying to click on items would act a little funky and signal overrides wouldn't work.
if((usr.CanReach(src) || (src in directaccess)) && (usr.CanReach(over) || (over in directaccess)))
if(!usr.get_active_held_item())
usr.UnarmedAttack(src, TRUE)
if(usr.get_active_held_item() == src)
melee_attack_chain(usr, over)
return
return TRUE //returning TRUE as a "is this overridden?" flag
if(!Adjacent(usr) || !over.Adjacent(usr))
return // should stop you from dragging through windows
+1 -1
View File
@@ -104,7 +104,7 @@
/obj/item/defibrillator/MouseDrop(obj/over_object)
. = ..()
if(ismob(loc))
if(!. && ismob(loc) && loc == usr)
var/mob/M = loc
if(!M.incapacitated() && istype(over_object, /obj/screen/inventory/hand))
var/obj/screen/inventory/hand/H = over_object
+2 -1
View File
@@ -151,12 +151,13 @@
add_overlay("[locked ? "" : "un"]locked")
/obj/item/pet_carrier/MouseDrop(atom/over_atom)
. = ..()
if(isopenturf(over_atom) && usr.canUseTopic(src, BE_CLOSE, ismonkey(usr)) && usr.Adjacent(over_atom) && open && occupants.len)
usr.visible_message("<span class='notice'>[usr] unloads [src].</span>", \
"<span class='notice'>You unload [src] onto [over_atom].</span>")
for(var/V in occupants)
remove_occupant(V, over_atom)
else
return ..()
/obj/item/pet_carrier/proc/load_occupant(mob/living/user, mob/living/target)
if(pet_carrier_full(src))
+4 -3
View File
@@ -864,10 +864,9 @@
return ..()
/obj/item/toy/cards/deck/MouseDrop(atom/over_object)
. = ..()
var/mob/living/M = usr
if(!istype(M) || usr.incapacitated() || usr.lying)
return
return ..()
if(Adjacent(usr))
if(over_object == M && loc != M)
M.put_in_hands(src)
@@ -879,7 +878,9 @@
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")
else
to_chat(usr, "<span class='warning'>You can't reach it from here!</span>")
. = ..()
if(!.)
to_chat(usr, "<span class='warning'>You can't reach it from here!</span>")