Skip to content

Commit

Permalink
examinate
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsar-Salat committed Jan 15, 2025
1 parent 51d107b commit dd7e20e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 12 deletions.
7 changes: 7 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,13 @@ GLOBAL_LIST_INIT(available_random_trauma_list, list(
#define DOING_INTERACTION_WITH_TARGET(user, target) (LAZYACCESS(user.do_afters, target))
#define DOING_INTERACTION_WITH_TARGET_LIMIT(user, target, max_interaction_count) ((LAZYACCESS(user.do_afters, target) || 0) >= max_interaction_count)

// recent examine defines
/// How long it takes for an examined atom to be removed from recent_examines. Should be the max of the below time windows
#define RECENT_EXAMINE_MAX_WINDOW (2 SECONDS)
/// If you examine the same atom twice in this timeframe, we call examine_more() instead of examine()
#define EXAMINE_MORE_WINDOW (1 SECONDS)


#define SILENCE_RANGED_MESSAGE (1<<0)

// Mob Playability Set By Admin Or Ghosting
Expand Down
2 changes: 2 additions & 0 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@
RegisterSignal(new_character, COMSIG_MOB_DEATH, PROC_REF(set_death_time))
if(active || force_key_move)
new_character.key = key //now transfer the key to link the client to our new body
if(new_character.client)
LAZYCLEARLIST(new_character.client.recent_examines)

SEND_SIGNAL(src, COMSIG_MIND_TRANSFER_TO, old_current, new_character)
// Update SSD indicators
Expand Down
3 changes: 3 additions & 0 deletions code/modules/client/client_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@

var/datum/view_data/view_size

///A lazy list of atoms we've examined in the last RECENT_EXAMINE_MAX_WINDOW (default 2) seconds, so that we will call [/atom/proc/examine_more] instead of [/atom/proc/examine] on them when examining
var/list/recent_examines

// List of all asset filenames sent to this client by the asset cache, along with their assoicated md5s
var/list/sent_assets = list()
/// List of all completed blocking send jobs awaiting acknowledgement by send_asset
Expand Down
6 changes: 3 additions & 3 deletions code/modules/clothing/masks/_masks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
var/unique_death /// The unique sound effect of dying while wearing this

/obj/item/clothing/mask/attack_self(mob/user)
if(CHECK_BITFIELD(clothing_flags, VOICEBOX_TOGGLABLE))
TOGGLE_BITFIELD(clothing_flags, VOICEBOX_DISABLED)
var/status = !CHECK_BITFIELD(clothing_flags, VOICEBOX_DISABLED)
if((clothing_flags & VOICEBOX_TOGGLABLE))
clothing_flags ^= (VOICEBOX_DISABLED)
var/status = !(clothing_flags & VOICEBOX_DISABLED)
to_chat(user, "<span class='notice'>You turn the voice box in [src] [status ? "on" : "off"].</span>")

/obj/item/clothing/mask/equipped(mob/M, slot)
Expand Down
1 change: 0 additions & 1 deletion code/modules/clothing/masks/breath.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
visor_flags_cover = MASKCOVERSMOUTH
resistance_flags = NONE


/datum/armor/mask_breath
bio = 50

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1696,8 +1696,8 @@
/// Proc to append behavior to the condition of being floored. Called when the condition starts.
/mob/living/proc/on_floored_start()
if(body_position == STANDING_UP) //force them on the ground
set_lying_angle(pick(90, 270))
set_body_position(LYING_DOWN)
set_lying_angle(pick(90, 270))
on_fall()


Expand Down
38 changes: 31 additions & 7 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,40 @@
* [this byond forum post](https://secure.byond.com/forum/?post=1326139&page=2#comment8198716)
* for why this isn't atom/verb/examine()
*/
/mob/verb/examinate(atom/A as mob|obj|turf in view()) //It used to be oview(12), but I can't really say why
/mob/verb/examinate(atom/examinify as mob|obj|turf in view()) //It used to be oview(12), but I can't really say why
set name = "Examine"
set category = "IC"

if(isturf(A) && !(sight & SEE_TURFS) && !(A in view(client ? client.view : world.view, src)))
if(isturf(examinify) && !(sight & SEE_TURFS) && !(examinify in view(client ? client.view : world.view, src)))
// shift-click catcher may issue examinate() calls for out-of-sight turfs
return

if(is_blind(src) && !blind_examine_check(A))
if(is_blind(src) && !blind_examine_check(examinify))
return

face_atom(A)
var/list/result = A.examine(src)
face_atom(examinify)
var/list/result
if(client)
LAZYINITLIST(client.recent_examines)
var/ref_to_atom = ref(examinify)
var/examine_time = client.recent_examines[ref_to_atom]
if(examine_time && (world.time - examine_time < EXAMINE_MORE_WINDOW))
result = examinify.examine_more(src)
if(!length(result))
result += "<span class='notice'><i>You examine [examinify] closer, but find nothing of interest...</i></span>"
else
result = examinify.examine(src)
client.recent_examines[ref_to_atom] = world.time // set to when we last normal examine'd them
addtimer(CALLBACK(src, .proc/clear_from_recent_examines, ref_to_atom), RECENT_EXAMINE_MAX_WINDOW)
else
result = examinify.examine(src) // if a tree is examined but no client is there to see it, did the tree ever really exist?

to_chat(src, EXAMINE_BLOCK(jointext(result, "\n")))
SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, A)
if(result.len)
for(var/i in 1 to (length(result) - 1))
result[i] += "\n"

to_chat(src, EXAMINE_BLOCK("<span class='infoplain'>[result.Join()]</span>"))
SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, examinify)

/mob/proc/blind_examine_check(atom/examined_thing)
return TRUE
Expand Down Expand Up @@ -595,6 +613,12 @@

return TRUE

/mob/proc/clear_from_recent_examines(ref_to_clear)
SIGNAL_HANDLER
if(!client)
return
LAZYREMOVE(client.recent_examines, ref_to_clear)

/**
* Called by using Activate Held Object with an empty hand/limb
*
Expand Down

0 comments on commit dd7e20e

Please sign in to comment.