added a thing (#11707)

This commit is contained in:
Maxim
2021-07-18 08:42:43 -04:00
committed by GitHub
parent c8bceffb89
commit 1fc34a9189
5 changed files with 75 additions and 2 deletions

View File

@@ -340,3 +340,4 @@
#define WABBAJACK (1<<6)
#define SLEEP_CHECK_DEATH(X) sleep(X); if(QDELETED(src) || stat == DEAD) return;
#define INTERACTING_WITH(X, Y) (Y in X.do_afters)

View File

@@ -254,6 +254,10 @@ GLOBAL_LIST_EMPTY(species_list)
if(target && !isturf(target))
Tloc = target.loc
if(target)
LAZYADD(user.do_afters, target)
LAZYADD(target.targeted_by, user)
var/atom/Uloc = user.loc
var/drifting = 0
@@ -299,6 +303,10 @@ GLOBAL_LIST_EMPTY(species_list)
. = 0
break
if(target && !(target in user.do_afters))
. = 0
break
if(needhand)
//This might seem like an odd check, but you can still need a hand even when it's empty
//i.e the hand is used to pull some item/tool out of the construction
@@ -312,6 +320,10 @@ GLOBAL_LIST_EMPTY(species_list)
if (progress)
qdel(progbar)
if(!QDELETED(target))
LAZYREMOVE(user.do_afters, target)
LAZYREMOVE(target.targeted_by, user)
/mob/proc/do_after_coefficent() // This gets added to the delay on a do_after, default 1
. = 1
return

View File

@@ -78,6 +78,9 @@
var/chat_color_darkened // A luminescence-shifted value of the last color calculated for chatmessage overlays
///Mobs that are currently do_after'ing this atom, to be cleared from on Destroy()
var/list/targeted_by
var/atom/orbit_target //Reference to atom being orbited
/**
* Called when an atom is created in byond (built in engine proc)
@@ -215,6 +218,12 @@
LAZYCLEARLIST(overlays)
LAZYCLEARLIST(priority_overlays)
for(var/i in targeted_by)
var/mob/M = i
LAZYREMOVE(M.do_afters, src)
targeted_by = null
QDEL_NULL(light)
return ..()

View File

@@ -432,8 +432,7 @@
// shift-click catcher may issue examinate() calls for out-of-sight turfs
return
if(is_blind(src))
to_chat(src, "<span class='notice'>Something is there but you can't see it.</span>")
if(is_blind(src) && !blind_examine_check(A))
return
face_atom(A)
@@ -441,6 +440,55 @@
to_chat(src, result.Join("\n"))
SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, A)
/mob/proc/blind_examine_check(atom/examined_thing)
return TRUE
/mob/living/blind_examine_check(atom/examined_thing)
//need to be next to something and awake
if(!Adjacent(examined_thing) || incapacitated())
to_chat(src, "<span class='warning'>Something is there, but you can't see it!</span>")
return FALSE
var/active_item = get_active_held_item()
if(active_item && active_item != examined_thing)
to_chat(src, "<span class='warning'>Your hands are too full to examine this!</span>")
return FALSE
//you can only initiate exaimines if you have a hand, it's not disabled, and only as many examines as you have hands
/// our active hand, to check if it's disabled/detatched
var/obj/item/bodypart/active_hand = has_active_hand()? get_active_hand() : null
if(!active_hand || active_hand.is_disabled() || LAZYLEN(do_afters) >= get_num_arms())
to_chat(src, "<span class='warning'>You don't have a free hand to examine this!</span>")
return FALSE
//you can only queue up one examine on something at a time
if(examined_thing in do_afters)
return FALSE
to_chat(src, "<span class='notice'>You start feeling around for something...</span>")
visible_message("<span class='notice'> [name] begins feeling around for \the [examined_thing.name]...</span>")
/// how long it takes for the blind person to find the thing they're examining
var/examine_delay_length = rand(1 SECONDS, 2 SECONDS)
if(isobj(examined_thing))
examine_delay_length *= 1.5
else if(ismob(examined_thing) && examined_thing != src)
examine_delay_length *= 2
if(examine_delay_length > 0 && !do_after(src, examine_delay_length, target = examined_thing))
to_chat(src, "<span class='notice'>You can't get a good feel for what is there.</span>")
return FALSE
//now we touch the thing we're examining
/// our current intent, so we can go back to it after touching
var/previous_intent = a_intent
a_intent = INTENT_HELP
examined_thing.attack_hand(src)
a_intent = previous_intent
return TRUE
/**
* Point at an atom
*

View File

@@ -202,6 +202,9 @@
///Allows a datum to intercept all click calls this mob is the so
var/datum/click_intercept
///For storing what do_after's someone has, in case we want to restrict them to only one of a certain do_after at a time
var/list/do_afters
///THe z level this mob is currently registered in
var/registered_z = null