[MIRROR] CMSS Lobby Screen (#10774)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: tacoguy7765093 <karokaromaro@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-04-28 02:19:34 -07:00
committed by GitHub
parent 1a2848f1b2
commit 66a437de08
41 changed files with 1644 additions and 1312 deletions

View File

@@ -0,0 +1,162 @@
/mob/new_player/proc/initialize_lobby_screen()
if(!client)
return
var/datum/tgui/ui = SStgui.get_open_ui(src, src)
if(ui)
ui.close()
winset(src, "lobby_browser", "is-disabled=false;is-visible=true")
// winset(src, "mapwindow.status_bar", "is-visible=false")
lobby_window = new(client, "lobby_browser")
lobby_window.initialize(
assets = list(
get_asset_datum(/datum/asset/simple/tgui)
)
)
tgui_interact(src)
/mob/new_player/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, custom_state)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "LobbyMenu", window = lobby_window)
ui.closeable = FALSE
ui.open(preinitialized = TRUE)
/mob/new_player/tgui_state(mob/user)
return GLOB.tgui_always_state
/mob/new_player/ui_assets(mob/user)
. = ..()
. += get_asset_datum(/datum/asset/simple/lobby_files)
/mob/new_player/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
var/list/data = ..()
var/displayed_name = world.name
if(config && CONFIG_GET(string/servername))
displayed_name = CONFIG_GET(string/servername)
data["server_name"] = displayed_name
data["map"] = using_map.full_name
data["station_time"] = stationtime2text()
data["display_loading"] = SSticker.current_state == GAME_STATE_INIT
data["round_start"] = !SSticker.mode || SSticker.current_state <= GAME_STATE_PREGAME
data["round_time"] = roundduration2text()
data["ready"] = ready
data["new_news"] = client?.check_for_new_server_news()
data["can_submit_feedback"] = SSsqlite.can_submit_feedback(client)
data["show_station_news"] = GLOB.news_data.station_newspaper
data["new_station_news"] = client.prefs.lastlorenews != GLOB.news_data.newsindex
data["new_changelog"] = read_preference(/datum/preference/text/lastchangelog) == GLOB.changelog_hash
return data
/mob/new_player/tgui_static_data(mob/user)
var/list/data = ..()
data["bg"] = 'icons/misc/loading.dmi'
data["bg_state"] = "loading"
return data
/mob/new_player/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
if(.)
return
switch(action)
if("character_setup")
client.prefs.ShowChoices(src)
return TRUE
if("ready")
if(!SSticker || SSticker.current_state <= GAME_STATE_PREGAME)
ready = !ready
else
ready = 0
return TRUE
if("manifest")
ViewManifest()
return TRUE
if("late_join")
if(!ticker || ticker.current_state != GAME_STATE_PLAYING)
to_chat(usr, span_red("The round is either not ready, or has already finished..."))
return TRUE
var/time_till_respawn = time_till_respawn()
if(time_till_respawn == -1) // Special case, never allowed to respawn
to_chat(usr, span_warning("Respawning is not allowed!"))
else if(time_till_respawn) // Nonzero time to respawn
to_chat(usr, span_warning("You can't respawn yet! You need to wait another [round(time_till_respawn/10/60, 0.1)] minutes."))
return TRUE
LateChoices()
return TRUE
if("observe")
if(!SSticker || SSticker.current_state == GAME_STATE_INIT)
to_chat(src, span_warning("The game is still setting up, please try again later."))
return TRUE
if(tgui_alert(src,"Are you sure you wish to observe? If you do, make sure to not use any knowledge gained from observing if you decide to join later.","Observe Round?",list("Yes","No")) == "Yes")
if(!client)
return TRUE
//Make a new mannequin quickly, and allow the observer to take the appearance
var/mob/living/carbon/human/dummy/mannequin = get_mannequin(client.ckey)
client.prefs.dress_preview_mob(mannequin)
var/mob/observer/dead/observer = new(mannequin)
observer.moveToNullspace() //Let's not stay in our doomed mannequin
spawning = 1
if(client.media)
client.media.stop_music() // MAD JAMS cant last forever yo
observer.started_as_observer = 1
close_spawn_windows()
var/obj/O = locate("landmark*Observer-Start")
if(istype(O))
to_chat(src, span_notice("Now teleporting."))
observer.forceMove(O.loc)
else
to_chat(src, span_danger("Could not locate an observer spawn point. Use the Teleport verb to jump to the station map."))
announce_ghost_joinleave(src)
if(client.prefs.read_preference(/datum/preference/toggle/human/name_is_always_random))
client.prefs.real_name = random_name(client.prefs.identifying_gender)
observer.real_name = client.prefs.real_name
observer.name = observer.real_name
if(!client.holder && !CONFIG_GET(flag/antag_hud_allowed)) // For new ghosts we remove the verb from even showing up if it's not allowed.
remove_verb(observer, /mob/observer/dead/verb/toggle_antagHUD) // Poor guys, don't know what they are missing!
observer.key = key
observer.set_respawn_timer(time_till_respawn()) // Will keep their existing time if any, or return 0 and pass 0 into set_respawn_timer which will use the defaults
observer.client.init_verbs()
qdel(src)
return TRUE
if("shownews")
handle_server_news()
return TRUE
if("give_feedback")
if(!SSsqlite.can_submit_feedback(GLOB.directory[persistent_ckey]))
return
if(client.feedback_form)
client.feedback_form.display() // In case they closed the form early.
else
client.feedback_form = new(client)
return TRUE
if("open_station_news")
show_latest_news(GLOB.news_data.station_newspaper)
return TRUE
if("open_changelog")
write_preference_directly(/datum/preference/text/lastchangelog, GLOB.changelog_hash)
client.changes()
return TRUE
if("keyboard")
if(!SSsounds.subsystem_initialized)
return
playsound_local(ui.user, get_sfx("keyboard"), vol = 20)
return TRUE

