Skip to content

Commit

Permalink
Add 2 admin buttons to Lobby (#958)
Browse files Browse the repository at this point in the history
## Что этот PR делает
Добавил две кнопочки для админов в лобби:
Дать дилей и стартануть игру

При этом убрал кнопку смены CSS

## Почему это хорошо для игры
Удобно

## Изображения изменений

https://github.com/user-attachments/assets/f0700700-42a0-4617-8386-ae6290aae3b1


## Тестирование
Ну типа

## Summary by Sourcery

Introduce two new admin buttons in the lobby for starting the game and
setting a delay, while removing the CSS change button. Improve the
layout and styling of lobby buttons for enhanced usability.

New Features:
- Add two new admin buttons in the lobby for starting the game and
setting a delay.

Enhancements:
- Remove the button for changing CSS in the lobby.
- Adjust the layout and styling of lobby buttons for better alignment
and spacing.
  • Loading branch information
AyIong authored Jan 10, 2025
1 parent 3cd474a commit 249961a
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 27 deletions.
3 changes: 2 additions & 1 deletion modular_bandastation/title_screen/code/asset_lobby.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"lobby_changelog.png" = 'modular_bandastation/title_screen/icons/lobby_changelog.png',
"lobby_picture.png" = 'modular_bandastation/title_screen/icons/lobby_picture.png',
"lobby_notice.png" = 'modular_bandastation/title_screen/icons/lobby_notice.png',
"lobby_css.png" = 'modular_bandastation/title_screen/icons/lobby_css.png',
"lobby_start_now.png" = 'modular_bandastation/title_screen/icons/lobby_start_now.png',
"lobby_delay.png" = 'modular_bandastation/title_screen/icons/lobby_delay.png',

"lobby_human_ai.png" = 'modular_bandastation/title_screen/icons/lobby_human_ai.png',
"lobby_bridge_assistant.png" = 'modular_bandastation/title_screen/icons/lobby_bridge_assistant.png',
Expand Down
29 changes: 26 additions & 3 deletions modular_bandastation/title_screen/code/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,37 @@
lobby_button_sound()
SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/change_title_screen_notice)

else if(href_list["css"])
if(!check_rights(R_DEBUG))
else if(href_list["start_now"])
if(!check_rights(R_SERVER))
log_admin("Title Screen: Possible href exploit attempt by [key_name(usr)]!")
message_admins("Title Screen: Possible href exploit attempt by [key_name(usr)]!")
return

lobby_button_sound()
SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/change_title_screen_css)
SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/start_now)

else if(href_list["delay"])
if(!check_rights(R_SERVER))
log_admin("Title Screen: Possible href exploit attempt by [key_name(usr)]!")
message_admins("Title Screen: Possible href exploit attempt by [key_name(usr)]!")
return

lobby_button_sound()
if(SSticker.current_state > GAME_STATE_PREGAME)
return tgui_alert(usr, "Too late... The game has already started!")

var/static/time = 1.5 MINUTES
if(time == 1.5 MINUTES)
time = 1984 DAYS
else
time = 1.5 MINUTES

SSticker.SetTimeLeft(time)
SSticker.start_immediately = FALSE
to_chat(world, span_infoplain(span_bold("Игра начнётся через [DisplayTimeText(time)].")), confidential = TRUE)
SEND_SOUND(world, sound('sound/announcer/default/attention.ogg'))
log_admin("[key_name(usr)] set the pre-game delay to [DisplayTimeText(time)].")
BLACKBOX_LOG_ADMIN_VERB("Delay Game Start")

else if(href_list["collapse"])
title_collapsed = !title_collapsed
Expand Down
11 changes: 6 additions & 5 deletions modular_bandastation/title_screen/code/title_screen_html.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAX_STATION_TRAIT_BUTTONS_VERTICAL 3
#define MAX_STATION_TRAIT_BUTTONS_VERTICAL 4

