Examine More

This commit is contained in:
OctusGit
2023-12-05 17:07:32 -06:00
parent ff1ef220cd
commit fdf9a1d8b8
4 changed files with 36 additions and 1 deletions
+5
View File
@@ -199,6 +199,11 @@
#define INVISIBILITY_ABSTRACT 101
#define UNHEALING_EAR_DAMAGE 100
/// 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)
//Human sub-species
#define isabductor(A) (is_species(A, /datum/species/abductor))
#define isgolem(A) (is_species(A, /datum/species/golem))
+6
View File
@@ -387,6 +387,12 @@
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)
/atom/proc/examine_more(mob/user)
SHOULD_CALL_PARENT(TRUE)
RETURN_TYPE(/list)
. = list()
/**
* Updates the appearence of the icon
*
+3
View File
@@ -125,6 +125,9 @@
/// The client's movement keybindings to directions, which work regardless of modifiers.
var/list/movement_kb_dirs = list()
///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
/client/vv_edit_var(var_name, var_value)
switch(var_name)
// I know we will never be in a world where admins are editing client vars to let people bypass TOS
+22 -1
View File
@@ -639,9 +639,30 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
return 1
face_atom(A)
var/list/result = A.examine(src)
var/list/result
if(client)
LAZYINITLIST(client.recent_examines)
var/ref_to_atom = ref(A)
var/examine_time = client.recent_examines[ref_to_atom]
if(examine_time && (world.time - examine_time < EXAMINE_MORE_WINDOW))
result = A.examine_more(src)
if(!length(result))
result += "<span class='notice'><i>You examine [A] closer, but find nothing of interest...</i></span>"
else
result = A.examine(src)
client.recent_examines[ref_to_atom] = world.time // set to when we last normal examine'd them
addtimer(CALLBACK(src, PROC_REF(clear_from_recent_examines), ref_to_atom), RECENT_EXAMINE_MAX_WINDOW)
else
result = A.examine(src) // if a tree is examined but no client is there to see it, did the tree ever really exist?
to_chat(src, chat_box_examine(result.Join("\n")))
/mob/proc/clear_from_recent_examines(ref_to_clear)
SIGNAL_HANDLER
if(!client)
return
LAZYREMOVE(client.recent_examines, ref_to_clear)
/mob/proc/ret_grab(obj/effect/list_container/mobl/L as obj, flag)
if((!istype(l_hand, /obj/item/grab) && !istype(r_hand, /obj/item/grab)))
if(!L)