View File

@@ -1,31 +1,3 @@
///var/atom/movable/lobby_image = new /atom/movable{icon = 'icons/misc/title.dmi'; icon_state = lobby_image_state; screen_loc = "1,1"; name = "Polaris"}
var/obj/effect/lobby_image = new /obj/effect/lobby_image
/obj/effect/lobby_image
name = "CHOMPStation" // CHOMPEdit
desc = "How are you reading this?"
screen_loc = "1,1"
icon = 'icons/misc/loading.dmi'
icon_state = "loading(old)" // CHOMPEdit
/obj/effect/lobby_image/Initialize(mapload)
icon = using_map.lobby_icon
var/known_icon_states = cached_icon_states(icon)
for(var/lobby_screen in using_map.lobby_screens)
if(!(lobby_screen in known_icon_states))
error("Lobby screen '[lobby_screen]' did not exist in the icon set [icon].")
using_map.lobby_screens -= lobby_screen
if(using_map.lobby_screens.len)
icon_state = pick(using_map.lobby_screens)
else
icon_state = known_icon_states[1]
. = ..()
/mob/new_player
var/client/my_client // Need to keep track of this ourselves, since by the time Logout() is called the client has already been nulled
/mob/new_player/Login()
update_Login_details() //handles setting lastKnownIP and computer_id for use by the ban systems as well as checking for multikeying
if(GLOB.join_motd)
@@ -41,23 +13,19 @@ var/obj/effect/lobby_image = new /obj/effect/lobby_image
mind.active = 1
mind.current = src
//CHOMPEdit Begin
if(length(GLOB.newplayer_start))
forceMove(pick(GLOB.newplayer_start))
else
forceMove(locate(1,1,1))
//CHOMPEdit End
if(client)
persistent_ckey = client.ckey
//loc = null CHOMPEdit Removal
//client.screen += lobby_image CHOMPEdit Removal
my_client = client
loc = null
sight |= SEE_TURFS
initialize_lobby_screen()
player_list |= src
created_for = ckey
if(!QDELETED(src))
new_player_panel()
addtimer(CALLBACK(src, PROC_REF(do_after_login)), 4 SECONDS, TIMER_DELETE_ME)
/mob/new_player/proc/do_after_login()

View File

@@ -1,10 +1,11 @@
/mob/new_player/Logout()
ready = 0
// see login.dm
if(my_client)
my_client.screen -= lobby_image
my_client = null
QDEL_NULL(lobby_window)
var/client/exiting_client = GLOB.directory[persistent_ckey]
if(exiting_client)
winset(exiting_client, "lobby_browser", "is-disabled=true;is-visible=false")
..()

View File