/**
* Get the HTML of title screen.
Expand Down Expand Up @@ -54,10 +54,10 @@
html += {"</div>"}

html += {"<div class="lobby_buttons-bottom">"}
html += create_icon_button(player, "changelog", "Открыть чейнджлог")
html += create_icon_button(player, "settings", "Настройки игры")
html += create_icon_button(player, "manifest", "Манифест персонала")
html += create_icon_button(player, "wiki", "Перейти на вики")
html += create_icon_button(player, "changelog", "Открыть чейнджлог")
html += {"</div>"}

if(length(GLOB.lobby_station_traits))
Expand All @@ -71,7 +71,7 @@
if(!trait.can_display_lobby_button(player.client))
continue

if(number > MAX_STATION_TRAIT_BUTTONS_VERTICAL) // 3 is a maximum
if(number > MAX_STATION_TRAIT_BUTTONS_VERTICAL)
break

number++
Expand All @@ -95,9 +95,10 @@
html += {"</div>"}

html += {"<div id="lobby_admin" class="lobby_buttons-right invisible">"}
html += create_icon_button(player, "picture", "Сменить изображение", "right")
html += create_icon_button(player, "start_now", "Запустить раунд", "right", SSticker && SSticker.current_state <= GAME_STATE_PREGAME)
html += create_icon_button(player, "delay", "Отложить начало раунда", "right", SSticker && SSticker.current_state <= GAME_STATE_PREGAME)
html += create_icon_button(player, "notice", "Оставить уведомление", "right")
html += create_icon_button(player, "css", "Заменить CSS лобби", "right")
html += create_icon_button(player, "picture", "Сменить изображение", "right")
html += {"</div>"}

html += {"
Expand Down
37 changes: 23 additions & 14 deletions modular_bandastation/title_screen/html/title_screen_default.css
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ input,
}

.lobby_buttons-left {
left: -3px;
left: -1.5px;
bottom: 12px;
}

.lobby_buttons-right {
right: -3px;
right: -1.5px;
bottom: 12px;
}

Expand All @@ -272,7 +272,6 @@ input,

.lobby_buttons-bottom {
display: flex;
flex-direction: row-reverse;
bottom: -17.5px;
right: 32.5px;
z-index: 4;
Expand All @@ -281,25 +280,38 @@ input,
.lobby_buttons-left,
.lobby_buttons-right {
display: flex;
}

.lobby_buttons-left {
flex-direction: column-reverse;
}

.lobby_buttons-left .lobby_button,
.lobby_buttons-right {
flex-direction: column;
}

.lobby_buttons-left .lobby_button {
margin-top: 1.5px;
}

.lobby_buttons-left .lobby_button:last-of-type {
margin-top: 0;
}

.lobby_buttons-right .lobby_button {
margin-top: 4px;
margin-bottom: 1.5px;
}

.lobby_buttons-left .lobby_button:last-of-type,
.lobby_buttons-right .lobby_button:last-of-type {
margin-top: 0;
margin-bottom: 0;
}

.lobby_buttons-bottom .lobby_button {
margin-left: 4px;
margin-right: 4px;
}

.lobby_buttons-bottom .lobby_button:last-of-type {
margin-left: 0;
margin-right: 0;
}

/**
Expand Down Expand Up @@ -332,12 +344,9 @@ input,
/**
* MARK: Main buttons
*/
.lobby-late_join .lobby-text,
.lobby-toggle_ready .lobby-text {
transform: translateY(5.25px) translateX(2px);
}

.lobby-late_join .lobby-text {
transform: translateY(6.25px) translateX(3px);
transform: translateY(6.75px) translateX(3px);
}

.lobby-toggle_ready.bad .lobby-text::before,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ a.lobby_element.good .lobby-text:before {
margin-right: 0.33em;
}

a.lobby_element.disabled {
pointer-events: none;
color: hsl(345, 100%, 70%);
}

a.lobby_element.disabled:after {
background-color: hsl(345, 100%, 70%);
transform: scaleY(1);
}

/**
* MARK: Traits
*/
Expand Down Expand Up @@ -319,16 +329,20 @@ a.lobby_element.good .lobby-text:before {
content: '\f02d';
}

.lobby-picture .lobby-tooltip .lobby-tooltip-content:before {
content: '\f03e';
.lobby-start_now .lobby-tooltip .lobby-tooltip-content:before {
content: '\f144';
}

.lobby-delay .lobby-tooltip .lobby-tooltip-content:before {
content: '\f28b';
}

.lobby-notice .lobby-tooltip .lobby-tooltip-content:before {
content: '\f06a';
}

.lobby-css .lobby-tooltip .lobby-tooltip-content:before {
content: '\f1c9';
.lobby-picture .lobby-tooltip .lobby-tooltip-content:before {
content: '\f03e';
}

/**
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified modular_bandastation/title_screen/icons/lobby_human_ai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified modular_bandastation/title_screen/icons/lobby_pun_pun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified modular_bandastation/title_screen/icons/lobby_toggle_ready.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 249961a

Please sign in to comment.