Merge pull request #15534 from SandPoot/screentips

Screentips
This commit is contained in:
silicons
2022-03-10 16:50:28 -07:00
committed by GitHub
11 changed files with 87 additions and 15 deletions
+2
View File
@@ -37,6 +37,8 @@ GLOBAL_LIST_INIT(bitflags, list(
#define OVERLAY_QUEUED_1 (1<<8)
///Item has priority to check when entering or leaving.
#define ON_BORDER_1 (1<<9)
///Whether or not this atom shows screentips when hovered over
#define NO_SCREENTIPS_1 (1<<10)
///Prevent clicking things below it on the same turf eg. doors/ fulltile windows.
#define PREVENT_CLICK_UNDER_1 (1<<11)
#define HOLOGRAM_1 (1<<12)
+1
View File
@@ -160,6 +160,7 @@ GLOBAL_LIST_INIT(bitfields, list(
"HOLOGRAM_1" = HOLOGRAM_1,
"SHOCKED_1" = SHOCKED_1,
"INITIALIZED_1" = INITIALIZED_1,
"NO_SCREENTIPS_1" = NO_SCREENTIPS_1,
"ADMIN_SPAWNED_1" = ADMIN_SPAWNED_1,
"BLOCK_FACE_ATOM_1" = BLOCK_FACE_ATOM_1,
"PREVENT_CONTENTS_EXPLOSION_1" = PREVENT_CONTENTS_EXPLOSION_1
+20
View File
@@ -53,6 +53,22 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
var/list/hand_slots // /atom/movable/screen/inventory/hand objects, assoc list of "[held_index]" = object
var/list/atom/movable/screen/plane_master/plane_masters = list() // see "appearance_flags" in the ref, assoc list of "[plane]" = object
///UI for screentips that appear when you mouse over things
var/atom/movable/screen/screentip/screentip_text
/// Whether or not screentips are enabled.
/// This is updated by the preference for cheaper reads than would be
/// had with a proc call, especially on one of the hottest procs in the
/// game (MouseEntered).
var/screentips_enabled = TRUE
/// The color to use for the screentips.
/// This is updated by the preference for cheaper reads than would be
/// had with a proc call, especially on one of the hottest procs in the
/// game (MouseEntered).
var/screentip_color
var/atom/movable/screen/movable/action_button/hide_toggle/hide_actions_toggle
var/action_buttons_hidden = FALSE
@@ -83,6 +99,8 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
plane_masters["[instance.plane]"] = instance
instance.backdrop(mymob)
screentip_text = new(null, src)
static_inventory += screentip_text
/datum/hud/Destroy()
if(mymob.hud_used == src)
@@ -117,6 +135,8 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
QDEL_LIST(screenoverlays)
mymob = null
QDEL_NULL(screentip_text)
return ..()
+19
View File
@@ -0,0 +1,19 @@
/atom/movable/screen/screentip
icon = null
icon_state = null
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
screen_loc = "TOP,LEFT"
maptext_height = 480
maptext_width = 480
maptext = ""
/atom/movable/screen/screentip/Initialize(mapload, _hud)
. = ..()
hud = _hud
update_view()
/atom/movable/screen/screentip/proc/update_view(datum/source)
SIGNAL_HANDLER
if(!hud || !hud.mymob.client.view_size) //Might not have been initialized by now
return
maptext_width = getviewsize(hud.mymob.client.view_size.getView())[1] * world.icon_size
+8 -7
View File
@@ -1406,11 +1406,12 @@
//Update the screentip to reflect what we're hoverin over
/atom/MouseEntered(location, control, params)
. = ..()
// Statusbar
// status_bar_set_text(usr, name)
// Screentips
// if(usr?.hud_used)
// if(!usr.client?.prefs.screentip_pref || (flags_1 & NO_SCREENTIPS_1))
// usr.hud_used.screentip_text.maptext = ""
// else
// usr.hud_used.screentip_text.maptext = MAPTEXT("<span style='text-align: center'><span style='font-size: 32px'><span style='color:[usr.client.prefs.screentip_color]: 32px'>[name]</span>")
var/client/client = usr?.client
var/datum/hud/active_hud = client?.mob?.hud_used
if(active_hud)
if(!client.prefs.screentip_pref || (flags_1 & NO_SCREENTIPS_1))
active_hud.screentip_text.maptext = ""
else
//We inline a MAPTEXT() here, because there's no good way to statically add to a string like this
active_hud.screentip_text.maptext = MAPTEXT("<span style='text-align: center; font-size: 32px; color: [client?.prefs?.screentip_color]'>[name]</span>")
+1
View File
@@ -11,6 +11,7 @@
barefootstep = FOOTSTEP_HARD_BAREFOOT
clawfootstep = FOOTSTEP_HARD_CLAW
heavyfootstep = FOOTSTEP_GENERIC_HEAVY
flags_1 = NO_SCREENTIPS_1
/// Minimum explosion power to break tile
var/explosion_power_break_tile = EXPLOSION_POWER_FLOOR_TILE_BREAK
+1
View File
@@ -1012,6 +1012,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
var/list/actualview = getviewsize(view)
update_clickcatcher()
parallax_holder.Reset()
mob.hud_used.screentip_text.update_view()
mob.reload_fullscreen()
if (isliving(mob))
var/mob/living/M = mob
+10
View File
@@ -62,6 +62,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/UI_style = null
var/outline_enabled = TRUE
var/outline_color = COLOR_THEME_MIDNIGHT
var/screentip_pref = TRUE
var/screentip_color = "#ffd391"
var/buttons_locked = FALSE
var/hotkeys = FALSE
@@ -788,6 +790,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<b>UI Style:</b> <a href='?_src_=prefs;task=input;preference=ui'>[UI_style]</a><br>"
dat += "<b>Outline:</b> <a href='?_src_=prefs;preference=outline_enabled'>[outline_enabled ? "Enabled" : "Disabled"]</a><br>"
dat += "<b>Outline Color:</b> [outline_color ? "<span style='border:1px solid #161616; background-color: [outline_color];'>" : "Theme-based (null)"]&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=outline_color'>Change</a><BR>"
dat += "<b>Screentip:</b> <a href='?_src_=prefs;preference=screentip_pref'>[screentip_pref ? "Enabled" : "Disabled"]</a><br>"
dat += "<b>Screentip Color:</b> <span style='border:1px solid #161616; background-color: [screentip_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=screentip_color'>Change</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>"
@@ -2748,6 +2752,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/pickedOutlineColor = input(user, "Choose your outline color.", "General Preference", outline_color) as color|null
if(pickedOutlineColor != pickedOutlineColor)
outline_color = pickedOutlineColor // nullable
if("screentip_pref")
screentip_pref = !screentip_pref
if("screentip_color")
var/pickedScreentipColor = input(user, "Choose your screentip color.", "General Preference", screentip_color) as color|null
if(pickedScreentipColor)
screentip_color = pickedScreentipColor
if("tgui_lock")
tgui_lock = !tgui_lock
if("winflash")
@@ -385,6 +385,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["UI_style"] >> UI_style
S["outline_color"] >> outline_color
S["outline_enabled"] >> outline_enabled
S["screentip_pref"] >> screentip_pref
S["screentip_color"] >> screentip_color
S["hotkeys"] >> hotkeys
S["chat_on_map"] >> chat_on_map
S["max_chat_length"] >> max_chat_length
@@ -567,6 +569,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["UI_style"], UI_style)
WRITE_FILE(S["outline_enabled"], outline_enabled)
WRITE_FILE(S["outline_color"], outline_color)
WRITE_FILE(S["screentip_pref"], screentip_pref)
WRITE_FILE(S["screentip_color"], screentip_color)
WRITE_FILE(S["hotkeys"], hotkeys)
WRITE_FILE(S["chat_on_map"], chat_on_map)
WRITE_FILE(S["max_chat_length"], max_chat_length)
+20 -8
View File
@@ -2,21 +2,21 @@ macro "default"
menu "menu"
elem
elem
name = "&File"
command = ""
saved-params = "is-checked"
elem
elem
name = "&Quick screenshot\tF2"
command = ".screenshot auto"
category = "&File"
saved-params = "is-checked"
elem
elem
name = "&Save screenshot as...\tShift+F2"
command = ".screenshot"
category = "&File"
saved-params = "is-checked"
elem
elem
name = ""
command = ""
category = "&File"
@@ -26,21 +26,21 @@ menu "menu"
command = ".reconnect"
category = "&File"
saved-params = "is-checked"
elem
elem
name = "&Quit\tAlt-F4"
command = ".quit"
category = "&File"
saved-params = "is-checked"
elem
elem
name = "&Help"
command = ""
saved-params = "is-checked"
elem
elem
name = "&Admin Help\tF1"
command = "adminhelp"
category = "&Help"
saved-params = "is-checked"
elem
elem
name = "&Hotkeys"
command = "hotkeys-help"
category = "&Help"
@@ -56,6 +56,7 @@ window "mainwindow"
anchor2 = none
is-default = true
saved-params = "pos;size;is-minimized;is-maximized"
statusbar = false
icon = 'icons\\ss13_64.png'
macro = "default"
menu = "menu"
@@ -95,6 +96,7 @@ window "mapwindow"
anchor2 = none
saved-params = "pos;size;is-minimized;is-maximized"
is-pane = true
on-status = ".winset \"status_bar.text=[[*]]\" "
elem "map"
type = MAP
pos = 0,0
@@ -107,6 +109,16 @@ window "mapwindow"
is-default = true
saved-params = "zoom;letterbox;zoom-mode"
style = ".center { text-align: center; } .maptext { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; color: white; line-height: 1.1; } .command_headset { font-weight: bold;\tfont-size: 8px; } .small { font-size: 6px; } .big { font-size: 8px; } .reallybig { font-size: 8px; } .extremelybig { font-size: 8px; } .greentext { color: #00FF00; font-size: 7px; } .redtext { color: #FF0000; font-size: 7px; } .clown { color: #FF69Bf; font-size: 7px; font-weight: bold; } .his_grace { color: #15D512; } .hypnophrase { color: #0d0d0d; font-weight: bold; } .yell { font-weight: bold; } .italics { font-size: 6px; }"
elem "status_bar"
type = LABEL
pos = 0,1008
size = 280x16
anchor1 = 0,100
text = ""
align = left
background-color = #222222
text-color = #ffffff
border = line
window "infowindow"
elem "infowindow"
+1
View File
@@ -288,6 +288,7 @@
#include "code\_onclick\hud\revenanthud.dm"
#include "code\_onclick\hud\robot.dm"
#include "code\_onclick\hud\screen_objects.dm"
#include "code\_onclick\hud\screentip.dm"
#include "code\_onclick\hud\simple_animal.dm"
#include "code\_onclick\hud\swarmer.dm"
#include "code\_onclick\hud\screen_objects\clickdelay.dm"