mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 21:12:24 +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:
@@ -19,14 +19,14 @@
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/obj/item/clipboard/MouseDrop(obj/over_object as obj) //Quick clipboard fix. -Agouri
|
||||
if(ishuman(usr))
|
||||
var/mob/M = usr
|
||||
if(!(istype(over_object, /atom/movable/screen) ))
|
||||
/obj/item/clipboard/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(ishuman(user))
|
||||
var/mob/M = user
|
||||
if(!(istype(over, /atom/movable/screen) ))
|
||||
return ..()
|
||||
|
||||
if(!M.restrained() && !M.stat)
|
||||
switch(over_object.name)
|
||||
switch(over.name)
|
||||
if("right hand")
|
||||
M.u_equip(src)
|
||||
M.equip_to_slot_if_possible(src, slot_r_hand)
|
||||
@@ -34,7 +34,7 @@
|
||||
M.u_equip(src)
|
||||
M.equip_to_slot_if_possible(src, slot_l_hand)
|
||||
|
||||
add_fingerprint(usr)
|
||||
add_fingerprint(M)
|
||||
return
|
||||
|
||||
/obj/item/clipboard/update_icon()
|
||||
|
||||
@@ -14,21 +14,21 @@
|
||||
var/list/papers = new/list() //List of papers put in the bin for reference.
|
||||
|
||||
|
||||
/obj/item/paper_bin/MouseDrop(mob/user as mob)
|
||||
if((user == usr && (!( usr.restrained() ) && (!( usr.stat ) && (usr.contents.Find(src) || in_range(src, usr))))))
|
||||
if(!istype(usr, /mob/living/carbon/slime) && !istype(usr, /mob/living/simple_animal))
|
||||
if( !usr.get_active_hand() ) //if active hand is empty
|
||||
var/mob/living/carbon/human/H = user
|
||||
/obj/item/paper_bin/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if((over == user && (!( user.restrained() ) && (!( user.stat ) && (user.contents.Find(src) || in_range(src, user))))))
|
||||
if(!istype(user, /mob/living/carbon/slime) && !istype(user, /mob/living/simple_animal))
|
||||
if( !user.get_active_hand() ) //if active hand is empty
|
||||
var/mob/living/carbon/human/H = over
|
||||
var/obj/item/organ/external/temp = H.organs_by_name[BP_R_HAND]
|
||||
|
||||
if (H.hand)
|
||||
temp = H.organs_by_name[BP_L_HAND]
|
||||
if(temp && !temp.is_usable())
|
||||
to_chat(user, SPAN_NOTICE("You try to move your [temp.name], but cannot!"))
|
||||
to_chat(H, SPAN_NOTICE("You try to move your [temp.name], but cannot!"))
|
||||
return
|
||||
|
||||
to_chat(user, SPAN_NOTICE("You pick up the [src]."))
|
||||
user.put_in_hands(src)
|
||||
to_chat(H, SPAN_NOTICE("You pick up the [src]."))
|
||||
H.put_in_hands(src)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -109,27 +109,27 @@ var/global/photo_count = 0
|
||||
item_state = "briefcase"
|
||||
can_hold = list(/obj/item/photo)
|
||||
|
||||
/obj/item/storage/photo_album/MouseDrop(obj/over_object as obj)
|
||||
/obj/item/storage/photo_album/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
|
||||
if((istype(usr, /mob/living/carbon/human)))
|
||||
var/mob/M = usr
|
||||
if(!( istype(over_object, /atom/movable/screen) ))
|
||||
if((istype(user, /mob/living/carbon/human)))
|
||||
var/mob/M = user
|
||||
if(!( istype(over, /atom/movable/screen) ))
|
||||
return ..()
|
||||
playsound(loc, /singleton/sound_category/rustle_sound, 50, 1, -5)
|
||||
if((!( M.restrained() ) && !( M.stat ) && M.back == src))
|
||||
switch(over_object.name)
|
||||
switch(over.name)
|
||||
if("right hand")
|
||||
M.u_equip(src)
|
||||
M.equip_to_slot_if_possible(src, slot_r_hand)
|
||||
if("left hand")
|
||||
M.u_equip(src)
|
||||
M.equip_to_slot_if_possible(src, slot_l_hand)
|
||||
add_fingerprint(usr)
|
||||
add_fingerprint(user)
|
||||
return
|
||||
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
|
||||
if(usr.s_active)
|
||||
usr.s_active.close(usr)
|
||||
show_to(usr)
|
||||
if(over == user && in_range(src, user) || user.contents.Find(src))
|
||||
if(user.s_active)
|
||||
user.s_active.close(user)
|
||||
show_to(user)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
@@ -55,15 +55,16 @@
|
||||
else
|
||||
. = ..()
|
||||
|
||||
/obj/item/portable_typewriter/MouseDrop(mob/user as mob)
|
||||
if(use_check_and_message(user))
|
||||
/obj/item/portable_typewriter/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
var/mob/mob_dropped_over = over
|
||||
if(use_check_and_message(mob_dropped_over))
|
||||
return
|
||||
|
||||
if(((user.contents.Find(src) || in_range(src, user))))
|
||||
if(((mob_dropped_over.contents.Find(src) || in_range(src, mob_dropped_over))))
|
||||
if(isnull(stored_paper))
|
||||
to_chat(user, SPAN_ALERT("\The [src] has no paper fed for typing!"))
|
||||
to_chat(mob_dropped_over, SPAN_ALERT("\The [src] has no paper fed for typing!"))
|
||||
else
|
||||
stored_paper.attackby(pen, user)
|
||||
stored_paper.attackby(pen, mob_dropped_over)
|
||||
return
|
||||
|
||||
/obj/item/portable_typewriter/update_icon()
|
||||
@@ -179,8 +180,8 @@
|
||||
to_chat(user, SPAN_ALERT("\The [src] is currently closed!"))
|
||||
return
|
||||
|
||||
/obj/item/typewriter_case/MouseDrop(mob/user as mob)
|
||||
attack_self(user)
|
||||
/obj/item/typewriter_case/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
attack_self(over)
|
||||
|
||||
/obj/item/typewriter_case/attackby(obj/item/attacking_item, mob/user, params)
|
||||
if(istype(attacking_item, /obj/item/portable_typewriter))
|
||||
|
||||
Reference in New Issue
Block a user