diff --git a/code/_onclick/hud/new_player.dm b/code/_onclick/hud/new_player.dm index 31d0ad332f1..8e526e2a1c3 100644 --- a/code/_onclick/hud/new_player.dm +++ b/code/_onclick/hud/new_player.dm @@ -637,6 +637,127 @@ if(SSticker.current_state == GAME_STATE_STARTUP) to_chat(usr, span_admin("The server is still setting up, but the round will be started as soon as possible.")) +#define OVERLAY_X_DIFF 12 +#define OVERLAY_Y_DIFF 5 + +///Lobby screen that appears before the game has started showing how many players there are and who is ready. +/atom/movable/screen/lobby/new_player_info + name = "New Player Info" + screen_loc = "TOP:-20,CENTER:192" + icon = 'icons/hud/lobby/newplayer.dmi' + icon_state = null //we only show up when we get update appearance called, cause we need our overlay to not look bad. + base_icon_state = "newplayer" + maptext_height = 70 + maptext_width = 80 + maptext_x = OVERLAY_X_DIFF + maptext_y = OVERLAY_Y_DIFF + + var/show_static = TRUE + +/atom/movable/screen/lobby/new_player_info/Initialize(mapload, datum/hud/hud_owner) + . = ..() + switch(SSticker.current_state) + if(GAME_STATE_PREGAME, GAME_STATE_STARTUP) + RegisterSignal(SSticker, COMSIG_TICKER_ENTER_SETTING_UP, PROC_REF(hide_info)) + if(GAME_STATE_SETTING_UP) + RegisterSignal(SSticker, COMSIG_TICKER_ERROR_SETTING_UP, PROC_REF(show_info)) + + START_PROCESSING(SSnewplayer_info, src) + update_text() + update_appearance(UPDATE_ICON) + +/atom/movable/screen/lobby/new_player_info/Destroy() + STOP_PROCESSING(SSnewplayer_info, src) + return ..() + +/atom/movable/screen/lobby/new_player_info/update_overlays() + . = ..() + if(!always_available) + return . + . += mutable_appearance(icon, "[base_icon_state]_overlay", layer = src.layer+0.03) + if(show_static) + . += mutable_appearance(icon, "static_base", alpha = 20, layer = src.layer+0.01) + //we have this in a separate file because `generate_icon_alpha_mask` puts lighting even on non-existent pixels, + //giving the icon a weird background color. + var/mutable_appearance/scanline = mutable_appearance(generate_icon_alpha_mask('icons/hud/lobby/newplayer_scanline.dmi', "scanline"), alpha = 20, layer = src.layer+0.02) + scanline.pixel_y = OVERLAY_X_DIFF + scanline.pixel_x = OVERLAY_Y_DIFF + . += scanline + +/atom/movable/screen/lobby/new_player_info/update_icon_state() + . = ..() + if(!always_available) + icon_state = "[base_icon_state]_disabled" + else + icon_state = base_icon_state + +/atom/movable/screen/lobby/new_player_info/process(seconds_per_tick) + update_text() + +/atom/movable/screen/lobby/new_player_info/collapse_button() + show_static = FALSE + update_text() + //to be in sync with parent, we'll turn the TV off in this time instead. + animate(src, appearance = update_appearance(UPDATE_ICON), time = SHUTTER_MOVEMENT_DURATION + SHUTTER_WAIT_DURATION) + //we go to the right, not up + animate(transform = transform.Translate(x = 146, y = 0), time = SHUTTER_MOVEMENT_DURATION, easing = CUBIC_EASING|EASE_IN) + +/atom/movable/screen/lobby/new_player_info/expand_button() + . = ..() + show_static = TRUE + update_appearance(UPDATE_ICON) + update_text() + +/atom/movable/screen/lobby/new_player_info/proc/hide_info() + SIGNAL_HANDLER + + STOP_PROCESSING(SSnewplayer_info, src) + UnregisterSignal(SSticker, COMSIG_TICKER_ENTER_SETTING_UP) + RegisterSignal(SSticker, COMSIG_TICKER_ERROR_SETTING_UP, PROC_REF(show_info)) + always_available = FALSE + update_appearance(UPDATE_ICON) + update_text() + +/atom/movable/screen/lobby/new_player_info/proc/show_info() + SIGNAL_HANDLER + + always_available = TRUE + update_appearance(UPDATE_ICON) + update_text() + START_PROCESSING(SSnewplayer_info, src) + UnregisterSignal(SSticker, COMSIG_TICKER_ERROR_SETTING_UP) + RegisterSignal(SSticker, COMSIG_TICKER_ENTER_SETTING_UP, PROC_REF(hide_info)) + +/atom/movable/screen/lobby/new_player_info/proc/update_text() + if(!always_available || !hud || !show_static) + maptext = null + return + var/new_maptext + if(!MC_RUNNING()) + new_maptext = "Loading..." + else + var/time_remaining = SSticker.GetTimeLeft() + if(time_remaining > 0) + time_remaining = "[round(time_remaining/10)]s" + else if(time_remaining == -10) + time_remaining = "DELAYED" + else + time_remaining = "SOON" + + if(hud.mymob.client.holder) + new_maptext = "Starting in [time_remaining]
\ + [LAZYLEN(GLOB.clients)] player\s
\ + [SSticker.totalPlayersReady] players ready
\ + [SSticker.total_admins_ready] / [length(GLOB.admins)] admins ready
" + else + new_maptext = "[time_remaining]
\ + [LAZYLEN(GLOB.clients)] player\s" + + maptext = MAPTEXT(new_maptext) + +#undef OVERLAY_X_DIFF +#undef OVERLAY_Y_DIFF + #undef SHUTTER_MOVEMENT_DURATION #undef SHUTTER_WAIT_DURATION #undef MAX_STATION_TRAIT_BUTTONS_VERTICAL diff --git a/code/controllers/subsystem/processing/newplayer.dm b/code/controllers/subsystem/processing/newplayer.dm new file mode 100644 index 00000000000..796f7405ef8 --- /dev/null +++ b/code/controllers/subsystem/processing/newplayer.dm @@ -0,0 +1,5 @@ +PROCESSING_SUBSYSTEM_DEF(newplayer_info) + name = "New Player Info" + flags = SS_NO_INIT | SS_BACKGROUND + wait = 1 SECONDS + runlevels = RUNLEVEL_LOBBY|RUNLEVEL_SETUP diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index aec19662d3a..eccf8807a76 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -29,23 +29,6 @@ INITIALIZE_IMMEDIATE(/mob/dead) /mob/dead/canUseStorage() return FALSE -/mob/dead/get_status_tab_items() - . = ..() - if(SSticker.HasRoundStarted()) - return - var/time_remaining = SSticker.GetTimeLeft() - if(time_remaining > 0) - . += "Time To Start: [round(time_remaining/10)]s" - else if(time_remaining == -10) - . += "Time To Start: DELAYED" - else - . += "Time To Start: SOON" - - . += "Players: [LAZYLEN(GLOB.clients)]" - if(client.holder) - . += "Players Ready: [SSticker.totalPlayersReady]" - . += "Admins Ready: [SSticker.total_admins_ready] / [length(GLOB.admins)]" - #define SERVER_HOPPER_TRAIT "server_hopper" /mob/dead/proc/server_hop() diff --git a/icons/hud/lobby/newplayer.dmi b/icons/hud/lobby/newplayer.dmi new file mode 100644 index 00000000000..b94a2937a1b Binary files /dev/null and b/icons/hud/lobby/newplayer.dmi differ diff --git a/icons/hud/lobby/newplayer_scanline.dmi b/icons/hud/lobby/newplayer_scanline.dmi new file mode 100644 index 00000000000..44e761bc363 Binary files /dev/null and b/icons/hud/lobby/newplayer_scanline.dmi differ diff --git a/tgstation.dme b/tgstation.dme index f05b4da158e..d87ddad517e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -788,6 +788,7 @@ #include "code\controllers\subsystem\processing\greyscale.dm" #include "code\controllers\subsystem\processing\instruments.dm" #include "code\controllers\subsystem\processing\manufacturing.dm" +#include "code\controllers\subsystem\processing\newplayer.dm" #include "code\controllers\subsystem\processing\obj.dm" #include "code\controllers\subsystem\processing\plumbing.dm" #include "code\controllers\subsystem\processing\priority_effects.dm"