Skip to content

Commit

Permalink
Fix and improve ESC menu (BlueMoon-Labs#893)
Browse files Browse the repository at this point in the history
* Fix and improve ESC menu

* Кнопки вниз, ибо текст большой

* Офигенный профессиональный вид менюшке

* Фуллскрин был ошибкой тоже
  • Loading branch information
SuhEugene authored Apr 6, 2024
1 parent be040e8 commit 4bf31e6
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 17 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/layers_planes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/modules/escape_menu/details.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions code/modules/escape_menu/dimmer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 14 additions & 4 deletions code/modules/escape_menu/escape_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions code/modules/escape_menu/home_page.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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("<span style='font-size: 24px; color: [istype(escape_menu_loc) ? escape_menu_loc.text_color() : "white"]'>[button_text]</span>")
maptext = "<span style='font-size: 16px; color: [istype(escape_menu_loc) ? escape_menu_loc.text_color() : "white"]; font-family: \"Comic Sans MS\"'>[button_text]</span>"

if (hovered)
if (hovered && (!istype(escape_menu_loc) || escape_menu_loc.enabled()))
maptext = "<u>[maptext]</u>"

/atom/movable/screen/escape_menu/home_button/leave_body
Expand Down
19 changes: 15 additions & 4 deletions code/modules/escape_menu/leave_body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
src,
"Драма",
"Совершить драматический уход",
/* pixel_offset = */ -105,
/* pixel_offset = */ -115,
CALLBACK(src, PROC_REF(leave_suicide)),
/* button_overlay = */ dead_clown,
))
Expand All @@ -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",
)
Expand Down Expand Up @@ -63,13 +63,15 @@
// 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)

// 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'
Expand Down Expand Up @@ -97,8 +99,9 @@

add_overlay(button_overlay)

maptext = MAPTEXT_VCR_OSD_MONO("<b style='font-size: 16px; text-align: center'>[button_text]</b>")
maptext = "<b style='font-size: 12px; text-align: center; font-family: \"Comic Sans MS\"'>[button_text]</b>"
screen_loc = "CENTER:[pixel_offset],CENTER-1"
update_color()

/atom/movable/screen/escape_menu/leave_body_button/Destroy()
QDEL_NULL(on_click_callback)
Expand All @@ -117,10 +120,18 @@
// 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)
return

hovered = FALSE
closeToolTip(usr)
update_color()

/atom/movable/screen/escape_menu/leave_body_button/proc/update_color()
if (hovered)
color = "#ffffff"
else
color = "#bbbbbb"
17 changes: 13 additions & 4 deletions code/modules/escape_menu/title.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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("<span style='font-size: 8px'>Ещё одна смена на...</span>")
var/subtitle_text = MAPTEXT("<span style='font-size: 8px'>Ещё одна смена на станции...</span>")
var/title_text = {"
<span style='font-weight: bolder; font-size: 24px'>
[station_name()]
<span style='font-weight: bolder; font-size: 24px; font-family: "Comic Sans MS"; line-height: 0.95;'>
[get_filtered_station_name()]
</span>
"}

maptext = "<font align='top'>" + subtitle_text + MAPTEXT_VCR_OSD_MONO(title_text) + "</font>"
maptext = "<font align='top'>" + subtitle_text + title_text + "</font>"

/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
Expand Down

0 comments on commit 4bf31e6

Please sign in to comment.