mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 11:36:24 +01:00
Escape menu improvements (#91397)
## About The Pull Request Removes the blur of the escape menu so players can sorta see what's going on in their game while going through, so they can react in case something's happening while they're in menu. Changes the font of the escape menu so it's no longer the LISA font Makes the title only show up on the home menu, so being on the suicide panel wont show you "another day on space station 13". Moves the 'back' button on the suicide menu to the top left.   ## Why It's Good For The Game This hopes to make the escape menu a little more easy to go through, removing some obstruction of your game's screen so you can see what's happening around you, and give a little generic part of submenus in case we add more (which I do have at least one planned). ## Changelog 🆑 qol: The escape menu no longer blurs the game in the background. qol: The escape menu now has a more readable font, and the escape menu's back button is now smaller and in the corner. /🆑
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help
|
||||
VAR_PRIVATE
|
||||
current_blink = FALSE
|
||||
is_blinking = FALSE
|
||||
last_blink_time = 0
|
||||
|
||||
blink_interval = 0.4 SECONDS
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/Initialize(
|
||||
mapload,
|
||||
datum/hud/hud_owner,
|
||||
datum/escape_menu/escape_menu,
|
||||
button_text,
|
||||
offset,
|
||||
on_click_callback,
|
||||
)
|
||||
. = ..()
|
||||
|
||||
RegisterSignal(escape_menu.client, COMSIG_ADMIN_HELP_RECEIVED, PROC_REF(on_admin_help_received))
|
||||
RegisterSignals(escape_menu.client, list(COMSIG_CLIENT_VERB_ADDED, COMSIG_CLIENT_VERB_REMOVED), PROC_REF(on_client_verb_changed))
|
||||
|
||||
var/datum/admin_help/current_ticket = escape_menu.client?.current_ticket
|
||||
if (!isnull(current_ticket))
|
||||
connect_ticket(current_ticket)
|
||||
if (!current_ticket?.player_replied)
|
||||
begin_processing()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/Click(location, control, params)
|
||||
if (!enabled())
|
||||
return
|
||||
|
||||
QDEL_IN(escape_menu, 0)
|
||||
|
||||
var/client/client = escape_menu.client
|
||||
|
||||
if (has_open_adminhelp())
|
||||
client?.view_latest_ticket()
|
||||
else
|
||||
client?.adminhelp()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/proc/has_open_adminhelp()
|
||||
var/client/client = escape_menu.client
|
||||
|
||||
var/datum/admin_help/current_ticket = client?.current_ticket
|
||||
|
||||
// This is null with a closed ticket.
|
||||
// This is okay since the View Latest Ticket panel already tells you if your ticket is closed, intentionally.
|
||||
if (isnull(current_ticket))
|
||||
return FALSE
|
||||
|
||||
// If we sent a ticket, but nobody has responded, send another one instead.
|
||||
// Not worth opening a menu when there's nothing to read, you're only going to want to send.
|
||||
if (length(current_ticket.admins_involved - client?.ckey) == 0)
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/proc/on_admin_help_received()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
begin_processing()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/proc/on_client_verb_changed(client/source, list/verbs_changed)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if (/client/verb/adminhelp in verbs_changed)
|
||||
home_button_text.update_text()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/proc/begin_processing()
|
||||
if (is_blinking)
|
||||
return
|
||||
|
||||
is_blinking = TRUE
|
||||
current_blink = TRUE
|
||||
START_PROCESSING(SSescape_menu, src)
|
||||
home_button_text.update_text()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/proc/end_processing()
|
||||
if (!is_blinking)
|
||||
return
|
||||
|
||||
is_blinking = FALSE
|
||||
current_blink = FALSE
|
||||
STOP_PROCESSING(SSescape_menu, src)
|
||||
home_button_text.update_text()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/proc/connect_ticket(datum/admin_help/admin_help)
|
||||
ASSERT(istype(admin_help))
|
||||
|
||||
RegisterSignal(admin_help, COMSIG_ADMIN_HELP_REPLIED, PROC_REF(on_admin_help_replied))
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/proc/on_admin_help_replied()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
end_processing()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/enabled()
|
||||
if (!..())
|
||||
return FALSE
|
||||
|
||||
if (!has_open_adminhelp())
|
||||
return /client/verb/adminhelp in escape_menu.client?.verbs
|
||||
|
||||
return TRUE
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/process(seconds_per_tick)
|
||||
if (world.time - last_blink_time < blink_interval)
|
||||
return
|
||||
|
||||
current_blink = !current_blink
|
||||
last_blink_time = world.time
|
||||
home_button_text.update_text()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/text_color()
|
||||
if (!enabled())
|
||||
return ..()
|
||||
|
||||
return current_blink ? "red" : ..()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/MouseEntered(location, control, params)
|
||||
. = ..()
|
||||
|
||||
if (is_blinking)
|
||||
openToolTip(usr, src, params, content = "An admin is trying to talk to you!")
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/admin_help/MouseExited(location, control, params)
|
||||
. = ..()
|
||||
|
||||
closeToolTip(usr)
|
||||
@@ -0,0 +1,87 @@
|
||||
/atom/movable/screen/escape_menu/home_button
|
||||
mouse_opacity = MOUSE_OPACITY_OPAQUE
|
||||
|
||||
VAR_PRIVATE
|
||||
atom/movable/screen/escape_menu/home_button_text/home_button_text
|
||||
datum/escape_menu/escape_menu
|
||||
datum/callback/on_click_callback
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/Initialize(
|
||||
mapload,
|
||||
datum/hud/hud_owner,
|
||||
datum/escape_menu/escape_menu,
|
||||
button_text,
|
||||
offset,
|
||||
on_click_callback,
|
||||
)
|
||||
. = ..()
|
||||
|
||||
src.escape_menu = escape_menu
|
||||
src.on_click_callback = on_click_callback
|
||||
|
||||
home_button_text = new /atom/movable/screen/escape_menu/home_button_text(
|
||||
src,
|
||||
/* hud_owner = */ src,
|
||||
button_text,
|
||||
)
|
||||
|
||||
vis_contents += home_button_text
|
||||
|
||||
screen_loc = "NORTH:-[100 + (32 * offset)],WEST:110"
|
||||
transform = transform.Scale(6, 1)
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/Destroy()
|
||||
escape_menu = null
|
||||
on_click_callback = null
|
||||
|
||||
return ..()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/Click(location, control, params)
|
||||
if (!enabled())
|
||||
return
|
||||
|
||||
on_click_callback.InvokeAsync()
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/MouseEntered(location, control, params)
|
||||
home_button_text.set_hovered(TRUE)
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/MouseExited(location, control, params)
|
||||
home_button_text.set_hovered(FALSE)
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/proc/text_color()
|
||||
return enabled() ? "white" : "gray"
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/proc/enabled()
|
||||
return TRUE
|
||||
|
||||
// Needs to be separated so it doesn't scale
|
||||
/atom/movable/screen/escape_menu/home_button_text
|
||||
maptext_width = 300
|
||||
maptext_height = 50
|
||||
pixel_x = -80
|
||||
|
||||
VAR_PRIVATE
|
||||
button_text
|
||||
hovered = FALSE
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button_text/Initialize(mapload, datum/hud/hud_owner, button_text)
|
||||
. = ..()
|
||||
|
||||
src.button_text = button_text
|
||||
update_text()
|
||||
|
||||
/// Sets the hovered state of the button, and updates the text
|
||||
/atom/movable/screen/escape_menu/home_button_text/proc/set_hovered(hovered)
|
||||
if (src.hovered == hovered)
|
||||
return
|
||||
|
||||
src.hovered = hovered
|
||||
update_text()
|
||||
|
||||
/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_PIXELLARI("<span style='font-size: 24px; color: [istype(escape_menu_loc) ? escape_menu_loc.text_color() : "white"]'>[button_text]</span>")
|
||||
|
||||
if (hovered)
|
||||
maptext = "<u>[maptext]</u>"
|
||||
@@ -0,0 +1,24 @@
|
||||
/atom/movable/screen/escape_menu/home_button/leave_body
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/leave_body/Initialize(
|
||||
mapload,
|
||||
datum/hud/hud_owner,
|
||||
datum/escape_menu/escape_menu,
|
||||
button_text,
|
||||
offset,
|
||||
on_click_callback,
|
||||
)
|
||||
. = ..()
|
||||
|
||||
RegisterSignal(escape_menu.client, COMSIG_CLIENT_MOB_LOGIN, PROC_REF(on_client_mob_login))
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/leave_body/enabled()
|
||||
if (!..())
|
||||
return FALSE
|
||||
|
||||
return isliving(escape_menu.client?.mob)
|
||||
|
||||
/atom/movable/screen/escape_menu/home_button/leave_body/proc/on_client_mob_login()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
home_button_text.update_text()
|
||||
@@ -0,0 +1,141 @@
|
||||
/atom/movable/screen/escape_menu/lobby_button
|
||||
icon = 'icons/hud/escape_menu_leave_body.dmi'
|
||||
icon_state = "template"
|
||||
maptext_width = 96
|
||||
maptext_y = -32
|
||||
|
||||
VAR_PROTECTED
|
||||
font_size = 16
|
||||
datum/callback/on_click_callback
|
||||
hovered = FALSE
|
||||
tooltip_text
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/Initialize(
|
||||
mapload,
|
||||
datum/hud/hud_owner,
|
||||
button_text,
|
||||
tooltip_text,
|
||||
list/pixel_offset,
|
||||
on_click_callback,
|
||||
button_overlay,
|
||||
)
|
||||
. = ..()
|
||||
|
||||
src.on_click_callback = on_click_callback
|
||||
src.tooltip_text = tooltip_text
|
||||
|
||||
add_overlay(button_overlay)
|
||||
|
||||
add_maptext(button_text)
|
||||
|
||||
screen_loc = "CENTER:[pixel_offset[1]],CENTER:[pixel_offset[2]]"
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/Destroy()
|
||||
on_click_callback = null
|
||||
|
||||
return ..()
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/Click(location, control, params)
|
||||
on_click_callback?.InvokeAsync()
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/MouseEntered(location, control, params)
|
||||
if (hovered)
|
||||
return
|
||||
|
||||
hovered = TRUE
|
||||
|
||||
// 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)
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/MouseExited(location, control, params)
|
||||
if (!hovered)
|
||||
return
|
||||
|
||||
hovered = FALSE
|
||||
closeToolTip(usr)
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/proc/add_maptext(button_text)
|
||||
animate(src,
|
||||
maptext = MAPTEXT_PIXELLARI("<b style='font-size: [font_size]px; text-align: center'>[button_text]</b>"),
|
||||
flags = ANIMATION_CONTINUE,
|
||||
)
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/small
|
||||
icon = 'icons/hud/escape_menu_icons.dmi'
|
||||
font_size = 6
|
||||
maptext_width = 80
|
||||
maptext_x = -20
|
||||
maptext_y = -14
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/small/add_maptext(button_text)
|
||||
//overriding parent for a different font here.
|
||||
animate(src,
|
||||
maptext = MAPTEXT_GRAND9K("<b style='font-size: [font_size]px; text-align: center'>[button_text]</b>"),
|
||||
flags = ANIMATION_CONTINUE,
|
||||
)
|
||||
|
||||
///Amount of time between animations when we fade in and out.
|
||||
#define COLLAPSIBLE_BUTTON_DURATION (0.4 SECONDS)
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/small/collapsible
|
||||
maptext_width = 48
|
||||
maptext_x = -4
|
||||
maptext_y = -44 //we change this during animation to bring it up
|
||||
layer = parent_type::layer - 0.01
|
||||
|
||||
///Reference point we animate the x from during the animation we play on its creation.
|
||||
var/end_point
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/small/collapsible/Initialize(
|
||||
mapload,
|
||||
datum/hud/hud_owner,
|
||||
button_text,
|
||||
tooltip_text,
|
||||
list/pixel_offset,
|
||||
on_click_callback,
|
||||
button_overlay,
|
||||
end_point,
|
||||
)
|
||||
src.end_point = end_point
|
||||
return ..()
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/small/collapsible/add_maptext(button_text)
|
||||
//more than 6 characters, lets bump the maptext down a bit, because we're smaller buttons we would be overlaying over the icon itself otherwise.
|
||||
if(length(button_text) > 6)
|
||||
maptext_y -= 10
|
||||
//let's take the icons out
|
||||
animate(src,
|
||||
transform = transform.Translate(x = end_point, y = 0),
|
||||
time = COLLAPSIBLE_BUTTON_DURATION,
|
||||
easing = CUBIC_EASING|EASE_OUT,
|
||||
)
|
||||
. = ..()
|
||||
//now we'll pull out the maptext
|
||||
animate(src,
|
||||
maptext_y = (maptext_y + 30),
|
||||
time = (COLLAPSIBLE_BUTTON_DURATION / 2),
|
||||
easing = CUBIC_EASING|EASE_IN,
|
||||
flags = ANIMATION_CONTINUE,
|
||||
)
|
||||
|
||||
/atom/movable/screen/escape_menu/lobby_button/small/collapsible/proc/collapse(datum/screen_object_holder/page_holder)
|
||||
//timers are delayed until MC is done, so we'll directly qdel during setup so it doesn't freeze on players.
|
||||
if(MC_RUNNING())
|
||||
animate(src,
|
||||
maptext_y = (maptext_y -30),
|
||||
time = (COLLAPSIBLE_BUTTON_DURATION / 2),
|
||||
easing = CUBIC_EASING|EASE_IN,
|
||||
)
|
||||
animate(src,
|
||||
transform = matrix(),
|
||||
maptext = null,
|
||||
time = COLLAPSIBLE_BUTTON_DURATION,
|
||||
easing = CUBIC_EASING|EASE_OUT,
|
||||
flags = ANIMATION_CONTINUE,
|
||||
)
|
||||
addtimer(CALLBACK(page_holder, TYPE_PROC_REF(/datum/screen_object_holder, remove_screen_object), src), COLLAPSIBLE_BUTTON_DURATION)
|
||||
else
|
||||
page_holder.remove_screen_object(src)
|
||||
|
||||
#undef COLLAPSIBLE_BUTTON_DURATION
|
||||
Reference in New Issue
Block a user