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:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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>")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
if(ismecha(M.loc)) // stops inventory actions in a mech
|
||||
return
|
||||
|
||||
if(!M.incapacitated() && loc == M && istype(over_object, /obj/screen/inventory/hand))
|
||||
if(!. && !M.incapacitated() && loc == M && istype(over_object, /obj/screen/inventory/hand))
|
||||
var/obj/screen/inventory/hand/H = over_object
|
||||
if(M.putItemFromInventoryInHandIfPossible(src, H.held_index))
|
||||
add_fingerprint(usr)
|
||||
|
||||
@@ -91,7 +91,6 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/papercutter/MouseDrop(atom/over_object)
|
||||
. = ..()
|
||||
var/mob/M = usr
|
||||
if(M.incapacitated() || !Adjacent(M))
|
||||
return
|
||||
@@ -102,6 +101,10 @@
|
||||
else if(istype(over_object, /obj/screen/inventory/hand))
|
||||
var/obj/screen/inventory/hand/H = over_object
|
||||
M.putItemFromInventoryInHandIfPossible(src, H.held_index)
|
||||
|
||||
else
|
||||
. = ..()
|
||||
|
||||
add_fingerprint(M)
|
||||
|
||||
/obj/item/paperslip
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
..()
|
||||
|
||||
/obj/item/paper_bin/MouseDrop(atom/over_object)
|
||||
. = ..()
|
||||
var/mob/living/M = usr
|
||||
if(!istype(M) || M.incapacitated() || !Adjacent(M))
|
||||
return
|
||||
@@ -52,6 +51,9 @@
|
||||
else if(istype(over_object, /obj/screen/inventory/hand))
|
||||
var/obj/screen/inventory/hand/H = over_object
|
||||
M.putItemFromInventoryInHandIfPossible(src, H.held_index)
|
||||
|
||||
else
|
||||
. = ..()
|
||||
|
||||
add_fingerprint(M)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user