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:
Fluffy
2024-12-26 14:26:32 +00:00
committed by GitHub
parent a904e1d435
commit df014f9bc0
108 changed files with 860 additions and 485 deletions
@@ -45,11 +45,11 @@
else
icon_state = initial(icon_state)
/obj/item/device/memorywiper/MouseDrop(over_object, src_location, over_location)
/obj/item/device/memorywiper/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
..()
if(use_check_and_message(usr))
return
if(in_range(src, usr) && isipc(over_object) && in_range(over_object, src))
if(in_range(src, usr) && isipc(over) && in_range(over, src))
if(attached)
if(attached == usr)
to_chat(usr, "You unplug \the [src] from your maintenace port.")
@@ -58,13 +58,13 @@
unplug()
return
else
if(over_object == usr)
plug(over_object)
if(over == usr)
plug(over)
to_chat(usr, "You plug \the [src] into your maintenace port.")
else
visible_message("<b>[usr]</b> begins hunting for the maintenance port on \the [over_object]'s chassis.") // The age old question of "where do I put it in!?"
visible_message("<b>[usr]</b> begins hunting for the maintenance port on \the [over]'s chassis.") // The age old question of "where do I put it in!?"
if(do_after(usr, 5 SECONDS))
plug(over_object)
plug(over)
visible_message("[usr] plugs \the [src] into \the [attached]'s maintenance port.")
/obj/item/device/memorywiper/attack_hand(user as mob)
@@ -41,17 +41,17 @@
return
project_at(get_turf(target))
/obj/item/storage/slide_projector/MouseDrop(atom/over)
if(use_check_and_message(usr))
/obj/item/storage/slide_projector/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if(use_check_and_message(user))
return
if(over == usr)
interact(usr)
if(over == user)
interact(user)
return
var/turf/T = get_turf(over)
if(istype(T))
afterattack(over, usr)
afterattack(over, user)
/obj/item/storage/slide_projector/proc/set_slide(obj/item/new_slide)
current_slide = new_slide