mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
[MIRROR] CanUseTopic() refactor. (#1829)
* CanUseTopic() refactor. (#54747) * CanUseTopic() refactor. * Forgot about default_can_use_topic. Tested and working. * Update bin.dm * no-nonsense. * CanUseTopic() refactor. Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -159,14 +159,13 @@
|
||||
ui.open()
|
||||
|
||||
/obj/item/toy/crayon/spraycan/AltClick(mob/user)
|
||||
if(user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(has_cap)
|
||||
is_capped = !is_capped
|
||||
to_chat(user, "<span class='notice'>The cap on [src] is now [is_capped ? "on" : "off"].</span>")
|
||||
update_icon()
|
||||
if(has_cap && user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
|
||||
is_capped = !is_capped
|
||||
to_chat(user, "<span class='notice'>The cap on [src] is now [is_capped ? "on" : "off"].</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/crayon/CtrlClick(mob/user)
|
||||
if(can_change_colour && !isturf(loc) && user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(can_change_colour && !isturf(loc) && user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
|
||||
select_colour(user)
|
||||
else
|
||||
return ..()
|
||||
@@ -262,7 +261,7 @@
|
||||
|
||||
/obj/item/toy/crayon/proc/select_colour(mob/user)
|
||||
var/chosen_colour = input(user, "", "Choose Color", paint_color) as color|null
|
||||
if (!isnull(chosen_colour) && user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if (!isnull(chosen_colour) && user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
|
||||
paint_color = chosen_colour
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -82,10 +82,10 @@
|
||||
qdel(H)
|
||||
|
||||
/obj/item/holochip/AltClick(mob/user)
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return
|
||||
var/split_amount = round(input(user,"How many credits do you want to extract from the holochip?") as null|num)
|
||||
if(split_amount == null || split_amount <= 0 || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(split_amount == null || split_amount <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return
|
||||
else
|
||||
var/new_credits = spend(split_amount, TRUE)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
. += "<span class='notice'>Can be used again to interrupt the effect early. The recharge time is the same as the time spent in desync.</span>"
|
||||
|
||||
/obj/item/desynchronizer/AltClick(mob/living/user)
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return
|
||||
var/new_duration = input(user, "Set the duration (5-300):", "Desynchronizer", duration / 10) as null|num
|
||||
if(new_duration)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
. += "<span class='notice'>Insert [src] into an active quantum pad to link it.</span>"
|
||||
|
||||
/obj/item/quantum_keycard/AltClick(mob/living/user)
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You start pressing [src]'s unlink button...</span>")
|
||||
if(do_after(user, 40, target = src))
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
. += "<span class='notice'><b>Not Linked.</b> Use on another quantum spin inverter to establish a quantum link.</span>"
|
||||
|
||||
/obj/item/swapper/AltClick(mob/living/user)
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You break the current quantum link.</span>")
|
||||
if(!QDELETED(linked_swapper))
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
addtimer(CALLBACK(src, /obj/item/extinguisher/proc/move_chair, B, movementdirection, repetition), timer_seconds)
|
||||
|
||||
/obj/item/extinguisher/AltClick(mob/user)
|
||||
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
|
||||
return
|
||||
if(!user.is_holding(src))
|
||||
to_chat(user, "<span class='notice'>You must be holding the [src] in your hands do this!</span>")
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
toggle_igniter(user)
|
||||
|
||||
/obj/item/flamethrower/AltClick(mob/user)
|
||||
if(ptank && isliving(user) && user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(ptank && isliving(user) && user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
|
||||
user.put_in_hands(ptank)
|
||||
ptank = null
|
||||
to_chat(user, "<span class='notice'>You remove the plasma tank from [src]!</span>")
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
/obj/item/pet_carrier/MouseDrop(atom/over_atom)
|
||||
. = ..()
|
||||
if(isopenturf(over_atom) && usr.canUseTopic(src, BE_CLOSE, ismonkey(usr)) && usr.Adjacent(over_atom) && open && occupants.len)
|
||||
if(isopenturf(over_atom) && usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(usr)) && usr.Adjacent(over_atom) && open && occupants.len)
|
||||
usr.visible_message("<span class='notice'>[usr] unloads [src].</span>", \
|
||||
"<span class='notice'>You unload [src] onto [over_atom].</span>")
|
||||
for(var/V in occupants)
|
||||
|
||||
@@ -445,23 +445,17 @@
|
||||
. = ..()
|
||||
if(isturf(loc)) // to prevent people that are alt clicking a tile to see its content from getting undesidered pop ups
|
||||
return
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(is_cyborg || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)) || zero_amount())
|
||||
return
|
||||
if(is_cyborg)
|
||||
//get amount from user
|
||||
var/max = get_amount()
|
||||
var/stackmaterial = round(input(user,"How many sheets do you wish to take out of this stack? (Maximum [max])") as null|num)
|
||||
max = get_amount()
|
||||
stackmaterial = min(max, stackmaterial)
|
||||
if(stackmaterial == null || stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return
|
||||
else
|
||||
if(zero_amount())
|
||||
return
|
||||
//get amount from user
|
||||
var/max = get_amount()
|
||||
var/stackmaterial = round(input(user,"How many sheets do you wish to take out of this stack? (Maximum [max])") as null|num)
|
||||
max = get_amount()
|
||||
stackmaterial = min(max, stackmaterial)
|
||||
if(stackmaterial == null || stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
return
|
||||
else
|
||||
split_stack(user, stackmaterial)
|
||||
to_chat(user, "<span class='notice'>You take [stackmaterial] sheets out of the stack.</span>")
|
||||
split_stack(user, stackmaterial)
|
||||
to_chat(user, "<span class='notice'>You take [stackmaterial] sheets out of the stack.</span>")
|
||||
|
||||
/** Splits the stack into two stacks.
|
||||
*
|
||||
|
||||
@@ -694,7 +694,7 @@
|
||||
. += "<span class='notice'>Alt-click it to quickly draw the blade.</span>"
|
||||
|
||||
/obj/item/storage/belt/sabre/AltClick(mob/user)
|
||||
if(!iscarbon(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
|
||||
return
|
||||
if(length(contents))
|
||||
var/obj/item/I = contents[1]
|
||||
|
||||
@@ -217,8 +217,8 @@
|
||||
if(spawn_coupon)
|
||||
. += "<span class='notice'>There's a coupon on the back of the pack! You can tear it off once it's empty.</span>"
|
||||
|
||||
/obj/item/storage/fancy/cigarettes/AltClick(mob/living/carbon/user)
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
/obj/item/storage/fancy/cigarettes/AltClick(mob/user)
|
||||
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
|
||||
return
|
||||
var/obj/item/clothing/mask/cigarette/W = locate(/obj/item/clothing/mask/cigarette) in contents
|
||||
if(W && contents.len > 0)
|
||||
|
||||
Reference in New Issue
Block a user