From e91dce3ee718b5aaf41ab1bd64c20d9a9b329bd7 Mon Sep 17 00:00:00 2001
From: Octus <62493359+OctusGit@users.noreply.github.com>
Date: Sat, 6 Jan 2024 16:30:38 -0600
Subject: [PATCH] TG Double Examine (#23477)
* nice
* Apply suggestions from code review
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com>
* Update mod_control.dm
* fixes and modsuit fix
* Apply suggestions from code review
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
* think i did it right
* Apply suggestions from code review
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
* Update code/__DEFINES/mob_defines.dm
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
* Update atoms.dm
---------
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
---
code/__DEFINES/mob_defines.dm | 3 +++
code/game/atoms.dm | 6 ++++++
code/modules/client/client_defines.dm | 3 +++
code/modules/mob/mob.dm | 20 +++++++++++++++++++-
code/modules/mod/mod_control.dm | 5 ++++-
code/modules/mod/mod_theme.dm | 2 +-
6 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/code/__DEFINES/mob_defines.dm b/code/__DEFINES/mob_defines.dm
index 497c229f08d..de0aafa4096 100644
--- a/code/__DEFINES/mob_defines.dm
+++ b/code/__DEFINES/mob_defines.dm
@@ -199,6 +199,9 @@
#define INVISIBILITY_ABSTRACT 101
#define UNHEALING_EAR_DAMAGE 100
+/// If you examine the same atom twice in this timeframe, we call examine_more() instead of examine()
+#define EXAMINE_MORE_WINDOW 1 SECONDS
+
#define DIRECTION_LOCK_SLOWDOWN 3
//Human sub-species
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 5126bb5bc15..5eb55e8761a 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -387,6 +387,12 @@
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)
+/atom/proc/examine_more(mob/user) ///Extended description of an object. Allows you to double examine objects and have them give you a second description of an item. Useful for writing flavourful stuff.
+ SHOULD_CALL_PARENT(TRUE)
+ RETURN_TYPE(/list)
+
+ return list()
+
/**
* Updates the appearence of the icon
*
diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm
index 686f2eae34c..ed0268a6172 100644
--- a/code/modules/client/client_defines.dm
+++ b/code/modules/client/client_defines.dm
@@ -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
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index c3b9c8c4442..14d6013564a 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -628,7 +628,25 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
return 1
face_atom(A)
- var/list/result = A.examine(src)
+ if(!client)
+ var/list/result = A.examine(src)
+ to_chat(src, chat_box_examine(result.Join("\n")))
+ return
+
+ var/list/result
+ LAZYINITLIST(client.recent_examines)
+ for(var/key in client.recent_examines)
+ if(client.recent_examines[key] < world.time)
+ client.recent_examines -= key
+ var/ref_to_atom = A.UID()
+ if(LAZYACCESS(client.recent_examines, ref_to_atom))
+ result = A.examine_more(src)
+ if(!length(result))
+ result += "You examine [A] closer, but find nothing of interest..."
+ else
+ result = A.examine(src)
+ client.recent_examines[ref_to_atom] = world.time + EXAMINE_MORE_WINDOW // set to when we should not examine something
+
to_chat(src, chat_box_examine(result.Join("\n")))
/mob/proc/ret_grab(obj/effect/list_container/mobl/L as obj, flag)
diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm
index 29885c2809a..bf016502b8c 100644
--- a/code/modules/mod/mod_control.dm
+++ b/code/modules/mod/mod_control.dm
@@ -203,7 +203,10 @@
. += "You could remove [core] with a wrench."
else
. += "You could use a MOD core on it to install one."
- . += "[extended_desc]" //god is dead
+
+/obj/item/mod/control/examine_more(mob/user)
+ . = ..()
+ . += "[extended_desc]"
/obj/item/mod/control/process()
if(seconds_electrified > 0)
diff --git a/code/modules/mod/mod_theme.dm b/code/modules/mod/mod_theme.dm
index 3d50e73e127..d4057244a45 100644
--- a/code/modules/mod/mod_theme.dm
+++ b/code/modules/mod/mod_theme.dm
@@ -289,7 +289,7 @@
offering full view of the land and its soon-to-be-dead inhabitants. The armor plating has been trimmed down to \
the bare essentials, geared far more for environmental hazards than combat against fauna; however, \
this gives way to incredible protection against corrosives and thermal protection good enough for \
- both casual backstroking through molten magma and romantic walks through arctic terrain. \
+ traversing the hostile climate of scorching hot barren planets, molten, and volcanic worlds like Epsilon Eridanii II. \
Instead, the suit is capable of using its' anomalous properties to attract and \
carefully distribute layers of ash or ice across the surface; these layers are ablative, but incredibly strong. \
However, all of this has proven to be straining on all Nanotrasen-approved cells, \