From 4bf31e6ea2cdbb10502d1474bed284e69c3ce717 Mon Sep 17 00:00:00 2001
From: SuhEugene <32931701+SuhEugene@users.noreply.github.com>
Date: Sat, 6 Apr 2024 20:01:16 +0300
Subject: [PATCH] Fix and improve ESC menu (#893)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Fix and improve ESC menu
* Кнопки вниз, ибо текст большой
* Офигенный профессиональный вид менюшке
* Фуллскрин был ошибкой тоже
---
code/__DEFINES/layers_planes.dm | 2 ++
code/modules/escape_menu/details.dm | 2 +-
code/modules/escape_menu/dimmer.dm | 1 +
code/modules/escape_menu/escape_menu.dm | 18 ++++++++++++++----
code/modules/escape_menu/home_page.dm | 9 +++++----
code/modules/escape_menu/leave_body.dm | 19 +++++++++++++++----
code/modules/escape_menu/title.dm | 17 +++++++++++++----
7 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/code/__DEFINES/layers_planes.dm b/code/__DEFINES/layers_planes.dm
index 716886289976..2a897f8b3132 100644
--- a/code/__DEFINES/layers_planes.dm
+++ b/code/__DEFINES/layers_planes.dm
@@ -215,6 +215,8 @@
/// Plane related to the menu when pressing Escape.
/// Needed so that we can apply a blur effect to EVERYTHING, and guarantee we are above all UI.
#define ESCAPE_MENU_PLANE 105
+#define ESCAPE_MENU_DIMMER_LAYER 105.1
+#define ESCAPE_MENU_DEFAULT_LAYER 105.2
#define RENDER_PLANE_MASTER 110
diff --git a/code/modules/escape_menu/details.dm b/code/modules/escape_menu/details.dm
index e1887773e7a0..a96219c98941 100644
--- a/code/modules/escape_menu/details.dm
+++ b/code/modules/escape_menu/details.dm
@@ -9,7 +9,7 @@ GLOBAL_DATUM(escape_menu_details, /atom/movable/screen/escape_menu/details)
return GLOB.escape_menu_details
/atom/movable/screen/escape_menu/details
- screen_loc = "EAST:-180,NORTH:-25"
+ screen_loc = "EAST:-180,NORTH:-48"
maptext_height = 100
maptext_width = 200
diff --git a/code/modules/escape_menu/dimmer.dm b/code/modules/escape_menu/dimmer.dm
index 277262d00b61..249831d37c16 100644
--- a/code/modules/escape_menu/dimmer.dm
+++ b/code/modules/escape_menu/dimmer.dm
@@ -4,6 +4,7 @@
icon_state = "black"
alpha = 200
plane = ESCAPE_MENU_PLANE
+ layer = ESCAPE_MENU_DIMMER_LAYER
mouse_opacity = MOUSE_OPACITY_OPAQUE
clear_with_screen = FALSE
diff --git a/code/modules/escape_menu/escape_menu.dm b/code/modules/escape_menu/escape_menu.dm
index b1726b8600b5..78d4e3a03c76 100644
--- a/code/modules/escape_menu/escape_menu.dm
+++ b/code/modules/escape_menu/escape_menu.dm
@@ -115,8 +115,12 @@ GLOBAL_LIST_EMPTY(escape_menus)
if (isnull(plane_master_controllers))
return
- plane_master_controller = list(client?.mob.hud_used.plane_masters["[GAME_PLANE]"], client?.mob.hud_used.plane_masters["[FLOOR_PLANE]"],
- client?.mob.hud_used.plane_masters["[WALL_PLANE]"], client?.mob.hud_used.plane_masters["[ABOVE_WALL_PLANE]"])
+ plane_master_controller = list(
+ client?.mob.hud_used.plane_masters["[GAME_PLANE]"],
+ client?.mob.hud_used.plane_masters["[FLOOR_PLANE]"],
+ client?.mob.hud_used.plane_masters["[WALL_PLANE]"],
+ client?.mob.hud_used.plane_masters["[ABOVE_WALL_PLANE]"],
+ )
for(var/A in plane_master_controller)
var/atom/movable/screen/plane_master/P = A
P.add_filter("escape_menu_blur", 1, list("type" = "blur", "size" = 2))
@@ -128,14 +132,20 @@ GLOBAL_LIST_EMPTY(escape_menus)
if (isnull(plane_master_controllers))
return
- plane_master_controller = list(client?.mob.hud_used.plane_masters["[GAME_PLANE]"], client?.mob.hud_used.plane_masters["[FLOOR_PLANE]"],
- client?.mob.hud_used.plane_masters["[WALL_PLANE]"], client?.mob.hud_used.plane_masters["[ABOVE_WALL_PLANE]"])
+ plane_master_controller = list(
+ client?.mob.hud_used.plane_masters["[GAME_PLANE]"],
+ client?.mob.hud_used.plane_masters["[FLOOR_PLANE]"],
+ client?.mob.hud_used.plane_masters["[WALL_PLANE]"],
+ client?.mob.hud_used.plane_masters["[ABOVE_WALL_PLANE]"],
+ )
for(var/A in plane_master_controller)
var/atom/movable/screen/plane_master/P = A
P.remove_filter("escape_menu_blur")
/atom/movable/screen/escape_menu
+ name = "Anything"
plane = ESCAPE_MENU_PLANE
+ layer = ESCAPE_MENU_DEFAULT_LAYER
clear_with_screen = FALSE
// The escape menu can be opened before SSatoms
diff --git a/code/modules/escape_menu/home_page.dm b/code/modules/escape_menu/home_page.dm
index fe82fda3912b..a8653d23131c 100644
--- a/code/modules/escape_menu/home_page.dm
+++ b/code/modules/escape_menu/home_page.dm
@@ -23,7 +23,7 @@
new /atom/movable/screen/escape_menu/home_button/leave_body(
null,
src,
- "Покинуть",
+ "Покинуть тело",
/* offset = */ 3,
CALLBACK(src, PROC_REF(open_leave_body)),
)
@@ -63,7 +63,7 @@
vis_contents += home_button_text
- screen_loc = "NORTH:-[100 + (32 * offset)],WEST:110"
+ screen_loc = "NORTH:-[132 + (32 * offset)],WEST:110"
transform = transform.Scale(6, 1)
/atom/movable/screen/escape_menu/home_button/Destroy()
@@ -92,6 +92,7 @@
// Needs to be separated so it doesn't scale
/atom/movable/screen/escape_menu/home_button_text
+ name = "text"
maptext_width = 200
maptext_height = 50
pixel_x = -80
@@ -117,9 +118,9 @@
/atom/movable/screen/escape_menu/home_button_text/proc/update_text()
var/atom/movable/screen/escape_menu/home_button/escape_menu_loc = loc
- maptext = MAPTEXT_VCR_OSD_MONO("[button_text]")
+ maptext = "[button_text]"
- if (hovered)
+ if (hovered && (!istype(escape_menu_loc) || escape_menu_loc.enabled()))
maptext = "[maptext]"
/atom/movable/screen/escape_menu/home_button/leave_body
diff --git a/code/modules/escape_menu/leave_body.dm b/code/modules/escape_menu/leave_body.dm
index 4563908242d5..402aa5d49aab 100644
--- a/code/modules/escape_menu/leave_body.dm
+++ b/code/modules/escape_menu/leave_body.dm
@@ -12,7 +12,7 @@
src,
"Драма",
"Совершить драматический уход",
- /* pixel_offset = */ -105,
+ /* pixel_offset = */ -115,
CALLBACK(src, PROC_REF(leave_suicide)),
/* button_overlay = */ dead_clown,
))
@@ -32,8 +32,8 @@
new /atom/movable/screen/escape_menu/leave_body_button(
src,
"Назад",
- /* tooltip_text = */ null,
- /* pixel_offset = */ 105,
+ "Вернуться в главное меню",
+ /* pixel_offset = */ 115,
CALLBACK(src, PROC_REF(open_home_page)),
/* button_overlay = */ "back",
)
@@ -63,6 +63,7 @@
// Not guaranteed to be living. Everything defines verb/ghost separately. Fuck you.
var/mob/living/living_user = client?.mob
living_user?.ghostize(FALSE)
+ qdel(src)
/datum/escape_menu/proc/leave_suicide()
PRIVATE_PROC(TRUE)
@@ -70,6 +71,7 @@
// Not guaranteed to be human. Everything defines verb/suicide separately. Fuck you, still.
var/mob/living/carbon/human/human_user = client?.mob
human_user?.suicide()
+ qdel(src)
/atom/movable/screen/escape_menu/leave_body_button
icon = 'icons/hud/escape_menu_leave_body.dmi'
@@ -97,8 +99,9 @@
add_overlay(button_overlay)
- maptext = MAPTEXT_VCR_OSD_MONO("[button_text]")
+ maptext = "[button_text]"
screen_loc = "CENTER:[pixel_offset],CENTER-1"
+ update_color()
/atom/movable/screen/escape_menu/leave_body_button/Destroy()
QDEL_NULL(on_click_callback)
@@ -117,6 +120,7 @@
// The UX on this is pretty shit, but it's okay enough for now.
// Regularly goes way too far from your cursor. Not designed for large icons.
openToolTip(usr, src, params, content = tooltip_text)
+ update_color()
/atom/movable/screen/escape_menu/leave_body_button/MouseExited(location, control, params)
if (!hovered)
@@ -124,3 +128,10 @@
hovered = FALSE
closeToolTip(usr)
+ update_color()
+
+/atom/movable/screen/escape_menu/leave_body_button/proc/update_color()
+ if (hovered)
+ color = "#ffffff"
+ else
+ color = "#bbbbbb"
diff --git a/code/modules/escape_menu/title.dm b/code/modules/escape_menu/title.dm
index 1125136e8a13..2b62ef0ecdf3 100644
--- a/code/modules/escape_menu/title.dm
+++ b/code/modules/escape_menu/title.dm
@@ -28,14 +28,23 @@ GLOBAL_DATUM(escape_menu_title, /atom/movable/screen/escape_menu/title)
return ..()
/atom/movable/screen/escape_menu/title/proc/update_text()
- var/subtitle_text = MAPTEXT("Ещё одна смена на...")
+ var/subtitle_text = MAPTEXT("Ещё одна смена на станции...")
var/title_text = {"
-
- [station_name()]
+
+ [get_filtered_station_name()]
"}
- maptext = "" + subtitle_text + MAPTEXT_VCR_OSD_MONO(title_text) + ""
+ maptext = "" + subtitle_text + title_text + ""
+
+/atom/movable/screen/escape_menu/title/proc/get_filtered_station_name()
+ var/val = station_name()
+ var/index = findtext_char(val, "| ")
+
+ if (index)
+ val = copytext_char(val, index + 2)
+
+ return val
/atom/movable/screen/escape_menu/title/proc/on_station_name_changed()
SIGNAL_HANDLER