mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +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:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user