From 17c89394bd106cba5de9e544870768bbf1a204c1 Mon Sep 17 00:00:00 2001
From: larentoun <31931237+larentoun@users.noreply.github.com>
Date: Wed, 28 Jun 2023 01:45:47 +0300
Subject: [PATCH] feat (port): Screentips (#161)
---
SQL/paradise_schema.sql | 2 +
SQL/updates/30-31.sql | 4 +
_maps/map_files/generic/CentComm.dmm | 2 +-
_maps/map_files/generic/z2_old.dmm | 2 +-
code/__DEFINES/flags.dm | 2 +
code/__DEFINES/misc.dm | 12 +-
code/_onclick/hud/action_button.dm | 1 +
code/_onclick/hud/alert.dm | 1 +
code/_onclick/hud/blob_overmind.dm | 1 +
code/_onclick/hud/ghost.dm | 1 +
code/_onclick/hud/hud.dm | 6 +
code/_onclick/hud/screen_objects.dm | 3 +-
code/_onclick/hud/screentip.dm | 17 ++
code/controllers/subsystem/titlescreen.dm | 2 +-
code/game/atoms.dm | 16 ++
code/game/objects/items.dm | 1 +
code/game/turfs/simulated/floor.dm | 1 +
.../turfs/simulated/walls_indestructible.dm | 3 +-
code/game/turfs/space/space.dm | 2 +-
code/modules/client/client_procs.dm | 16 +-
code/modules/client/preference/preferences.dm | 16 ++
.../client/preference/preferences_mysql.dm | 14 +-
config/example/dbconfig.txt | 2 +-
interface/skin.dmf | 243 ++++++------------
paradise.dme | 1 +
25 files changed, 194 insertions(+), 177 deletions(-)
create mode 100644 SQL/updates/30-31.sql
create mode 100644 code/_onclick/hud/screentip.dm
diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql
index 67a5e7c4cde..91ba6281ad6 100644
--- a/SQL/paradise_schema.sql
+++ b/SQL/paradise_schema.sql
@@ -286,6 +286,8 @@ CREATE TABLE `player` (
`discord_name` varchar(32) NULL DEFAULT NULL,
`keybindings` longtext COLLATE 'utf8mb4_unicode_ci' DEFAULT NULL,
`viewrange` VARCHAR(5) NOT NULL DEFAULT '19x15' COLLATE 'utf8mb4_general_ci',
+ `screentip_mode` tinyint(1) DEFAULT '8',
+ `screentip_color` varchar(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#ffd391',
PRIMARY KEY (`id`),
UNIQUE KEY `ckey` (`ckey`),
KEY `lastseen` (`lastseen`),
diff --git a/SQL/updates/30-31.sql b/SQL/updates/30-31.sql
new file mode 100644
index 00000000000..76b07240d34
--- /dev/null
+++ b/SQL/updates/30-31.sql
@@ -0,0 +1,4 @@
+# Updates DB from 30 to 31 -S34N_W
+# Adds support for screentips
+ALTER TABLE `player` ADD COLUMN `screentip_mode` tinyint(1) DEFAULT '8';
+ALTER TABLE `player` ADD COLUMN `screentip_color` varchar(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#ffd391'
diff --git a/_maps/map_files/generic/CentComm.dmm b/_maps/map_files/generic/CentComm.dmm
index cfddb04afa9..b12a97733b0 100644
--- a/_maps/map_files/generic/CentComm.dmm
+++ b/_maps/map_files/generic/CentComm.dmm
@@ -9197,7 +9197,7 @@
},
/area/syndicate_mothership)
"eNQ" = (
-/turf/simulated/wall/indestructible/splashcreen,
+/turf/simulated/wall/indestructible/splashscreen,
/area/start)
"eNU" = (
/obj/structure/chair/sofa/left{
diff --git a/_maps/map_files/generic/z2_old.dmm b/_maps/map_files/generic/z2_old.dmm
index 9498a12e6dc..9544082f87d 100644
--- a/_maps/map_files/generic/z2_old.dmm
+++ b/_maps/map_files/generic/z2_old.dmm
@@ -11365,7 +11365,7 @@
/turf/simulated/wall/shuttle,
/area/shuttle/gamma/space)
"iBH" = (
-/turf/simulated/wall/indestructible/splashcreen,
+/turf/simulated/wall/indestructible/splashscreen,
/area/start)
"iBQ" = (
/obj/structure/table/wood,
diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm
index 2b3ad731250..ab81bfcf879 100644
--- a/code/__DEFINES/flags.dm
+++ b/code/__DEFINES/flags.dm
@@ -31,6 +31,8 @@
#define NO_PIXEL_RANDOM_DROP 131072 // If dropped, it wont have a randomized pixel_x/pixel_y
+///Whether or not this atom shows screentips when hovered over
+#define NO_SCREENTIPS 262144
/* Secondary atom flags, for the flags_2 var, denoted with a _2 */
diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm
index 1062d6f2d80..f6115322039 100644
--- a/code/__DEFINES/misc.dm
+++ b/code/__DEFINES/misc.dm
@@ -385,7 +385,7 @@
#define EXPLOSION_BLOCK_PROC -1
// The SQL version required by this version of the code
-#define SQL_VERSION 30
+#define SQL_VERSION 31
// Vending machine stuff
#define CAT_NORMAL 1
@@ -522,3 +522,13 @@
// This isnt in client_defines due to scoping issues
#define DEFAULT_CLIENT_VIEWSIZE "19x15"
+
+/proc/client_from_var(I)
+ if(ismob(I))
+ var/mob/A = I
+ return A.client
+ if(isclient(I))
+ return I
+ if(istype(I, /datum/mind))
+ var/datum/mind/B = I
+ return B.current.client
diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm
index 34335743ee5..4eeced6c7fa 100644
--- a/code/_onclick/hud/action_button.dm
+++ b/code/_onclick/hud/action_button.dm
@@ -124,6 +124,7 @@
overlays += img
/obj/screen/movable/action_button/MouseEntered(location, control, params)
+ . = ..()
if(!QDELETED(src))
openToolTip(usr, src, params, title = name, content = desc, theme = actiontooltipstyle)
diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm
index ca768aa9bd1..5216909bee0 100644
--- a/code/_onclick/hud/alert.dm
+++ b/code/_onclick/hud/alert.dm
@@ -102,6 +102,7 @@
var/override_alerts = FALSE //If it is overriding other alerts of the same type
/obj/screen/alert/MouseEntered(location,control,params)
+ . = ..()
openToolTip(usr, src, params, title = name, content = desc, theme = alerttooltipstyle)
diff --git a/code/_onclick/hud/blob_overmind.dm b/code/_onclick/hud/blob_overmind.dm
index 01940be1d8b..ebdd8dede8e 100644
--- a/code/_onclick/hud/blob_overmind.dm
+++ b/code/_onclick/hud/blob_overmind.dm
@@ -6,6 +6,7 @@
icon = 'icons/mob/blob.dmi'
/obj/screen/blob/MouseEntered(location,control,params)
+ . = ..()
openToolTip(usr,src,params,title = name,content = desc, theme = "blob")
/obj/screen/blob/MouseExited()
diff --git a/code/_onclick/hud/ghost.dm b/code/_onclick/hud/ghost.dm
index 67df5eb3013..98a7ac24780 100644
--- a/code/_onclick/hud/ghost.dm
+++ b/code/_onclick/hud/ghost.dm
@@ -6,6 +6,7 @@
icon = 'icons/mob/screen_ghost.dmi'
/obj/screen/ghost/MouseEntered()
+ . = ..()
flick(icon_state + "_anim", src)
/obj/screen/ghost/jumptomob
diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm
index 3c46db26768..5d29ede915d 100644
--- a/code/_onclick/hud/hud.dm
+++ b/code/_onclick/hud/hud.dm
@@ -42,6 +42,8 @@
var/action_buttons_hidden = FALSE
var/list/obj/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/obj/screen/screentip/screentip_text
/mob/proc/create_mob_hud()
if(client && !hud_used)
@@ -58,6 +60,9 @@
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)
mymob.hud_used = null
@@ -100,6 +105,7 @@
QDEL_LIST_ASSOC_VAL(plane_masters)
mymob = null
+ QDEL_NULL(screentip_text)
return ..()
/datum/hud/proc/show_hud(version = 0)
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index f2c3a7aa162..bd5ddb74ba1 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -253,6 +253,7 @@
return set_selected_zone(choice, usr)
/obj/screen/zone_sel/MouseEntered(location, control, params)
+ . = ..()
MouseMove(location, control, params)
/obj/screen/zone_sel/MouseMove(location, control, params)
@@ -401,7 +402,7 @@
var/image/object_overlay
/obj/screen/inventory/MouseEntered()
- ..()
+ . = ..()
add_overlays()
/obj/screen/inventory/MouseExited()
diff --git a/code/_onclick/hud/screentip.dm b/code/_onclick/hud/screentip.dm
new file mode 100644
index 00000000000..3d0195c6d1a
--- /dev/null
+++ b/code/_onclick/hud/screentip.dm
@@ -0,0 +1,17 @@
+/obj/screen/screentip
+ icon = null
+ mouse_opacity = MOUSE_OPACITY_TRANSPARENT
+ screen_loc = "TOP,LEFT"
+ maptext_height = 480
+ maptext_width = 480
+ maptext = ""
+
+/obj/screen/screentip/Initialize(mapload, _hud)
+ . = ..()
+ hud = _hud
+ update_view()
+
+/obj/screen/screentip/proc/update_view(datum/source)
+ if(!hud) //Might not have been initialized by now
+ return
+ maptext_width = getviewsize(hud.mymob.client.view)[1] * world.icon_size
diff --git a/code/controllers/subsystem/titlescreen.dm b/code/controllers/subsystem/titlescreen.dm
index 90b6de9df7d..6f98da89b9a 100644
--- a/code/controllers/subsystem/titlescreen.dm
+++ b/code/controllers/subsystem/titlescreen.dm
@@ -32,7 +32,7 @@ SUBSYSTEM_DEF(title)
var/icon/icon = new(fcopy_rsc(file_path))
- for(var/turf/simulated/wall/indestructible/splashcreen/splash in world)
+ for(var/turf/simulated/wall/indestructible/splashscreen/splash in world)
splash.icon = icon
return ..()
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index abaa5da4eba..a09fe1d0b04 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -1140,6 +1140,22 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
name = "[prefix][t]"
return t
+//Update the screentip to reflect what we're hovering over
+/atom/MouseEntered(location, control, params)
+ if(!usr || !usr.client)
+ return
+ var/datum/hud/active_hud = usr.hud_used
+ if(!active_hud)
+ return
+ var/screentip_mode = usr.client.prefs.screentip_mode
+ if(screentip_mode == 0 || (flags & NO_SCREENTIPS))
+ active_hud.screentip_text.maptext = ""
+ return
+ //We inline a MAPTEXT() here, because there's no good way to statically add to a string like this
+ var/screentip_color = usr.client.prefs.screentip_color
+ active_hud.screentip_text.maptext = "[name]"
+
+
/*
Setter for the `density` variable.
Arguments:
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 61d6292bdf5..1056a09aaa5 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -910,6 +910,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
/obj/item/MouseEntered(location, control, params)
+ . = ..()
if(in_inventory || in_storage)
var/timedelay = 8
var/mob/user = usr
diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm
index e2f4b96eea2..216f9d02806 100644
--- a/code/game/turfs/simulated/floor.dm
+++ b/code/game/turfs/simulated/floor.dm
@@ -29,6 +29,7 @@ GLOBAL_LIST_INIT(icons_to_ignore_at_floor_init, list("damaged1","damaged2","dama
var/icon_plating = "plating"
thermal_conductivity = 0.040
heat_capacity = 10000
+ flags = NO_SCREENTIPS
var/lava = 0
var/broken = 0
var/burnt = 0
diff --git a/code/game/turfs/simulated/walls_indestructible.dm b/code/game/turfs/simulated/walls_indestructible.dm
index fb024f742a8..5dcb059b4eb 100644
--- a/code/game/turfs/simulated/walls_indestructible.dm
+++ b/code/game/turfs/simulated/walls_indestructible.dm
@@ -264,11 +264,12 @@
canSmoothWith = list(/turf/simulated/wall/indestructible/abductor)
smooth = SMOOTH_TRUE
-/turf/simulated/wall/indestructible/splashcreen
+/turf/simulated/wall/indestructible/splashscreen
name = "Space Station 13"
icon = 'config/title_screens/images/blank.png'
icon_state = ""
layer = FLY_LAYER
+ flags = NO_SCREENTIPS
/turf/simulated/wall/indestructible/sandstone
name = "sandstone wall"
diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm
index a6107b594d6..da2cf6f3981 100644
--- a/code/game/turfs/space/space.dm
+++ b/code/game/turfs/space/space.dm
@@ -7,7 +7,6 @@
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
heat_capacity = HEAT_CAPACITY_VACUUM
- plane = PLANE_SPACE
layer = SPACE_LAYER
light_power = 0.25
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
@@ -17,6 +16,7 @@
var/destination_x
var/destination_y
plane = PLANE_SPACE
+ flags = NO_SCREENTIPS
footstep = null
barefootstep = null
clawfootstep = null
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 1c9f133673f..e61ee0bd4f5 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -979,9 +979,9 @@
winset(src, "rpane.forumb", "background-color=#40628a;text-color=#FFFFFF")
winset(src, "rpane.rulesb", "background-color=#40628a;text-color=#FFFFFF")
winset(src, "rpane.githubb", "background-color=#40628a;text-color=#FFFFFF")
- /* Mainwindow */
- winset(src, "mainwindow.saybutton", "background-color=#40628a;text-color=#FFFFFF")
- winset(src, "mainwindow.mebutton", "background-color=#40628a;text-color=#FFFFFF")
+ /* Outputwindow */
+ winset(src, "outputwindow.saybutton", "background-color=#40628a;text-color=#FFFFFF")
+ winset(src, "outputwindow.mebutton", "background-color=#40628a;text-color=#FFFFFF")
///// UI ELEMENTS /////
/* Mainwindow */
winset(src, "mainwindow", "background-color=#272727")
@@ -996,8 +996,8 @@
winset(src, "browserwindow", "background-color=#272727")
winset(src, "browserwindow.browser", "background-color=#272727")
/* Infowindow */
- winset(src, "infowindow", "background-color=#272727;text-color=#FFFFFF")
- winset(src, "infowindow.info", "background-color=#272727;text-color=#FFFFFF;highlight-color=#009900;tab-text-color=#FFFFFF;tab-background-color=#272727")
+ winset(src, "infowindow", "background-color=#202020;text-color=#a4bad6")
+ winset(src, "infowindow.info", "background-color=#171717;text-color=#a4bad6;highlight-color=#009900;tab-text-color=#a4bad6;tab-background-color=#202020")
// NOTIFY USER
to_chat(src, "Darkmode Enabled")
@@ -1011,9 +1011,9 @@
winset(src, "rpane.forumb", "background-color=none;text-color=#000000")
winset(src, "rpane.rulesb", "background-color=none;text-color=#000000")
winset(src, "rpane.githubb", "background-color=none;text-color=#000000")
- /* Mainwindow */
- winset(src, "mainwindow.saybutton", "background-color=none;text-color=#000000")
- winset(src, "mainwindow.mebutton", "background-color=none;text-color=#000000")
+ /* Outputwindow */
+ winset(src, "outputwindow.saybutton", "background-color=none;text-color=#000000")
+ winset(src, "outputwindow.mebutton", "background-color=none;text-color=#000000")
///// UI ELEMENTS /////
/* Mainwindow */
winset(src, "mainwindow", "background-color=none")
diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm
index f8aedca8ee0..80bb93311a9 100644
--- a/code/modules/client/preference/preferences.dm
+++ b/code/modules/client/preference/preferences.dm
@@ -239,6 +239,10 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
var/list/keybindings_overrides = null
/// View range preference for this client
var/viewrange = DEFAULT_CLIENT_VIEWSIZE
+ ///Screentip Mode, in pixels. 8 is small, 15 is mega big, 0 is off.
+ var/screentip_mode = 8
+ ///Color of screentips at top of screen
+ var/screentip_color = "#ffd391"
/datum/preferences/New(client/C)
parent = C
@@ -543,6 +547,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += "Randomized Character Slot: [toggles2 & PREFTOGGLE_2_RANDOMSLOT ? "Yes" : "No"]
"
dat += "Window Flashing: [(toggles2 & PREFTOGGLE_2_WINDOWFLASHING) ? "Yes" : "No"]
"
dat += "View Range: [viewrange]
"
+ dat += "Set screentip mode: [(screentip_mode == 0) ? "Disabled" : "[screentip_mode]px"]
"
+ dat += "Screentip color: Change
"
// RIGHT SIDE OF THE PAGE
dat += "