mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Mouse drop refactor (#20256)
Refactored mousedrag procs, added signals, some safeguards, did some cleanups around, renamed them to make a little more sense. Mostly put in line with TG's code. Fast clicking and releasing with a drag, depending on the grace period and how fast it is done, can be counted as clicks, to aid in combat scenarios where you spamclick.
This commit is contained in:
@@ -335,15 +335,16 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
to_chat(src, SPAN_WARNING("You are dead! You have no mind to store memory!"))
|
||||
|
||||
//This is called when a ghost is drag clicked to something.
|
||||
/mob/abstract/ghost/observer/MouseDrop(atom/over)
|
||||
if(!usr || !over) return
|
||||
if(isobserver(usr) && usr.client && isliving(over))
|
||||
/mob/abstract/ghost/observer/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(!user || !over)
|
||||
return
|
||||
if(isobserver(user) && user.client && isliving(over))
|
||||
var/mob/living/M = over
|
||||
// If they an admin, see if control can be resolved.
|
||||
if(usr.client.holder && usr.client.holder.cmd_ghost_drag(src,M))
|
||||
if(user.client.holder && user.client.holder.cmd_ghost_drag(src, M))
|
||||
return
|
||||
// Otherwise, see if we can possess the target.
|
||||
if(usr == src && try_possession(M))
|
||||
if(user == src && try_possession(M))
|
||||
return
|
||||
if(istype(over, /obj/machinery/drone_fabricator))
|
||||
var/obj/machinery/drone_fabricator/fab = over
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
..()
|
||||
|
||||
//#TODO-MERGE: Test nymph hats
|
||||
/mob/living/carbon/alien/diona/MouseDrop(atom/over_object)
|
||||
var/mob/living/carbon/H = over_object
|
||||
/mob/living/carbon/alien/diona/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
var/mob/living/carbon/H = over
|
||||
if(!istype(H) || !Adjacent(H))
|
||||
return ..()
|
||||
if(H.a_intent == I_HELP)
|
||||
|
||||
@@ -1884,11 +1884,11 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/mob/living/carbon/human/MouseDrop(var/atom/over_object)
|
||||
if(ishuman(over_object))
|
||||
var/mob/living/carbon/human/H = over_object
|
||||
/mob/living/carbon/human/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(ishuman(over))
|
||||
var/mob/living/carbon/human/H = over
|
||||
if(holder_type && istype(H) && H.a_intent == I_HELP && !H.lying && !issmall(H) && Adjacent(H))
|
||||
get_scooped(H, (usr == src))
|
||||
get_scooped(H, (user == src))
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@
|
||||
if(default_part_replacement(user, attacking_item))
|
||||
return
|
||||
|
||||
/obj/machinery/slime_extractor/MouseDrop_T(atom/dropping, mob/user)
|
||||
/obj/machinery/slime_extractor/mouse_drop_receive(atom/dropped, mob/user, params)
|
||||
if(!Adjacent(user))
|
||||
to_chat(user, SPAN_WARNING("You can't reach \the [src]!"))
|
||||
return
|
||||
if(isslime(dropping))
|
||||
var/mob/living/carbon/slime/slimey = dropping
|
||||
if(isslime(dropped))
|
||||
var/mob/living/carbon/slime/slimey = dropped
|
||||
if(length(extract_slimes) >= slime_limit)
|
||||
to_chat(user, SPAN_WARNING("\The [src] is fully loaded!"))
|
||||
return
|
||||
|
||||
@@ -514,10 +514,12 @@
|
||||
post_scoop()
|
||||
return H
|
||||
|
||||
/mob/living/silicon/pai/MouseDrop(atom/over_object)
|
||||
var/mob/living/carbon/H = over_object
|
||||
if(!istype(H) || !Adjacent(H)) return ..()
|
||||
get_scooped(H, usr)
|
||||
/mob/living/silicon/pai/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
var/mob/living/carbon/H = over
|
||||
if(!istype(H) || !Adjacent(H))
|
||||
return ..()
|
||||
|
||||
get_scooped(H, user)
|
||||
|
||||
/mob/living/silicon/pai/start_pulling(var/atom/movable/AM)
|
||||
if(istype(AM,/obj/item))
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
to_chat(src, SPAN_NOTICE("\The [D] acknowledges your signal."))
|
||||
D.flush_count = D.flush_every_ticks
|
||||
|
||||
/mob/living/silicon/robot/drone/MouseDrop(atom/over_object)
|
||||
var/mob/living/carbon/H = over_object
|
||||
/mob/living/silicon/robot/drone/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
var/mob/living/carbon/H = over
|
||||
if(!istype(H) || !Adjacent(H))
|
||||
return ..()
|
||||
if(H.a_intent == "help")
|
||||
|
||||
@@ -910,13 +910,13 @@
|
||||
gib()
|
||||
|
||||
/// For picking up small animals
|
||||
/mob/living/simple_animal/MouseDrop(atom/over_object)
|
||||
/mob/living/simple_animal/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if (holder_type)//we need a defined holder type in order for picking up to work
|
||||
var/mob/living/carbon/H = over_object
|
||||
var/mob/living/carbon/H = over
|
||||
if(!istype(H) || !Adjacent(H))
|
||||
return ..()
|
||||
|
||||
get_scooped(H, usr)
|
||||
get_scooped(H, user)
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
+13
-6
@@ -698,13 +698,20 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/MouseDrop(mob/M as mob)
|
||||
/mob/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
..()
|
||||
if(M != usr) return
|
||||
if(usr == src) return
|
||||
if(!Adjacent(usr)) return
|
||||
if(istype(M,/mob/living/silicon/ai)) return
|
||||
show_inv(usr)
|
||||
var/mob/M = over
|
||||
if(M != user)
|
||||
return
|
||||
if(user == src)
|
||||
return
|
||||
if(!Adjacent(user))
|
||||
return
|
||||
|
||||
if(istype(M,/mob/living/silicon/ai))
|
||||
return
|
||||
|
||||
show_inv(user)
|
||||
|
||||
|
||||
/mob/verb/stop_pulling()
|
||||
|
||||
@@ -431,7 +431,8 @@
|
||||
destroying = 1 // stops us calling qdel(src) on dropped()
|
||||
return ..()
|
||||
|
||||
/obj/item/grab/MouseDrop(mob/living/carbon/human/H)
|
||||
/obj/item/grab/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
var/mob/living/carbon/human/H = affecting
|
||||
if(wielded || affecting.buckled_to || !istype(H) || assailant != H || H.get_active_hand() != src)
|
||||
return
|
||||
if(!ishuman(affecting))
|
||||
|
||||
Reference in New Issue
Block a user