Merge pull request #15973 from SandPoot/screentips-update
Screentips context help now have advanced, fancy icons (with a way to disable it for only text)
This commit is contained in:
@@ -193,3 +193,6 @@
|
||||
#define SPLASHSCREEN_LAYER 90
|
||||
#define SPLASHSCREEN_PLANE 90
|
||||
#define SPLASHSCREEN_RENDER_TARGET "SPLASHSCREEN_PLANE"
|
||||
|
||||
///Layer for screentips
|
||||
#define SCREENTIP_LAYER 40
|
||||
|
||||
@@ -31,5 +31,15 @@
|
||||
/// Screentips are only enabled when they have context
|
||||
#define SCREENTIP_PREFERENCE_CONTEXT_ONLY "Only with tips"
|
||||
|
||||
/// Screentips enabled, no context
|
||||
#define SCREENTIP_PREFERENCE_NO_CONTEXT "Enabled without tips"
|
||||
|
||||
/// Regardless of intent
|
||||
#define INTENT_ANY "intent_any"
|
||||
#define INTENT_ANY "any"
|
||||
|
||||
GLOBAL_LIST_INIT(screentip_pref_options, list(
|
||||
SCREENTIP_PREFERENCE_DISABLED,
|
||||
SCREENTIP_PREFERENCE_ENABLED,
|
||||
SCREENTIP_PREFERENCE_CONTEXT_ONLY,
|
||||
SCREENTIP_PREFERENCE_NO_CONTEXT
|
||||
))
|
||||
|
||||
@@ -1,31 +1,30 @@
|
||||
#define HINT_ICON_FILE 'icons/UI_Icons/screentips/cursor_hints.dmi'
|
||||
|
||||
// Generate intent icons
|
||||
/// Help intent icon for screentip context
|
||||
GLOBAL_DATUM_INIT(icon_intent_help, /image, image('icons/emoji.dmi', icon_state = INTENT_HELP))
|
||||
/// Disarm intent icon for screentip context
|
||||
GLOBAL_DATUM_INIT(icon_intent_disarm, /image, image('icons/emoji.dmi', icon_state = INTENT_DISARM))
|
||||
/// Grab intent icon for screentip context
|
||||
GLOBAL_DATUM_INIT(icon_intent_grab, /image, image('icons/emoji.dmi', icon_state = INTENT_GRAB))
|
||||
/// Harm intent icon for screentip context
|
||||
GLOBAL_DATUM_INIT(icon_intent_harm, /image, image('icons/emoji.dmi', icon_state = INTENT_HARM))
|
||||
GLOBAL_LIST_INIT_TYPED(screentip_context_icons, /image, prepare_screentip_context_icons())
|
||||
|
||||
/proc/prepare_screentip_context_icons()
|
||||
. = list()
|
||||
for(var/state in icon_states(HINT_ICON_FILE))
|
||||
.[state] = image(HINT_ICON_FILE, icon_state = state)
|
||||
|
||||
/*
|
||||
* # Builds context with each intent for this key
|
||||
* Args:
|
||||
* - context = list (REQUIRED)
|
||||
* - key = string (REQUIRED)
|
||||
* - allow_image = boolean (not required)
|
||||
*/
|
||||
/proc/build_context(list/context, key)
|
||||
/proc/build_context(list/context, key, allow_image)
|
||||
var/list/to_add
|
||||
for(var/intent in context[key])
|
||||
switch(intent)
|
||||
if(INTENT_HELP)
|
||||
LAZYADD(to_add, "\icon[GLOB.icon_intent_help] [key]: [context[key][INTENT_HELP]]")
|
||||
if(INTENT_DISARM)
|
||||
LAZYADD(to_add, "\icon[GLOB.icon_intent_disarm] [key]: [context[key][INTENT_DISARM]]")
|
||||
if(INTENT_GRAB)
|
||||
LAZYADD(to_add, "\icon[GLOB.icon_intent_grab] [key]: [context[key][INTENT_GRAB]]")
|
||||
if(INTENT_HARM)
|
||||
LAZYADD(to_add, "\icon[GLOB.icon_intent_harm] [key]: [context[key][INTENT_HARM]]")
|
||||
else // If you're adding intent-less YOU BETTER ADD IT FIRST IN THE LIST
|
||||
LAZYADD(to_add, "[key]: [context[key][intent]]")
|
||||
return english_list(to_add, "", " ", " ")
|
||||
var/key_help = "[length(key) > 3 ? "[copytext(key, 1, -3)][allow_image ? " " : ""]" : ""]"
|
||||
var/icon = "[copytext(key, -3)]-[intent]"
|
||||
if(allow_image)
|
||||
icon = "\icon[GLOB.screentip_context_icons[icon]]"
|
||||
LAZYADD(to_add, "[key_help][icon]: [context[key][intent]]")
|
||||
|
||||
var/separator = "[allow_image ? " " : " | "]"
|
||||
return english_list(to_add, "", separator, separator)
|
||||
|
||||
#undef HINT_ICON_FILE
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
maptext_height = 480
|
||||
maptext_width = 480
|
||||
maptext = ""
|
||||
layer = SCREENTIP_LAYER
|
||||
|
||||
/atom/movable/screen/screentip/Initialize(mapload, _hud)
|
||||
. = ..()
|
||||
|
||||
+14
-13
@@ -1468,8 +1468,9 @@
|
||||
var/extra_lines = 0
|
||||
var/extra_context = ""
|
||||
|
||||
if (isliving(user) || isovermind(user) || isaicamera(user))
|
||||
if ((isliving(user) || isovermind(user) || isaicamera(user)) && (user.client.prefs.screentip_pref != SCREENTIP_PREFERENCE_NO_CONTEXT))
|
||||
var/obj/item/held_item = user.get_active_held_item()
|
||||
var/allow_images = user.client.prefs.screentip_allow_images
|
||||
|
||||
if (flags_1 & HAS_CONTEXTUAL_SCREENTIPS_1 || held_item?.item_flags & ITEM_HAS_CONTEXTUAL_SCREENTIPS)
|
||||
var/list/context = list()
|
||||
@@ -1482,15 +1483,15 @@
|
||||
// LMB and RMB on one line...
|
||||
var/lmb_text = ""
|
||||
if((SCREENTIP_CONTEXT_LMB in context) && (length(context[SCREENTIP_CONTEXT_LMB]) > 0))
|
||||
lmb_text = build_context(context, SCREENTIP_CONTEXT_LMB)
|
||||
lmb_text = build_context(context, SCREENTIP_CONTEXT_LMB, allow_images)
|
||||
var/rmb_text = ""
|
||||
if((SCREENTIP_CONTEXT_RMB in context) && (length(context[SCREENTIP_CONTEXT_RMB]) > 0))
|
||||
rmb_text = build_context(context, SCREENTIP_CONTEXT_RMB)
|
||||
rmb_text = build_context(context, SCREENTIP_CONTEXT_RMB, allow_images)
|
||||
|
||||
if (lmb_text)
|
||||
lmb_rmb_line = lmb_text
|
||||
if (rmb_text)
|
||||
lmb_rmb_line += " | [rmb_text]"
|
||||
lmb_rmb_line += " | [allow_images ? " " : ""][rmb_text]"
|
||||
else if (rmb_text)
|
||||
lmb_rmb_line = rmb_text
|
||||
|
||||
@@ -1499,37 +1500,37 @@
|
||||
lmb_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if((SCREENTIP_CONTEXT_CTRL_LMB in context) && (length(context[SCREENTIP_CONTEXT_CTRL_LMB]) > 0))
|
||||
ctrl_lmb_ctrl_rmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_LMB)
|
||||
ctrl_lmb_ctrl_rmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_LMB, allow_images)
|
||||
|
||||
if((SCREENTIP_CONTEXT_CTRL_RMB in context) && (length(context[SCREENTIP_CONTEXT_CTRL_RMB]) > 0))
|
||||
if (ctrl_lmb_ctrl_rmb_line != "")
|
||||
ctrl_lmb_ctrl_rmb_line += " | "
|
||||
ctrl_lmb_ctrl_rmb_line += " | [allow_images ? " " : ""]"
|
||||
ctrl_lmb_ctrl_rmb_line += "[SCREENTIP_CONTEXT_CTRL_RMB]: [context[SCREENTIP_CONTEXT_CTRL_RMB]]"
|
||||
ctrl_lmb_ctrl_rmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_RMB)
|
||||
ctrl_lmb_ctrl_rmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_RMB, allow_images)
|
||||
|
||||
// Alt-LMB, Alt-RMB on one line...
|
||||
if (ctrl_lmb_ctrl_rmb_line != "")
|
||||
ctrl_lmb_ctrl_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if((SCREENTIP_CONTEXT_ALT_LMB in context) && (length(context[SCREENTIP_CONTEXT_ALT_LMB]) > 0))
|
||||
alt_lmb_alt_rmb_line = build_context(context, SCREENTIP_CONTEXT_ALT_LMB)
|
||||
alt_lmb_alt_rmb_line = build_context(context, SCREENTIP_CONTEXT_ALT_LMB, allow_images)
|
||||
if((SCREENTIP_CONTEXT_ALT_RMB in context) && (length(context[SCREENTIP_CONTEXT_ALT_RMB]) > 0))
|
||||
if (alt_lmb_alt_rmb_line != "")
|
||||
alt_lmb_alt_rmb_line += " | "
|
||||
alt_lmb_alt_rmb_line = build_context(context, SCREENTIP_CONTEXT_ALT_RMB)
|
||||
alt_lmb_alt_rmb_line += " | [allow_images ? " " : ""]"
|
||||
alt_lmb_alt_rmb_line = build_context(context, SCREENTIP_CONTEXT_ALT_RMB, allow_images)
|
||||
|
||||
// Shift-LMB, Ctrl-Shift-LMB on one line...
|
||||
if (alt_lmb_alt_rmb_line != "")
|
||||
alt_lmb_alt_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if((SCREENTIP_CONTEXT_SHIFT_LMB in context) && (length(context[SCREENTIP_CONTEXT_SHIFT_LMB]) > 0))
|
||||
shift_lmb_ctrl_shift_lmb_line = build_context(context, SCREENTIP_CONTEXT_SHIFT_LMB)
|
||||
shift_lmb_ctrl_shift_lmb_line = build_context(context, SCREENTIP_CONTEXT_SHIFT_LMB, allow_images)
|
||||
|
||||
if((SCREENTIP_CONTEXT_CTRL_SHIFT_LMB in context) && (length(context[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB]) > 0))
|
||||
if (shift_lmb_ctrl_shift_lmb_line != "")
|
||||
shift_lmb_ctrl_shift_lmb_line += " | "
|
||||
shift_lmb_ctrl_shift_lmb_line += " | [allow_images ? " " : ""]"
|
||||
shift_lmb_ctrl_shift_lmb_line += "[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB]: [context[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB]]"
|
||||
shift_lmb_ctrl_shift_lmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_SHIFT_LMB)
|
||||
shift_lmb_ctrl_shift_lmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_SHIFT_LMB, allow_images)
|
||||
|
||||
if (shift_lmb_ctrl_shift_lmb_line != "")
|
||||
extra_lines++
|
||||
|
||||
@@ -64,6 +64,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/outline_color = COLOR_THEME_MIDNIGHT
|
||||
var/screentip_pref = SCREENTIP_PREFERENCE_ENABLED
|
||||
var/screentip_color = "#ffd391"
|
||||
var/screentip_allow_images = FALSE
|
||||
var/buttons_locked = FALSE
|
||||
var/hotkeys = FALSE
|
||||
|
||||
@@ -829,6 +830,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
dat += "<b>Outline Color:</b> [outline_color ? "<span style='border:1px solid #161616; background-color: [outline_color];'>" : "Theme-based (null)"] </span> <a href='?_src_=prefs;preference=outline_color'>Change</a><BR>"
|
||||
dat += "<b>Screentip:</b> <a href='?_src_=prefs;preference=screentip_pref'>[screentip_pref]</a><br>"
|
||||
dat += "<b>Screentip Color:</b> <span style='border:1px solid #161616; background-color: [screentip_color];'> </span> <a href='?_src_=prefs;preference=screentip_color'>Change</a><BR>"
|
||||
dat += "<font style='border-bottom:2px dotted white; cursor:help;'\
|
||||
title=\"This is an accessibility preference, if disabled, fallbacks to only text which colorblind people can understand better\">\
|
||||
<b>Screentip context with images:</b></font> <a href='?_src_=prefs;preference=screentip_allow_images'>[screentip_allow_images ? "Allowed" : "Disallowed"]</a><br>"
|
||||
dat += "<b>tgui Monitors:</b> <a href='?_src_=prefs;preference=tgui_lock'>[(tgui_lock) ? "Primary" : "All"]</a><br>"
|
||||
dat += "<b>tgui Style:</b> <a href='?_src_=prefs;preference=tgui_fancy'>[(tgui_fancy) ? "Fancy" : "No Frills"]</a><br>"
|
||||
dat += "<b>Show Runechat Chat Bubbles:</b> <a href='?_src_=prefs;preference=chat_on_map'>[chat_on_map ? "Enabled" : "Disabled"]</a><br>"
|
||||
@@ -2913,18 +2917,15 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
if(pickedOutlineColor != pickedOutlineColor)
|
||||
outline_color = pickedOutlineColor // nullable
|
||||
if("screentip_pref")
|
||||
var/choice = tgalert(user, "Choose your screentip preference", "Screentipping?", "Yes", "Context Only", "No")
|
||||
switch(choice)
|
||||
if("Yes")
|
||||
screentip_pref = SCREENTIP_PREFERENCE_ENABLED
|
||||
if("Context Only")
|
||||
screentip_pref = SCREENTIP_PREFERENCE_CONTEXT_ONLY
|
||||
else
|
||||
screentip_pref = SCREENTIP_PREFERENCE_DISABLED
|
||||
var/choice = input(user, "Choose your screentip preference", "Screentipping?", screentip_pref) as null|anything in GLOB.screentip_pref_options
|
||||
if(choice)
|
||||
screentip_pref = choice
|
||||
if("screentip_color")
|
||||
var/pickedScreentipColor = input(user, "Choose your screentip color.", "General Preference", screentip_color) as color|null
|
||||
if(pickedScreentipColor)
|
||||
screentip_color = pickedScreentipColor
|
||||
if("screentip_allow_images")
|
||||
screentip_allow_images = !screentip_allow_images
|
||||
if("tgui_lock")
|
||||
tgui_lock = !tgui_lock
|
||||
if("winflash")
|
||||
|
||||
@@ -423,6 +423,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
S["outline_enabled"] >> outline_enabled
|
||||
S["screentip_pref"] >> screentip_pref
|
||||
S["screentip_color"] >> screentip_color
|
||||
S["screentip_allow_images"] >> screentip_allow_images
|
||||
S["hotkeys"] >> hotkeys
|
||||
S["chat_on_map"] >> chat_on_map
|
||||
S["max_chat_length"] >> max_chat_length
|
||||
@@ -542,6 +543,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
modless_key_bindings = sanitize_islist(modless_key_bindings, list())
|
||||
favorite_outfits = SANITIZE_LIST(favorite_outfits)
|
||||
screentip_color = sanitize_hexcolor(screentip_color, 6, 1, initial(screentip_color))
|
||||
screentip_pref = sanitize_inlist(screentip_pref, GLOB.screentip_pref_options, SCREENTIP_PREFERENCE_ENABLED)
|
||||
|
||||
verify_keybindings_valid() // one of these days this will runtime and you'll be glad that i put it in a different proc so no one gets their saves wiped
|
||||
|
||||
@@ -612,6 +614,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
WRITE_FILE(S["outline_color"], outline_color)
|
||||
WRITE_FILE(S["screentip_pref"], screentip_pref)
|
||||
WRITE_FILE(S["screentip_color"], screentip_color)
|
||||
WRITE_FILE(S["screentip_allow_images"], screentip_allow_images)
|
||||
WRITE_FILE(S["hotkeys"], hotkeys)
|
||||
WRITE_FILE(S["chat_on_map"], chat_on_map)
|
||||
WRITE_FILE(S["max_chat_length"], max_chat_length)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 414 B |
Binary file not shown.
|
After Width: | Height: | Size: 490 B |
Reference in New Issue
Block a user