[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:
SkyratBot
2020-11-25 13:56:56 +01:00
committed by GitHub
co-authored by Ghom
parent d51c3fe63f
commit e6879819ea
50 changed files with 114 additions and 176 deletions
+3 -3
View File
@@ -75,11 +75,11 @@
#define TRANSITIONEDGE 7 //Distance from edge to move to another z-level
//used by canUseTopic()
#define BE_CLOSE TRUE //in the case of a silicon, to select if they need to be next to the atom
#define NO_DEXTERITY TRUE //if other mobs (monkeys, aliens, etc) can use this // I had to change 20+ files because some non-dnd-playing fuckchumbis can't spell "dexterity"
#define NO_TK TRUE
#define FLOOR_OKAY TRUE // if you can use it while resting
//used by canUseTopic()
#define NO_TK TRUE // if you can't use it from a distance with telekinesis
#define FLOOR_OKAY TRUE // if you can use it while resting
//singularity defines
#define STAGE_ONE 1
+1 -1
View File
@@ -133,7 +133,7 @@
after_rotation.Invoke(user,rotation_type)
/datum/component/simple_rotation/proc/default_can_user_rotate(mob/living/user, rotation_type)
if(!istype(user) || !user.canUseTopic(parent, BE_CLOSE, NO_DEXTERITY))
if(!istype(user) || !user.canUseTopic(parent, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return FALSE
return TRUE
@@ -169,7 +169,7 @@
/obj/structure/frame/computer/AltClick(mob/user)
..()
if(!isliving(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
if(anchored)
+1 -3
View File
@@ -243,9 +243,7 @@
/obj/machinery/launchpad/briefcase/MouseDrop(over_object, src_location, over_location)
. = ..()
if(over_object == usr)
if(!briefcase || !usr.can_hold_items())
return
if(!usr.canUseTopic(src, BE_CLOSE, ismonkey(usr)))
if(!briefcase || !usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
usr.visible_message("<span class='notice'>[usr] starts closing [src]...</span>", "<span class='notice'>You start closing [src]...</span>")
if(do_after(usr, 30, target = usr))
+1 -1
View File
@@ -421,7 +421,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
/obj/item/attack_alien(mob/user)
var/mob/living/carbon/alien/A = user
if(!ISADVANCEDTOOLUSER(A))
if(!user.can_hold_items(src))
if(src in A.contents) // To stop Aliens having items stuck in their pockets
A.dropItemToGround(src)
to_chat(user, "<span class='warning'>Your claws aren't capable of such fine manipulation!</span>")
+6 -7
View File
@@ -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
+2 -2
View File
@@ -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))
+1 -1
View File
@@ -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))
+1 -1
View File
@@ -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>")
+1 -1
View File
@@ -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>")
+1 -1
View File
@@ -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)
+9 -15
View File
@@ -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.
*
+1 -1
View File
@@ -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]
+2 -2
View File
@@ -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)
@@ -37,7 +37,7 @@
var/mob/living/L = user
if(istype(L))
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return FALSE
else
return TRUE
@@ -240,9 +240,9 @@
/obj/structure/chair/MouseDrop(over_object, src_location, over_location)
. = ..()
if(over_object == usr && Adjacent(usr))
if(!item_chair || !usr.can_hold_items() || has_buckled_mobs() || src.flags_1 & NODECONSTRUCT_1)
if(!item_chair || has_buckled_mobs() || src.flags_1 & NODECONSTRUCT_1)
return
if(!usr.canUseTopic(src, BE_CLOSE, ismonkey(usr)))
if(!usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
usr.visible_message("<span class='notice'>[usr] grabs \the [src.name].</span>", "<span class='notice'>You grab \the [src.name].</span>")
var/obj/item/C = new item_chair(loc)
@@ -415,9 +415,9 @@
if(has_gravity())
playsound(src, 'sound/machines/clockcult/integration_cog_install.ogg', 50, TRUE)
/obj/structure/chair/bronze/AltClick(mob/living/user)
/obj/structure/chair/bronze/AltClick(mob/user)
turns = 0
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
if(!(datum_flags & DF_ISPROCESSING))
user.visible_message("<span class='notice'>[user] spins [src] around, and the last vestiges of Ratvarian technology keeps it spinning FOREVER.</span>", \
+1 -1
View File
@@ -110,7 +110,7 @@
return attack_hand(user)
/obj/structure/extinguisher_cabinet/AltClick(mob/living/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
toggle_cabinet(user)
+2 -2
View File
@@ -157,14 +157,14 @@
to_chat(user, "<span class='warning'>The rotation is locked!</span>")
return FALSE
var/new_angle = input(user, "Input a new angle for primary reflection face.", "Reflector Angle", rotation_angle) as null|num
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
if(!isnull(new_angle))
setAngle(SIMPLIFY_DEGREES(new_angle))
return TRUE
/obj/structure/reflector/AltClick(mob/user)
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
else if(finished)
rotate(user)
+1 -1
View File
@@ -28,7 +28,7 @@
to_chat(user, "<span class='warning'>It's bolted to the floor, you'll need to unwrench it first.</span>")
/obj/structure/statue/proc/can_user_rotate(mob/user)
return isliving(user) && user.canUseTopic(src, BE_CLOSE, no_dexterity = ismonkey(user))
return !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))
/obj/structure/statue/attackby(obj/item/W, mob/living/user, params)
add_fingerprint(user)
@@ -83,7 +83,7 @@
AddSpell(new /obj/effect/proc_holder/spell/aoe_turf/revenant/malfunction(null))
random_revenant_name()
/mob/living/simple_animal/revenant/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
/mob/living/simple_animal/revenant/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, no_hands = FALSE, floor_okay=FALSE)
return FALSE
/mob/living/simple_animal/revenant/proc/random_revenant_name()
@@ -91,7 +91,7 @@
/obj/machinery/portable_atmospherics/AltClick(mob/living/user)
. = ..()
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, !ismonkey(user)) || !can_interact(user))
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)) || !can_interact(user))
return
if(holding)
to_chat(user, "<span class='notice'>You remove [holding] from [src].</span>")
+10 -10
View File
@@ -99,16 +99,16 @@
. += "<span class='notice'>Alt-click to take a candy corn.</span>"
/obj/item/clothing/head/fedora/det_hat/AltClick(mob/user)
if(user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
..()
if(loc == user)
if(candy_cooldown < world.time)
var/obj/item/food/candy_corn/CC = new /obj/item/food/candy_corn(src)
user.put_in_hands(CC)
to_chat(user, "<span class='notice'>You slip a candy corn from your hat.</span>")
candy_cooldown = world.time+1200
else
to_chat(user, "<span class='warning'>You just took a candy corn! You should wait a couple minutes, lest you burn through your stash.</span>")
. = ..()
if(loc != user || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
if(candy_cooldown < world.time)
var/obj/item/food/candy_corn/CC = new /obj/item/food/candy_corn(src)
user.put_in_hands(CC)
to_chat(user, "<span class='notice'>You slip a candy corn from your hat.</span>")
candy_cooldown = world.time+1200
else
to_chat(user, "<span class='warning'>You just took a candy corn! You should wait a couple minutes, lest you burn through your stash.</span>")
//Mime
+1 -3
View File
@@ -23,9 +23,7 @@
/obj/item/clothing/head/soft/AltClick(mob/user)
..()
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
return
else
if(user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
flip(user)
+1 -3
View File
@@ -23,9 +23,7 @@
/obj/item/clothing/mask/breath/AltClick(mob/user)
..()
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
return
else
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
adjustmask(user)
/obj/item/clothing/mask/breath/examine(mob/user)
@@ -165,13 +165,13 @@
/// Open the cell cover when ALT+Click on the suit
/obj/item/clothing/suit/space/AltClick(mob/living/user)
if(!user || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return ..()
toggle_spacesuit_cell(user)
/// Remove the cell whent he cover is open on CTRL+Click
/obj/item/clothing/suit/space/CtrlClick(mob/living/user)
if(user?.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
if(cell_cover_open && cell)
remove_cell(user)
return
+1 -1
View File
@@ -110,7 +110,7 @@
/obj/item/clothing/suit/toggle/AltClick(mob/user)
..()
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
else
suit_toggle(user)
+4 -5
View File
@@ -239,13 +239,12 @@
if(.)
return
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
if(attached_accessory)
remove_accessory(user)
else
if(attached_accessory)
remove_accessory(user)
else
rolldown()
rolldown()
/obj/item/clothing/under/verb/jumpsuit_adjust()
set name = "Adjust Jumpsuit Style"
+1 -1
View File
@@ -73,7 +73,7 @@
return
/obj/item/clothing/accessory/AltClick(mob/user)
if(istype(user) && user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
if(initial(above_suit))
above_suit = !above_suit
to_chat(user, "[src] will be worn [above_suit ? "above" : "below"] your suit.")
+1 -1
View File
@@ -802,7 +802,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
update_icon()
/mob/dead/observer/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
/mob/dead/observer/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE)
return isAdminGhostAI(usr)
/mob/dead/observer/is_literate()
@@ -130,8 +130,8 @@ Des: Removes all infected images from the alien.
SEND_SIGNAL(new_xeno, COMSIG_NANITE_SYNC, nanites)
qdel(src)
/mob/living/carbon/alien/can_hold_items()
return ISADVANCEDTOOLUSER(src) && ..()
/mob/living/carbon/alien/can_hold_items(obj/item/I)
return ((I && istype(I, /obj/item/clothing/mask/facehugger)) || (ISADVANCEDTOOLUSER(src) && ..()))
/mob/living/carbon/alien/on_lying_down(new_lying_angle)
. = ..()
@@ -54,9 +54,6 @@
/obj/item/clothing/mask/facehugger/attackby(obj/item/O, mob/user, params)
return O.attack_obj(src, user)
/obj/item/clothing/mask/facehugger/attack_alien(mob/user) //can be picked up by aliens
return attack_hand(user)
//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/item/clothing/mask/facehugger/attack_hand(mob/user)
if((stat == CONSCIOUS && !sterile) && !isalien(user))
@@ -807,17 +807,6 @@
remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, "#000000")
cut_overlay(MA)
/mob/living/carbon/human/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, floor_okay=FALSE)
if(!(mobility_flags & MOBILITY_UI) && !floor_okay)
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
return FALSE
if(!Adjacent(M) && (M.loc != src))
if((be_close == FALSE) || (!no_tk && (dna.check_mutation(TK) && tkMaxRangeCheck(src, M))))
return TRUE
to_chat(src, "<span class='warning'>You are too far away!</span>")
return FALSE
return TRUE
/mob/living/carbon/human/resist_restraints()
if(wear_suit?.breakouttime)
changeNext_move(CLICK_CD_BREAKOUT)
+16 -5
View File
@@ -1115,14 +1115,25 @@
/mob/living/proc/harvest(mob/living/user) //used for extra objects etc. in butchering
return
/mob/living/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
if(incapacitated())
/mob/living/can_hold_items(obj/item/I)
return usable_hands && ..()
/mob/living/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE)
if(!(mobility_flags & MOBILITY_UI) && !floor_okay)
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
return FALSE
if(be_close && !in_range(M, src))
to_chat(src, "<span class='warning'>You are too far away!</span>")
if(be_close && !Adjacent(M) && (M.loc != src))
if(no_tk)
to_chat(src, "<span class='warning'>You are too far away!</span>")
return FALSE
var/datum/dna/D = has_dna()
if(!D || !D.check_mutation(TK) || !tkMaxRangeCheck(src, M))
to_chat(src, "<span class='warning'>You are too far away!</span>")
return FALSE
if(need_hands && !can_hold_items(isitem(M) ? M : null)) //almost redundant if it weren't for mobs,
to_chat(src, "<span class='warning'>You don't have the physical ability to do this!</span>")
return FALSE
if(!no_dexterity)
if(!no_dexterity && !ISADVANCEDTOOLUSER(src))
to_chat(src, "<span class='warning'>You don't have the dexterity to do this!</span>")
return FALSE
return TRUE
+3 -6
View File
@@ -802,14 +802,11 @@
to_chat(src, "You have been downloaded to a mobile storage device. Remote device connection severed.")
to_chat(user, "<span class='boldnotice'>Transfer successful</span>: [name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.")
/mob/living/silicon/ai/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
if(control_disabled || incapacitated())
/mob/living/silicon/ai/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE)
if(control_disabled)
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
return FALSE
if(be_close && !in_range(M, src))
to_chat(src, "<span class='warning'>You are too far away!</span>")
return FALSE
return can_see(M) //stop AIs from leaving windows open and using then after they lose vision
return can_see(M) && ..() //stop AIs from leaving windows open and using then after they lose vision
/mob/living/silicon/ai/proc/can_see(atom/A)
if(isturf(loc)) //AI in core, check if on cameras
+2 -5
View File
@@ -203,11 +203,8 @@
// See software.dm for Topic()
/mob/living/silicon/pai/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
if(be_close && !in_range(M, src))
to_chat(src, "<span class='warning'>You are too far away!</span>")
return FALSE
return TRUE
/mob/living/silicon/pai/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE)
return ..(M, be_close, no_dexterity, no_tk, need_hands, TRUE) //Resting is just an aesthetic feature for them.
/mob/proc/makePAI(delold)
var/obj/item/paicard/card = new /obj/item/paicard(get_turf(src))
@@ -403,6 +403,6 @@
/mob/living/silicon/robot/swap_hand()
cycle_modules()
/mob/living/silicon/robot/can_hold_items()
return FALSE //held_items are used for modules.
/mob/living/silicon/robot/can_hold_items(obj/item/I)
return (I && (I in module.modules)) //Only if it's part of our module.
@@ -721,14 +721,11 @@
if(DISCONNECT) //Tampering with the wires
to_chat(connected_ai, "<br><br><span class='notice'>NOTICE - Remote telemetry lost with [name].</span><br>")
/mob/living/silicon/robot/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
if(stat || lockcharge || low_power_mode)
/mob/living/silicon/robot/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE)
if(lockcharge || low_power_mode)
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
return FALSE
if(be_close && !in_range(M, src))
to_chat(src, "<span class='warning'>You are too far away!</span>")
return FALSE
return TRUE
return ..()
/mob/living/silicon/robot/updatehealth()
..()
@@ -538,18 +538,6 @@
if(target)
return new childspawn(target)
/mob/living/simple_animal/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
if(incapacitated())
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
return FALSE
if(be_close && !in_range(M, src))
to_chat(src, "<span class='warning'>You are too far away!</span>")
return FALSE
if(!(no_dexterity || dextrous))
to_chat(src, "<span class='warning'>You don't have the dexterity to do this!</span>")
return FALSE
return TRUE
/mob/living/simple_animal/stripPanelUnequip(obj/item/what, mob/who, where)
if(!canUseTopic(who, BE_CLOSE))
return
@@ -610,7 +598,7 @@
/mob/living/simple_animal/get_idcard(hand_first)
return (..() || access_card)
/mob/living/simple_animal/can_hold_items()
/mob/living/simple_animal/can_hold_items(obj/item/I)
return dextrous && ..()
/mob/living/simple_animal/activate_hand(selhand)
+1 -5
View File
@@ -1037,7 +1037,7 @@
return TRUE
///Can the mob use Topic to interact with machines
/mob/proc/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE)
/mob/proc/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE)
return
///Can this mob use storage
@@ -1190,10 +1190,6 @@
return
return TRUE
///Can this mob hold items
/mob/proc/can_hold_items()
return length(held_items)
/**
* Get the mob VV dropdown extras
*/
+4
View File
@@ -546,3 +546,7 @@
///Can the mob see reagents inside of containers?
/mob/proc/can_see_reagents()
return stat == DEAD || has_unlimited_silicon_privilege //Dead guys and silicons can always see reagents
///Can this mob hold items
/mob/proc/can_hold_items(obj/item/I)
return length(held_items)
+1 -1
View File
@@ -100,7 +100,7 @@
/obj/structure/filingcabinet/Topic(href, href_list)
if(!usr.canUseTopic(src, BE_CLOSE, ismonkey(usr)))
if(!usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(usr)))
return
if(href_list["retrieve"])
usr << browse("", "window=filingcabinet") // Close the menu
+2 -2
View File
@@ -121,8 +121,8 @@
. = ..()
. += "<span class='notice'>Alt-click [src] to fold it into a paper plane.</span>"
/obj/item/paper/AltClick(mob/living/carbon/user, obj/item/I)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
/obj/item/paper/AltClick(mob/living/user, obj/item/I)
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
if(istype(src, /obj/item/paper/carbon))
var/obj/item/paper/carbon/Carbon = src
@@ -105,7 +105,7 @@
to_chat(user, "<span class='notice'>You switch to tube A.</span>")
/obj/item/gun/ballistic/shotgun/automatic/dual_tube/AltClick(mob/living/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
rack()
@@ -266,7 +266,7 @@
hook = new /obj/item/gun/magic/hook/bounty(src)
/obj/item/gun/ballistic/shotgun/doublebarrel/hook/AltClick(mob/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
if(toggled)
to_chat(user,"<span class='notice'>You switch to the shotgun.</span>")
@@ -127,7 +127,7 @@
update_icon()
/obj/item/reagent_containers/hypospray/medipen/attack_self(mob/user)
if(user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK, FLOOR_OKAY))
if(user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK, FALSE, FLOOR_OKAY))
inject(user, user)
/obj/item/reagent_containers/hypospray/medipen/update_icon_state()
+3 -1
View File
@@ -165,8 +165,10 @@
user.forceMove(loc)
update_icon()
// monkeys and xenos can only pull the flush lever
// clumsy monkeys and xenos can only pull the flush lever
/obj/machinery/disposal/attack_paw(mob/user)
if(ISADVANCEDTOOLUSER(user))
return ..()
if(machine_stat & BROKEN)
return
flush = !flush
-16
View File
@@ -89,22 +89,6 @@
return UI_DISABLED
return ..()
/**
* public
*
* Check the distance for a living mob.
* Really only used for checks outside the context of a mob.
* Otherwise, use shared_living_ui_distance().
*
* required src_object The object which owns the UI.
* required user mob The mob who opened/is using the UI.
*
* return UI_state The state of the UI.
*/
/atom/proc/contents_ui_distance(src_object, mob/living/user)
// Just call this mob's check.
return user.shared_living_ui_distance(src_object)
/**
* public
*
+4 -14
View File
@@ -18,15 +18,10 @@ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
/mob/living/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE && loc)
. = min(., loc.contents_ui_distance(src_object, src)) // Check the distance...
if(. == UI_INTERACTIVE) // Non-human living mobs can only look, not touch.
return UI_UPDATE
/mob/living/carbon/human/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE)
if(. > UI_CLOSE && loc) //must not be in nullspace.
. = min(., shared_living_ui_distance(src_object)) // Check the distance...
if(. == UI_INTERACTIVE && !ISADVANCEDTOOLUSER(src)) // unhandy living mobs can only look, not touch.
return UI_UPDATE
/mob/living/silicon/robot/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
@@ -49,14 +44,9 @@ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
return UI_INTERACTIVE
return UI_CLOSE
/mob/living/simple_animal/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE)
. = min(., shared_living_ui_distance(src_object)) //simple animals can only use things they're near.
/mob/living/silicon/pai/default_can_use_topic(src_object)
// pAIs can only use themselves and the owner's radio.
if((src_object == src || src_object == radio) && !stat)
return UI_INTERACTIVE
else
return ..()
return min(..(), UI_UPDATE)
+1 -1
View File
@@ -45,7 +45,7 @@
inserted_key = I
/obj/vehicle/ridden/AltClick(mob/user)
if(!inserted_key || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!inserted_key || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !issilicon(user)))
return ..()
if(!is_occupant(user))
to_chat(user, "<span class='warning'>You must be riding the [src] to remove [src]'s key!</span>")
+1 -1
View File
@@ -105,7 +105,7 @@
/obj/vehicle/ridden/wheelchair/proc/can_user_rotate(mob/living/user)
var/mob/living/L = user
if(istype(L))
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return FALSE
if(isobserver(user) && CONFIG_GET(flag/ghost_interaction))
return TRUE