@@ -5,9 +5,8 @@
var/spawning = 0 //Referenced when you want to delete the new_player later on in the code.
var/totalPlayers = 0 //Player counts for the Lobby tab
var/totalPlayersReady = 0
var/show_hidden_jobs = 0 //Show jobs that are set to "Never" in preferences
var/has_respawned = FALSE //Determines if we're using RESPAWN_MESSAGE
var/datum/browser/panel
var/datum/tgui_window/lobby_window = null
var/datum/tgui_module/crew_manifest/new_player/manifest_dialog = null
var/datum/tgui_module/late_choices/late_choices_dialog = null
universal_speak = 1
@@ -27,103 +26,12 @@
add_verb(src, /mob/proc/insidePanel)
/mob/new_player/Destroy()
if(panel)
QDEL_NULL(panel)
if(manifest_dialog)
QDEL_NULL(manifest_dialog)
if(late_choices_dialog)
QDEL_NULL(late_choices_dialog)
. = ..()
/mob/new_player/verb/new_player_panel()
set src = usr
new_player_panel_proc()
/mob/new_player/proc/new_player_panel_proc()
var/output = "<div align='center'>"
output += span_bold("Map:") + " [using_map.full_name]<br>"
output += span_bold("Station Time:") + " [stationtime2text()]<br>"
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME)
output += span_bold("Server Initializing!")
else
output += span_bold("Round Duration:") + " [roundduration2text()]<br>"
output += "<hr>"
output += "<p><a href='byond://?src=\ref[src];show_preferences=1'>Character Setup</A></p>"
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME)
if(ready)
output += "<p>\[ " + span_linkOn(span_bold("Ready")) + " | <a href='byond://?src=\ref[src];ready=0'>Not Ready</a> \]</p>" //ChompEDIT - fixed height
else
output += "<p>\[ <a href='byond://?src=\ref[src];ready=1'>Ready</a> | " + span_linkOn(span_bold("Not Ready")) + " \]</p>"
output += "<p><s>Join Game!</s></p>"
else
output += "<p><a href='byond://?src=\ref[src];manifest=1'>View the Crew Manifest</A></p>"
output += "<p><a href='byond://?src=\ref[src];late_join=1'>Join Game!</A></p>"
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
output += "<hr>" //ChompADD - a line divider between functional and info buttons
//nobody uses this feature //WELL WE'RE GONNA
if(!IsGuestKey(src.key))
establish_db_connection()
if(SSdbcore.IsConnected())
var/isadmin = 0
if(src.client && src.client.holder)
isadmin = 1
var/datum/db_query/query = SSdbcore.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM erro_poll_textreply WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
newpoll = 1
break
qdel(query)
if(newpoll)
output += "<p><b><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A><br>(NEW!)</b></p>"
else
output += "<p><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A><br><i>No Changes</i></p>"
if(client?.check_for_new_server_news())
output += "<p><b><a href='byond://?src=\ref[src];shownews=1'>Show Server News</A><br>(NEW!)</b></p>"
else
output += "<p><a href='byond://?src=\ref[src];shownews=1'>Show Server News</A><br><i>No Changes</i></p>"
if(SSsqlite.can_submit_feedback(client))
output += "<p>[href(src, list("give_feedback" = 1), "Give Feedback")]</p>"
if(GLOB.news_data.station_newspaper)
if(client.prefs.lastlorenews == GLOB.news_data.newsindex)
output += "<p><a href='byond://?src=\ref[src];open_station_news=1'>Show [using_map.station_name] News<br><i>No Changes</i></A></p>"
else
output += "<p><b><a href='byond://?src=\ref[src];open_station_news=1'>Show [using_map.station_name] News<br>(NEW!)</A></b></p>"
if(read_preference(/datum/preference/text/lastchangelog) == GLOB.changelog_hash)
output += "<p><a href='byond://?src=\ref[src];open_changelog=1'>Show Changelog</A><br><i>No Changes</i></p>"
else
output += "<p><b><a href='byond://?src=\ref[src];open_changelog=1'>Show Changelog</A><br>(NEW!)</b></p>"
output += "</div>"
if (client.prefs?.lastlorenews == GLOB.news_data.newsindex)
client.seen_news = 1
if(GLOB.news_data.station_newspaper && !client.seen_news && client.prefs?.read_preference(/datum/preference/toggle/show_lore_news))
show_latest_news(GLOB.news_data.station_newspaper)
client.prefs.lastlorenews = GLOB.news_data.newsindex
SScharacter_setup.queue_preferences_save(client.prefs)
panel = new(src, "Welcome","Welcome", 210, 500, src)
panel.set_window_options("can_close=0")
panel.set_content(output)
panel.open()
return
/mob/new_player/get_status_tab_items()
. = ..()
. += ""
@@ -161,78 +69,6 @@
/mob/new_player/Topic(href, href_list[])
if(!client) return 0
if(href_list["show_preferences"])
client.prefs.ShowChoices(src)
return 1
if(href_list["ready"])
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME) // Make sure we don't ready up after the round has started
ready = text2num(href_list["ready"])
else
ready = 0
if(href_list["refresh"])
panel.close()
new_player_panel_proc()
if(href_list["observe"])
if(!SSticker || SSticker.current_state == GAME_STATE_INIT)
to_chat(src, span_warning("The game is still setting up, please try again later."))
return 0
if(tgui_alert(src,"Are you sure you wish to observe? If you do, make sure to not use any knowledge gained from observing if you decide to join later.","Observe Round?",list("Yes","No")) == "Yes")
if(!client) return 1
//Make a new mannequin quickly, and allow the observer to take the appearance
var/mob/living/carbon/human/dummy/mannequin = get_mannequin(client.ckey)
client.prefs.dress_preview_mob(mannequin)
var/mob/observer/dead/observer = new(mannequin)
observer.moveToNullspace() //Let's not stay in our doomed mannequin
spawning = 1
if(client.media)
client.media.stop_music() // MAD JAMS cant last forever yo
observer.started_as_observer = 1
close_spawn_windows()
var/obj/O = locate("landmark*Observer-Start")
if(istype(O))
to_chat(src, span_notice("Now teleporting."))
observer.forceMove(O.loc)
else
to_chat(src, span_danger("Could not locate an observer spawn point. Use the Teleport verb to jump to the station map."))
announce_ghost_joinleave(src)
if(client.prefs.read_preference(/datum/preference/toggle/human/name_is_always_random))
client.prefs.real_name = random_name(client.prefs.identifying_gender)
observer.real_name = client.prefs.real_name
observer.name = observer.real_name
if(!client.holder && !CONFIG_GET(flag/antag_hud_allowed)) // For new ghosts we remove the verb from even showing up if it's not allowed.
remove_verb(observer, /mob/observer/dead/verb/toggle_antagHUD) // Poor guys, don't know what they are missing!
observer.key = key
observer.set_respawn_timer(time_till_respawn()) // Will keep their existing time if any, or return 0 and pass 0 into set_respawn_timer which will use the defaults
observer.client.init_verbs()
qdel(src)
return TRUE
if(href_list["late_join"])
if(!ticker || ticker.current_state != GAME_STATE_PLAYING)
to_chat(usr, span_red("The round is either not ready, or has already finished..."))
return
var/time_till_respawn = time_till_respawn()
if(time_till_respawn == -1) // Special case, never allowed to respawn
to_chat(usr, span_warning("Respawning is not allowed!"))
else if(time_till_respawn) // Nonzero time to respawn
to_chat(usr, span_warning("You can't respawn yet! You need to wait another [round(time_till_respawn/10/60, 0.1)] minutes."))
return
LateChoices()
if(href_list["manifest"])
ViewManifest()
if(href_list["privacy_poll"])
establish_db_connection()
if(!SSdbcore.IsConnected())
@@ -275,13 +111,6 @@
if(!ready && href_list["preference"])
if(client)
client.prefs.process_link(src, href_list)
else if(!href_list["late_join"])
new_player_panel()
if(href_list["showpoll"])
handle_player_polling()
return
if(href_list["pollid"])
@@ -333,27 +162,6 @@
if(!isnull(href_list["option_[optionid]"])) //Test if this optionid was selected
vote_on_poll(pollid, optionid, 1)
if(href_list["shownews"])
handle_server_news()
return
if(href_list["hidden_jobs"])
show_hidden_jobs = !show_hidden_jobs
LateChoices()
if(href_list["give_feedback"])
if(!SSsqlite.can_submit_feedback(my_client))
return
if(client.feedback_form)
client.feedback_form.display() // In case they closed the form early.
else
client.feedback_form = new(client)
if(href_list["open_changelog"])
write_preference_directly(/datum/preference/text/lastchangelog, GLOB.changelog_hash)
client.changes()
return
/mob/new_player/proc/handle_server_news()
if(!client)
@@ -479,9 +287,6 @@
var/mob/living/character = create_character(T) //creates the human and transfers vars and mind
character = job_master.EquipRank(character, rank, 1) //equips the human
UpdateFactionList(character)
if(character && character.client)
var/obj/screen/splash/Spl = new(character.client, TRUE)
Spl.Fade(TRUE)
var/datum/job/J = SSjob.get_job(rank)
@@ -674,7 +479,6 @@
src << browse(null, "window=latechoices") //closes late choices window
src << browse(null, "window=preferences_window") //VOREStation Edit?
src << browse(null, "window=News") //closes news window
panel.close()
/mob/new_player/get_species()
var/datum/species/chosen_species