mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-07-14 00:22:34 +01:00
POLARIS: Tooltip framework, and mob tooltips
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
var/adminobs = null
|
||||
var/area = null
|
||||
var/time_died_as_mouse = null //when the client last died as a mouse
|
||||
var/datum/tooltip/tooltips = null
|
||||
|
||||
var/adminhelped = 0
|
||||
|
||||
|
||||
@@ -7,24 +7,28 @@
|
||||
S["UI_style_color"] >> pref.UI_style_color
|
||||
S["UI_style_alpha"] >> pref.UI_style_alpha
|
||||
S["ooccolor"] >> pref.ooccolor
|
||||
S["tooltipstyle"] >> pref.tooltipstyle
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/ui/save_preferences(var/savefile/S)
|
||||
S["UI_style"] << pref.UI_style
|
||||
S["UI_style_color"] << pref.UI_style_color
|
||||
S["UI_style_alpha"] << pref.UI_style_alpha
|
||||
S["ooccolor"] << pref.ooccolor
|
||||
S["tooltipstyle"] >> pref.tooltipstyle
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/ui/sanitize_preferences()
|
||||
pref.UI_style = sanitize_inlist(pref.UI_style, all_ui_styles, initial(pref.UI_style))
|
||||
pref.UI_style_color = sanitize_hexcolor(pref.UI_style_color, initial(pref.UI_style_color))
|
||||
pref.UI_style_alpha = sanitize_integer(pref.UI_style_alpha, 0, 255, initial(pref.UI_style_alpha))
|
||||
pref.ooccolor = sanitize_hexcolor(pref.ooccolor, initial(pref.ooccolor))
|
||||
pref.tooltipstyle = sanitize_inlist(pref.tooltipstyle, all_tooltip_styles, all_tooltip_styles[1])
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/ui/content(var/mob/user)
|
||||
. = "<b>UI Style:</b> <a href='?src=\ref[src];select_style=1'><b>[pref.UI_style]</b></a><br>"
|
||||
. += "<b>Custom UI</b> (recommended for White UI):<br>"
|
||||
. += "-Color: <a href='?src=\ref[src];select_color=1'><b>[pref.UI_style_color]</b></a> <table style='display:inline;' bgcolor='[pref.UI_style_color]'><tr><td>__</td></tr></table> <a href='?src=\ref[src];reset=ui'>reset</a><br>"
|
||||
. += "-Alpha(transparency): <a href='?src=\ref[src];select_alpha=1'><b>[pref.UI_style_alpha]</b></a> <a href='?src=\ref[src];reset=alpha'>reset</a><br>"
|
||||
. += "<b>Tooltip Style:</b> <a href='?src=\ref[src];select_tooltip_style=1'><b>[pref.tooltipstyle]</b></a><br>"
|
||||
if(can_select_ooc_color(user))
|
||||
. += "<b>OOC Color:</b> "
|
||||
if(pref.ooccolor == initial(pref.ooccolor))
|
||||
@@ -57,6 +61,12 @@
|
||||
pref.ooccolor = new_ooccolor
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["select_tooltip_style"])
|
||||
var/tooltip_style_new = input(user, "Choose tooltip style.", "Character Preference", pref.tooltipstyle) as null|anything in all_tooltip_styles
|
||||
if(!tooltip_style_new || !CanUseTopic(user)) return TOPIC_NOACTION
|
||||
pref.tooltipstyle = tooltip_style_new
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["reset"])
|
||||
switch(href_list["reset"])
|
||||
if("ui")
|
||||
|
||||
@@ -98,6 +98,12 @@ var/list/_client_preferences_by_type
|
||||
enabled_description = "Show"
|
||||
disabled_description = "Hide"
|
||||
|
||||
/datum/client_preference/mob_tooltips
|
||||
description ="Mob tooltips"
|
||||
key = "MOB_TOOLTIPS"
|
||||
enabled_description = "Show"
|
||||
disabled_description = "Hide"
|
||||
|
||||
/datum/client_preference/attack_icons
|
||||
description ="Attack icons"
|
||||
key = "ATTACK_ICONS"
|
||||
|
||||
@@ -21,6 +21,7 @@ datum/preferences
|
||||
var/UI_style = "Midnight"
|
||||
var/UI_style_color = "#ffffff"
|
||||
var/UI_style_alpha = 255
|
||||
var/tooltipstyle = "Midnight" //Style for popup tooltips
|
||||
|
||||
//character preferences
|
||||
var/real_name //our character's name
|
||||
|
||||
@@ -192,6 +192,19 @@
|
||||
|
||||
feedback_add_details("admin_verb","TFiringMode") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/toggle_mob_tooltips()
|
||||
set name = "Toggle Mob Tooltips"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles displaying name/species over mobs when moused over."
|
||||
|
||||
var/pref_path = /datum/client_preference/mob_tooltips
|
||||
toggle_preference(pref_path)
|
||||
prefs.save_preferences()
|
||||
|
||||
src << "You will now [(is_preference_enabled(/datum/client_preference/mob_tooltips)) ? "see" : "not see"] mob tooltips."
|
||||
|
||||
feedback_add_details("admin_verb","TMobTooltips") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
//Toggles for Staff
|
||||
//Developers
|
||||
|
||||
|
||||
@@ -20,6 +20,15 @@
|
||||
"Hologram" = 'icons/mob/screen1_robot_minimalist.dmi'
|
||||
)
|
||||
|
||||
var/global/list/all_tooltip_styles = list(
|
||||
"Midnight", //Default for everyone is the first one,
|
||||
"Plasmafire",
|
||||
"Retro",
|
||||
"Slimecore",
|
||||
"Operative",
|
||||
"Clockwork"
|
||||
)
|
||||
|
||||
/proc/ui_style2icon(ui_style)
|
||||
if(ui_style in all_ui_styles)
|
||||
return all_ui_styles[ui_style]
|
||||
|
||||
Reference in New Issue
Block a user