From a85b953ef40fa0ca7f2f75f63f4dd6fb77b27e8b Mon Sep 17 00:00:00 2001 From: Atermonera Date: Thu, 9 Apr 2020 22:20:45 -0700 Subject: [PATCH] Adds preference to output description_info with examine text (#6969) * Adds preference to output description_info with examine text * includes the defines file --- code/__defines/preferences.dm | 6 ++++++ code/game/atoms.dm | 6 ++++++ code/modules/client/client defines.dm | 2 ++ .../client/preferences_toggle_procs.dm | 20 +++++++++++++++++++ html/changelogs/atermonera_examine_pref.yml | 4 ++++ vorestation.dme | 1 + 6 files changed, 39 insertions(+) create mode 100644 code/__defines/preferences.dm create mode 100644 html/changelogs/atermonera_examine_pref.yml diff --git a/code/__defines/preferences.dm b/code/__defines/preferences.dm new file mode 100644 index 0000000000..0bb289d2e1 --- /dev/null +++ b/code/__defines/preferences.dm @@ -0,0 +1,6 @@ +#define EXAMINE_MODE_DEFAULT 0 +#define EXAMINE_MODE_INCLUDE_USAGE 1 +#define EXAMINE_MODE_SWITCH_TO_PANEL 2 + +// Should be one higher than the above +#define EXAMINE_MODE_MAX 3 \ No newline at end of file diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 1266f9a1b9..26d8506bf9 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -185,6 +185,12 @@ to_chat(user, "[bicon(src)] That's [f_name] [suffix]") to_chat(user,desc) + if(user.client?.examine_text_mode == EXAMINE_MODE_INCLUDE_USAGE) + to_chat(user, description_info) + + if(user.client?.examine_text_mode == EXAMINE_MODE_SWITCH_TO_PANEL) + user.client.statpanel = "Examine" // Switch to stat panel + return distance == -1 || (get_dist(src, user) <= distance) // called by mobs when e.g. having the atom as their machine, pulledby, loc (AKA mob being inside the atom) or buckled var set. diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index 169dcd5b07..527d9438fe 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -28,6 +28,8 @@ var/chatOutputLoadedAt var/adminhelped = 0 + var/examine_text_mode = 0 // Just examine text, include usage (description_info), switch to examine panel. + /////////////// //SOUND STUFF// diff --git a/code/modules/client/preferences_toggle_procs.dm b/code/modules/client/preferences_toggle_procs.dm index 9b8aa94b66..4e21568c13 100644 --- a/code/modules/client/preferences_toggle_procs.dm +++ b/code/modules/client/preferences_toggle_procs.dm @@ -308,6 +308,26 @@ feedback_add_details("admin_verb","THInstm") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + +// Not attached to a pref datum because those are strict binary toggles +/client/verb/toggle_examine_mode() + set name = "Toggle Examine Mode" + set category = "Preferences" + set desc = "Control the additional behaviour of examining things" + + examine_text_mode++ + examine_text_mode %= EXAMINE_MODE_MAX // This cycles through them because if you're already specifically being routed to the examine panel, you probably don't need to have the extra text printed to chat + switch(examine_text_mode) // ... And I only wanted to add one verb + if(EXAMINE_MODE_DEFAULT) + to_chat(src, "Examining things will only output the base examine text, and you will not be redirected to the examine panel automatically.") + + if(EXAMINE_MODE_INCLUDE_USAGE) + to_chat(src, "Examining things will also print any extra usage information normally included in the examine panel to the chat.") + + if(EXAMINE_MODE_SWITCH_TO_PANEL) + to_chat(src, "Examining things will direct you to the examine panel, where you can view extended information about the thing.") + + //Toggles for Staff //Developers diff --git a/html/changelogs/atermonera_examine_pref.yml b/html/changelogs/atermonera_examine_pref.yml new file mode 100644 index 0000000000..5551bec2bb --- /dev/null +++ b/html/changelogs/atermonera_examine_pref.yml @@ -0,0 +1,4 @@ +author: Atermonera +delete-after: True +changes: + - rscadd: "Added a preference to switch between a few extra modes of examining things. Verb in the preferences tab." diff --git a/vorestation.dme b/vorestation.dme index ba3fc9d6e5..aa692ba28d 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -64,6 +64,7 @@ #include "code\__defines\objects.dm" #include "code\__defines\overmap.dm" #include "code\__defines\planets.dm" +#include "code\__defines\preferences.dm" #include "code\__defines\process_scheduler.dm" #include "code\__defines\qdel.dm" #include "code\__defines\research.dm"