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
+3 -3
View File
@@ -3,10 +3,10 @@
if(buckled)
user_unbuckle(user)
/obj/MouseDrop_T(atom/dropping, mob/user)
/obj/mouse_drop_receive(atom/dropped, mob/user, params)
. = ..()
if(is_type_in_list(dropping, can_buckle))
user_buckle(dropping, user)
if(is_type_in_list(dropped, can_buckle))
user_buckle(dropped, user)
/**
* Buckles an `/atom/movable` to this obj, performed by a `/mob`
+1 -1
View File
@@ -1327,7 +1327,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
else
apply_outline(L) //if the player's alive and well we send the command with no color set, so it uses the theme's color
/obj/item/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
/obj/item/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
. = ..()
remove_outline()
+10 -10
View File
@@ -185,22 +185,22 @@
return 1
// Fold the bubble, transfering properties.
/obj/structure/closet/airbubble/MouseDrop(over_object, src_location, over_location)
if((!zipped || ripped )&& (over_object == usr && (in_range(src, usr) || usr.contents.Find(src))))
if(!ishuman(usr)) return
/obj/structure/closet/airbubble/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if((!zipped || ripped )&& (over == user && (in_range(src, user) || user.contents.Find(src))))
if(!ishuman(user)) return
if(opened) return 0
if(contents.len > 1) return 0
if(cell)
to_chat(usr, SPAN_WARNING("[src] can not be folded with [cell] attached to it."))
to_chat(user, SPAN_WARNING("[src] can not be folded with [cell] attached to it."))
return
usr.visible_message(
SPAN_WARNING("[usr] begins folding up the [src.name]."),
user.visible_message(
SPAN_WARNING("[user] begins folding up the [src.name]."),
SPAN_NOTICE("You begin folding up the [src.name].")
)
if (!do_after(usr, 0.45 SECONDS))
if (!do_after(user, 0.45 SECONDS))
return
usr.visible_message(
SPAN_WARNING("[usr] folds up the [src.name].") ,
user.visible_message(
SPAN_WARNING("[user] folds up the [src.name].") ,
SPAN_NOTICE("You fold up the [src.name].")
)
var/obj/item/airbubble/bag
@@ -420,7 +420,7 @@
if(opened)
if(istype(attacking_item, /obj/item/grab))
var/obj/item/grab/G = attacking_item
MouseDrop_T(G.affecting, user)
mouse_drop_receive(G.affecting, user)
return FALSE
if(!attacking_item.dropsafety())
return FALSE
+3 -3
View File
@@ -121,10 +121,10 @@
..()
slowdown = initial(slowdown)
/obj/structure/closet/body_bag/MouseDrop(over_object, src_location, over_location)
/obj/structure/closet/body_bag/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
..()
if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src))))
fold(usr)
if((over == user && (in_range(src, user) || user.contents.Find(src))))
fold(user)
/obj/structure/closet/body_bag/proc/fold(var/user)
if(!(ishuman(user)))
+8 -8
View File
@@ -152,7 +152,7 @@
QDEL_NULL(my_tent)
return ..()
/obj/item/tent/MouseDrop(over_object, src_location, over_location)
/obj/item/tent/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
. = ..()
if(use_check(usr) || !Adjacent(usr))
return
@@ -254,7 +254,7 @@
return !density
return TRUE
/obj/structure/component/tent_canvas/MouseDrop(over_object, src_location, over_location)
/obj/structure/component/tent_canvas/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
..()
if(use_check(usr, USE_ALLOW_NON_ADJACENT) || (get_dist(usr, src) > 1)) // use_check() can't check for adjacency due to density issues, so we check range as well
return
@@ -328,7 +328,7 @@
if(istype(T))
unroll(T, user)
/obj/item/sleeping_bag/MouseDrop(over_object, src_location, over_location)
/obj/item/sleeping_bag/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
. = ..()
if(use_check(usr) || !Adjacent(usr))
return
@@ -374,7 +374,7 @@
buckled.update_icon()
. = ..()
/obj/structure/bed/sleeping_bag/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
/obj/structure/bed/sleeping_bag/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
. = ..()
if(use_check(usr) || !Adjacent(usr))
return
@@ -426,14 +426,14 @@
/obj/structure/table/rack/folding_table/dismantle(obj/item/wrench/W, mob/user)
return FALSE
/obj/structure/table/rack/folding_table/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
/obj/structure/table/rack/folding_table/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
. = ..()
if(use_check(usr) || !Adjacent(usr))
if(use_check(user) || !Adjacent(user))
return
if(!ishuman(usr) && (!isrobot(usr) || isDrone(usr))) //Humans and borgs can collapse, but not drones
if(!ishuman(user) && (!isrobot(user) || isDrone(user))) //Humans and borgs can collapse, but not drones
return
new /obj/item/material/folding_table(get_turf(src))
usr.visible_message(SPAN_NOTICE("\The [usr] collapses \the [src]."))
user.visible_message(SPAN_NOTICE("\The [user] collapses \the [src]."))
qdel(src)
/obj/item/material/stool/chair/folding/camping
+4 -4
View File
@@ -98,7 +98,7 @@
to_chat(user, SPAN_WARNING("You need a free hand to hold the paddles!"))
update_icon() //success
/obj/item/defibrillator/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
/obj/item/defibrillator/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
. = ..()
if(ismob(loc) && slot_flags)
var/mob/M = src.loc
@@ -106,11 +106,11 @@
return
if(!M.unEquip(src))
return
add_fingerprint(usr)
add_fingerprint(user)
M.put_in_active_hand(src)
else
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(Adjacent(H))
if(!H.put_in_active_hand(paddles))
to_chat(H, SPAN_WARNING("You need a free hand to take out the paddles!"))
@@ -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
+4 -4
View File
@@ -101,14 +101,14 @@
update_icon()
return
/obj/item/glass_jar/MouseDrop(atom/over)
if(usr != over || use_check_and_message(usr))
/obj/item/glass_jar/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if(user != over || use_check_and_message(user))
return
if(length(contained))
switch(contains)
if(JAR_GUMBALL)
release(contained[1], usr)
usr.put_in_hands(contained[1])
release(contained[1], user)
user.put_in_hands(contained[1])
contained -= contained[1]
/obj/item/glass_jar/attackby(obj/item/attacking_item, mob/user)
+3 -3
View File
@@ -243,9 +243,9 @@
/obj/machinery/centrifuge/AltClick()
remove_sample(usr)
/obj/machinery/centrifuge/MouseDrop(var/atom/other)
if(usr == other)
remove_sample(usr)
/obj/machinery/centrifuge/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if(user == over)
remove_sample(user)
else
return ..()
+5 -5
View File
@@ -17,11 +17,11 @@
else
spirit_board_pick_letter(user)
/obj/item/spirit_board/MouseDrop(mob/user as mob)
if((user == usr && (!use_check(user))) && (user.contents.Find(src) || in_range(src, user)))
if(ishuman(usr))
forceMove(get_turf(usr))
usr.put_in_hands(src)
/obj/item/spirit_board/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if((over == user && (!use_check(over))) && (over.contents.Find(src) || in_range(src, over)))
if(ishuman(user))
forceMove(get_turf(user))
user.put_in_hands(src)
/obj/item/spirit_board/attack_ghost(var/mob/abstract/ghost/user)
spirit_board_pick_letter(user)
@@ -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
+14 -14
View File
@@ -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)
+3 -3
View File
@@ -102,11 +102,11 @@
return TRUE
return FALSE
/obj/structure/MouseDrop_T(mob/target, mob/user)
/obj/structure/mouse_drop_receive(atom/dropped, mob/user, params)
var/mob/living/H = user
if(istype(H) && can_climb(H) && target == user)
do_climb(target)
if(istype(H) && can_climb(H) && dropped == user)
do_climb(dropped)
else
return ..()
+8 -7
View File
@@ -73,20 +73,21 @@ LINEN BINS
..()
add_fingerprint(user)
/obj/item/bedsheet/MouseDrop(mob/user)
if((user && (!use_check(user))) && (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
/obj/item/bedsheet/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)))
if(!istype(over, /mob/living/carbon/slime) && !istype(over, /mob/living/simple_animal))
var/mob/mouse_dropped_over = over
if( !mouse_dropped_over.get_active_hand() ) //if active hand is empty
var/mob/living/carbon/human/H = user
var/obj/item/organ/external/temp = H.organs_by_name["r_hand"]
if (H.hand)
temp = H.organs_by_name["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
/obj/item/bedsheet/update_icon()
@@ -348,7 +348,7 @@
if(opened)
if(istype(attacking_item, /obj/item/grab))
var/obj/item/grab/G = attacking_item
MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
mouse_drop_receive(G.affecting, user) //act like they were dragged onto the closet
return 0
if(attacking_item.isscrewdriver()) // Moved here so you can only detach linked teleporters when the door is open. So you can like unscrew and bolt the locker normally in most circumstances.
if(linked_teleporter)
@@ -516,8 +516,8 @@
. = opened
/obj/structure/closet/MouseDrop_T(atom/dropping, mob/user)
var/atom/movable/O = dropping
/obj/structure/closet/mouse_drop_receive(atom/dropped, mob/user, params)
var/atom/movable/screen/O = dropped
if(istype(O, /atom/movable/screen)) //fix for HUD elements making their way into the world -Pete
return
if(O.loc == user)
@@ -14,7 +14,7 @@
if(opened)
if(istype(attacking_item, /obj/item/grab))
var/obj/item/grab/G = attacking_item
MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
mouse_drop_receive(G.affecting, user) //act like they were dragged onto the closet
return 0
if(!attacking_item.dropsafety())
return
@@ -40,7 +40,7 @@
/obj/structure/closet/secure_closet/personal/attackby(obj/item/attacking_item, mob/user)
if (opened)
if (istype(attacking_item, /obj/item/grab))
MouseDrop_T(attacking_item:affecting, user) //act like they were dragged onto the closet
mouse_drop_receive(attacking_item:affecting, user) //act like they were dragged onto the closet
if(attacking_item)
user.drop_from_inventory(attacking_item,loc)
else
@@ -151,7 +151,7 @@
visible_message(SPAN_DANGER("[user] strikes [src] with [attacking_item]."))
check_health()
/obj/structure/closet/statue/MouseDrop_T()
/obj/structure/closet/statue/mouse_drop_receive(atom/dropped, mob/user, params)
return
/obj/structure/closet/statue/relaymove(mob/living/user, direction)
@@ -146,9 +146,9 @@
pixel_y = -4
//For putting on tables
/obj/structure/closet/crate/MouseDrop(atom/over_object)
if (istype(over_object, /obj/structure/table))
put_on_table(over_object, usr)
/obj/structure/closet/crate/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if (istype(over, /obj/structure/table))
put_on_table(over, user)
return TRUE
else
return ..()
@@ -87,22 +87,22 @@
return
toggle_open(user)
/obj/structure/fireaxecabinet/MouseDrop(over_object, src_location, over_location)
if(over_object == usr)
var/mob/user = over_object
if(!istype(user))
/obj/structure/fireaxecabinet/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if(over == user)
var/mob/mob_dropped_over = over
if(!istype(mob_dropped_over))
return
if(!open)
to_chat(user, SPAN_NOTICE("\The [src] is closed."))
to_chat(mob_dropped_over, SPAN_NOTICE("\The [src] is closed."))
return
if(!fireaxe)
to_chat(user, SPAN_NOTICE("\The [src] is empty."))
to_chat(mob_dropped_over, SPAN_NOTICE("\The [src] is empty."))
return
fireaxe.forceMove(get_turf(user))
user.put_in_hands(fireaxe)
fireaxe.forceMove(get_turf(mob_dropped_over))
mob_dropped_over.put_in_hands(fireaxe)
fireaxe = null
update_icon()
+2 -2
View File
@@ -99,8 +99,8 @@
//everything else is visible, so doesn't need to be mentioned
/obj/structure/janitorialcart/MouseDrop_T(atom/dropping, mob/user)
var/atom/movable/O = dropping
/obj/structure/janitorialcart/mouse_drop_receive(atom/dropped, mob/user, params)
var/atom/movable/O = dropped
if (istype(O, /obj/structure/mopbucket) && !mybucket)
O.forceMove(src)
mybucket = O
+2 -2
View File
@@ -166,8 +166,8 @@
return
return
/obj/structure/m_tray/MouseDrop_T(atom/dropping, mob/user)
var/atom/movable/O = dropping
/obj/structure/m_tray/mouse_drop_receive(atom/dropped, mob/user, params)
var/atom/movable/O = dropped
if(!istype(O, /atom/movable) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O))
return
if(!ismob(O) && !istype(O, /obj/structure/closet/body_bag))
@@ -492,27 +492,27 @@
update_icon()
STOP_PROCESSING(SSprocessing, src)
/obj/structure/bed/roller/MouseDrop(over_object, src_location, over_location)
/obj/structure/bed/roller/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
..()
if(use_check(usr) || !Adjacent(usr))
if(use_check(user) || !Adjacent(user))
return
if(!ishuman(usr) && (!isrobot(usr) || isDrone(usr))) //Humans and borgs can collapse, but not drones
if(!ishuman(user) && (!isrobot(user) || isDrone(user))) //Humans and borgs can collapse, but not drones
return
if(over_object == buckled && beaker)
if(over == buckled && beaker)
if(iv_attached)
detach_iv(buckled, usr)
detach_iv(buckled, user)
else
attach_iv(buckled, usr)
attach_iv(buckled, user)
return
if(usr != over_object && ishuman(over_object))
if(user_buckle(over_object, usr))
attach_iv(buckled, usr)
if(user != over && ishuman(over))
if(user_buckle(over, user))
attach_iv(buckled, user)
return
if(beaker)
remove_beaker(usr)
remove_beaker(user)
return
if(vitals)
remove_vitals(usr)
remove_vitals(user)
return
if(buckled)
return
@@ -41,8 +41,8 @@
if(buckled)
buckled.set_dir(dir)
/obj/structure/bed/stool/chair/MouseDrop_T(atom/dropping, mob/user)
if(dropping == user && user.loc != loc && (REVERSE_DIR(dir) & angle2dir(get_angle(src, user))))
/obj/structure/bed/stool/chair/mouse_drop_receive(atom/dropped, mob/user, params)
if(dropped == user && user.loc != loc && (REVERSE_DIR(dir) & angle2dir(get_angle(src, user))))
user.visible_message("<b>[user]</b> starts climbing over the back of \the [src]...", SPAN_NOTICE("You start climbing over the back of \the [src]..."))
if(do_after(user, 2 SECONDS, do_flags = DO_UNIQUE))
user.forceMove(loc)
@@ -15,12 +15,12 @@
. = ..()
can_buckle = FALSE // Some idiot decided can_buckle should be a list...
/obj/structure/bed/stool/MouseDrop(over_object, src_location, over_location)
/obj/structure/bed/stool/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
. = ..()
if(over_object == usr && Adjacent(usr))
if(!held_item || use_check_and_message(usr) || buckled || (anchored && padding_material)) // Make sure held_item = null if you don't want it to get picked up.
if(over == user && Adjacent(user))
if(!held_item || use_check_and_message(user) || buckled || (anchored && padding_material)) // Make sure held_item = null if you don't want it to get picked up.
return
usr.visible_message(SPAN_NOTICE("[usr] [withdraw_verb]s \the [src.name]."), SPAN_NOTICE("You [withdraw_verb] \the [src.name]."))
user.visible_message(SPAN_NOTICE("[user] [withdraw_verb]s \the [src.name]."), SPAN_NOTICE("You [withdraw_verb] \the [src.name]."))
var/obj/item/material/stool/S = new held_item(src.loc, material.name, padding_material?.name, painted_colour) // Handles all the material code so you don't have to.
TransferComponents(S)
if(material_alteration & MATERIAL_ALTERATION_COLOR) // For snowflakes like wood chairs.
@@ -33,8 +33,8 @@
S.blood_DNA |= blood_DNA // Transfer blood, if any.
S.add_blood()
S.dir = dir
S.add_fingerprint(usr)
usr.put_in_hands(S)
S.add_fingerprint(user)
user.put_in_hands(S)
S.update_icon()
qdel(src)
@@ -197,19 +197,20 @@
/obj/item/material/stool/AltClick(mob/user)
deploy(user)
/obj/item/material/stool/MouseDrop(mob/user)
if((user && (!use_check(user))) && (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
/obj/item/material/stool/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))
if(!istype(over, /mob/living/carbon/slime) && !istype(over, /mob/living/simple_animal))
var/mob/mouse_dropped_over = over
if( !mouse_dropped_over.get_active_hand() ) //if active hand is empty
var/mob/living/carbon/human/H = user
var/obj/item/organ/external/temp = H.organs_by_name["r_hand"]
if (H.hand)
temp = H.organs_by_name["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
/obj/item/material/stool/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
+1 -1
View File
@@ -28,7 +28,7 @@
if(icon_state == initial(icon_state))
icon_state = pick(icon_states(icon) - icon_state)
/obj/structure/trash_pile/MouseDrop_T(atom/dropping, mob/user)
/obj/structure/trash_pile/mouse_drop_receive(atom/dropped, mob/user, params)
if(!Adjacent(user) || use_check_and_message(user))
return
user.visible_message("<b>[user]</b> starts climbing into \the [src]...", SPAN_NOTICE("You start climbing into \the [src]..."))
+2 -2
View File
@@ -790,8 +790,8 @@ ABSTRACT_TYPE(/obj/structure/stairs/urban/road_ramp)
/obj/item/storage/toolbox/cash_register_storage
name = "cash compartment"
/obj/structure/cash_register/MouseDrop(atom/over)
if(usr == over && ishuman(over))
/obj/structure/cash_register/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if(user == over && ishuman(over))
var/mob/living/carbon/human/H = over
storage_compartment.open(H)