mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 14:31:59 +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:
@@ -477,12 +477,12 @@
|
||||
else
|
||||
open(user)
|
||||
|
||||
/obj/item/storage/altar/MouseDrop(mob/user as mob)
|
||||
if(use_check_and_message(user))
|
||||
/obj/item/storage/altar/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(use_check_and_message(over))
|
||||
return
|
||||
if(ishuman(user))
|
||||
forceMove(get_turf(usr))
|
||||
usr.put_in_hands(src)
|
||||
if(ishuman(over))
|
||||
forceMove(get_turf(user))
|
||||
user.put_in_hands(src)
|
||||
|
||||
/obj/item/storage/altar/kraszar
|
||||
name = "\improper Kraszar altar"
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
return
|
||||
|
||||
|
||||
/obj/item/storage/laundry_basket/MouseDrop(obj/over_object as obj)
|
||||
if(over_object == usr)
|
||||
/obj/item/storage/laundry_basket/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(over == user)
|
||||
return
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -70,9 +70,9 @@ ABSTRACT_TYPE(/obj/item/storage/secure)
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/storage/secure/MouseDrop(over_object, src_location, over_location)
|
||||
/obj/item/storage/secure/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if (locked)
|
||||
src.add_fingerprint(usr)
|
||||
src.add_fingerprint(user)
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
@@ -202,40 +202,40 @@
|
||||
if(isghost(user))
|
||||
. += "It contains: [counting_english_list(contents)]"
|
||||
|
||||
/obj/item/storage/MouseDrop(obj/over_object)
|
||||
/obj/item/storage/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
. = ..()
|
||||
if(!canremove)
|
||||
return
|
||||
if(!over_object || over_object == src)
|
||||
if(!over || over == src)
|
||||
return
|
||||
if(istype(over_object, /atom/movable/screen/inventory))
|
||||
var/atom/movable/screen/inventory/S = over_object
|
||||
if(istype(over, /atom/movable/screen/inventory))
|
||||
var/atom/movable/screen/inventory/S = over
|
||||
if(S.slot_id == src.equip_slot)
|
||||
return
|
||||
if(ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
|
||||
if(over_object == usr && Adjacent(usr)) // this must come before the screen objects only block
|
||||
src.open(usr)
|
||||
if(ishuman(user) || issmall(user)) //so monkeys can take off their backpacks -- Urist
|
||||
if(over == user && Adjacent(user)) // this must come before the screen objects only block
|
||||
src.open(user)
|
||||
return
|
||||
if(!(istype(over_object, /atom/movable/screen)))
|
||||
if(!(istype(over, /atom/movable/screen)))
|
||||
return ..()
|
||||
|
||||
//makes sure that the storage is equipped, so that we can't drag it into our hand from miles away.
|
||||
//there's got to be a better way of doing this.
|
||||
if(!(src.loc == usr) || (src.loc && src.loc.loc == usr))
|
||||
if(!(src.loc == user) || (src.loc && src.loc.loc == user))
|
||||
return
|
||||
if(use_check_and_message(usr))
|
||||
if(use_check_and_message(user))
|
||||
return
|
||||
if((src.loc == usr) && !usr.unEquip(src))
|
||||
if((src.loc == user) && !user.unEquip(src))
|
||||
return
|
||||
|
||||
switch(over_object.name)
|
||||
switch(over.name)
|
||||
if("right hand")
|
||||
usr.u_equip(src)
|
||||
usr.equip_to_slot_if_possible(src, slot_r_hand)
|
||||
user.u_equip(src)
|
||||
user.equip_to_slot_if_possible(src, slot_r_hand)
|
||||
if("left hand")
|
||||
usr.u_equip(src)
|
||||
usr.equip_to_slot_if_possible(src, slot_l_hand)
|
||||
src.add_fingerprint(usr)
|
||||
user.u_equip(src)
|
||||
user.equip_to_slot_if_possible(src, slot_l_hand)
|
||||
src.add_fingerprint(user)
|
||||
|
||||
/obj/item/storage/AltClick(var/mob/usr)
|
||||
if(!canremove)
|
||||
|
||||
@@ -267,23 +267,24 @@
|
||||
if(ishuman(user))
|
||||
src.open(user)
|
||||
|
||||
/obj/item/storage/box/fancy/tray/MouseDrop(mob/user as mob)
|
||||
if((user && (!use_check(user))) && (user.contents.Find(src) || in_range(src, user)))
|
||||
if(ishuman(user) && !user.get_active_hand())
|
||||
/obj/item/storage/box/fancy/tray/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if((over && (!use_check(over))) && (over.contents.Find(src) || in_range(src, over)))
|
||||
var/mob/dropped_onto_mob = over
|
||||
if(ishuman(dropped_onto_mob) && !dropped_onto_mob.get_active_hand())
|
||||
var/mob/living/carbon/human/H = user
|
||||
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]."))
|
||||
to_chat(H, SPAN_NOTICE("You pick up the [src]."))
|
||||
pixel_x = 0
|
||||
pixel_y = 0
|
||||
forceMove(get_turf(user))
|
||||
user.put_in_hands(src)
|
||||
forceMove(get_turf(H))
|
||||
H.put_in_hands(src)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -398,8 +398,8 @@
|
||||
return SPAN_NOTICE("You can secure the trap by using a screwdriver on it. This will anchor it to the floor, and ready it for deployment.")
|
||||
return SPAN_NOTICE("You can unsecure the trap by using a screwdriver on it. This will unanchor it from the floor, allowing it to be moved.")
|
||||
|
||||
/obj/item/trap/animal/MouseDrop_T(atom/dropping, mob/user)
|
||||
var/mob/living/capturing_mob = dropping
|
||||
/obj/item/trap/animal/mouse_drop_receive(atom/dropped, mob/user, params)
|
||||
var/mob/living/capturing_mob = dropped
|
||||
if(!istype(capturing_mob))
|
||||
return
|
||||
|
||||
@@ -704,16 +704,16 @@
|
||||
user.forceMove(loc)
|
||||
user.visible_message("[SPAN_BOLD("[user]")] successfully moves around \the [src] without triggering it.", SPAN_NOTICE("You successfully move around \the [src] without triggering it."))
|
||||
|
||||
/obj/item/trap/animal/MouseDrop(over_object, src_location, over_location)
|
||||
if(!isliving(usr) || !src.Adjacent(usr))
|
||||
/obj/item/trap/animal/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(!isliving(user) || !src.Adjacent(user))
|
||||
return
|
||||
|
||||
if(captured)
|
||||
pass_without_trace(usr) // It's full
|
||||
pass_without_trace(user) // It's full
|
||||
return
|
||||
|
||||
else if(iscarbon(usr))
|
||||
pass_without_trace(usr)
|
||||
else if(iscarbon(user))
|
||||
pass_without_trace(user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
@@ -827,25 +827,25 @@
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/trap/animal/large/MouseDrop(over_object, src_location, over_location)
|
||||
/obj/item/trap/animal/large/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(captured)
|
||||
to_chat(usr, SPAN_WARNING("The trap door's down, you can't get through there!"))
|
||||
to_chat(user, SPAN_WARNING("The trap door's down, you can't get through there!"))
|
||||
return
|
||||
|
||||
if(!src.Adjacent(usr))
|
||||
if(!src.Adjacent(user))
|
||||
return
|
||||
|
||||
if(!ishuman(usr))
|
||||
if(!ishuman(user))
|
||||
..()
|
||||
return
|
||||
|
||||
var/trigger_chance = 0
|
||||
if(usr.a_intent == I_HELP)
|
||||
if(user.a_intent == I_HELP)
|
||||
trigger_chance = 100
|
||||
else if(usr.a_intent != I_HURT)
|
||||
else if(user.a_intent != I_HURT)
|
||||
trigger_chance = 50
|
||||
|
||||
pass_without_trace(usr, trigger_chance)
|
||||
pass_without_trace(user, trigger_chance)
|
||||
|
||||
/obj/item/trap/animal/large/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
if(deployed)
|
||||
|
||||
Reference in New Issue
Block a user