Skip to content

Commit

Permalink
TGS Test Merge (#7766)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Dec 25, 2024
2 parents 7ca0ed7 + 61b278e commit a58a196
Show file tree
Hide file tree
Showing 37 changed files with 2,375 additions and 1,451 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/// Creates a message packet for sending via output() specifically for opening tgsay using an embedded winget
// This is {"type":"open","payload":{"channel":channel,"mapfocus":[[map.focus]]}}, but pre-encoded.
#define TGUI_CREATE_OPEN_MESSAGE(channel) ( \
"%7b%22type%22%3a%22open%22%2c%22payload%22%3a%7B%22channel%22%3a%22[channel]%22%2c%22mapfocus%22%3a\[\[map.focus\]\]%7d%7d" \
"%7b%22type%22%3a%22open%22%2c%22payload%22%3a%7b%22channel%22%3a%22[channel]%22%2c%22mapfocus%22%3a\[\[map.focus\]\]%2c%22lobbyfocus%22%3a\[\[lobby_browser.focus\]\]%7d%7d" \
)

/*
Expand Down
4 changes: 0 additions & 4 deletions code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ GLOBAL_LIST_INIT(nato_phonetic_alphabet, list("Alpha", "Bravo", "Charlie", "Delt
GLOBAL_VAR_INIT(distress_cancel, FALSE)
GLOBAL_VAR_INIT(destroy_cancel, FALSE)

// Which lobby art is on display
// This is updated by the lobby art turf when it initializes
GLOBAL_VAR_INIT(displayed_lobby_art, -1)

// Last global ID that was assigned to a mob (for round recording purposes)
GLOBAL_VAR_INIT(last_mob_gid, 0)

Expand Down
76 changes: 73 additions & 3 deletions code/controllers/subsystem/init/lobby_art.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,80 @@
SUBSYSTEM_DEF(lobby_art)
name = "Lobby Art"
init_order = SS_INIT_LOBBYART
flags = SS_NO_FIRE
init_stage = INITSTAGE_EARLY
wait = 1 SECONDS
runlevels = ALL

/// The clients who we've waited a [wait] duration to start working. If they haven't, we reboot them
var/to_reinitialize = list()

/// The file name of the selected lobby art, matches a .png in config/lobby_art/, from LOBBY_ART_IMAGES config
var/selected_file_name

/// The author of the selected lobby art, determined by the LOBBY_ART_AUTHORS config
var/author

/datum/controller/subsystem/lobby_art/Initialize()
var/list/lobby_arts = CONFIG_GET(str_list/lobby_art_images)
if(length(lobby_arts))
force_lobby_art(rand(1, length(lobby_arts)))
if(!length(lobby_arts))
return SS_INIT_SUCCESS

var/index = rand(1, length(lobby_arts))
selected_file_name = lobby_arts[index]

var/list/lobby_authors = CONFIG_GET(str_list/lobby_art_authors)
if(length(lobby_authors) && length(lobby_authors) > index)
author = lobby_authors[index]

for(var/client/client as anything in GLOB.clients)
var/mob/new_player/player = client.mob // if something is no longer a new player this early, i'm happy with a runtime

var/datum/tgui/ui = SStgui.get_open_ui(player, player)
if(!ui)
continue

ui.refresh_cooldown = FALSE
ui.send_full_update(force = TRUE)

player.lobby_window.send_asset(get_asset_datum(/datum/asset/simple/lobby_art))

return SS_INIT_SUCCESS

/datum/controller/subsystem/lobby_art/fire(resumed)
var/list/new_players = GLOB.new_player_list

for(var/mob/new_player/player as anything in to_reinitialize)
if(!player.client)
continue

var/datum/tgui/ui = SStgui.get_open_ui(player, player)
if(ui && player.lobby_window && player.lobby_window.status > TGUI_WINDOW_CLOSED)
continue

log_tgui(player, "Reinitialized [player.client.ckey]'s lobby window: [ui ? "ui" : "no ui"], status: [player.lobby_window?.status].", "lobby_art/Fire")
INVOKE_ASYNC(player, TYPE_PROC_REF(/mob/new_player, initialize_lobby_screen))

var/initialize_queue = list()
for(var/mob/new_player/player as anything in new_players)
if(!player.client)
continue

if(player in to_reinitialize)
continue

var/datum/tgui/ui = SStgui.get_open_ui(player, player)
if(ui && player.lobby_window && player.lobby_window.status > TGUI_WINDOW_CLOSED)
continue

initialize_queue += player

to_reinitialize = initialize_queue

/datum/controller/subsystem/lobby_art/Shutdown()
var/to_send = "<!DOCTYPE html><html lang='en'><head><meta http-equiv='X-UA-Compatible' content='IE=edge' /></head><body style='overflow: hidden;padding: 0 !important;margin: 0 !important'><div style='background-image: url([get_asset_datum(/datum/asset/simple/restart_animation).get_url_mappings()["loading"]]);background-position:center;background-size:cover;position:absolute;width:100%;height:100%'></body></html>"

for(var/client/client as anything in GLOB.clients)
winset(client, "lobby_browser", "is-disabled=false;is-visible=true")

client << browse(to_send, "window=lobby_browser")

2 changes: 1 addition & 1 deletion code/controllers/subsystem/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ SUBSYSTEM_DEF(tgui)
if(length(user?.tgui_open_uis) == 0)
return count
for(var/datum/tgui/ui in user.tgui_open_uis)
if(isnull(src_object) || ui.src_object == src_object)
if((isnull(src_object) || ui.src_object == src_object) && ui.closeable)
ui.close()
count++
return count
Expand Down
3 changes: 0 additions & 3 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ SUBSYSTEM_DEF(ticker)

CHECK_TICK

for(var/mob/new_player/np in GLOB.new_player_list)
INVOKE_ASYNC(np, TYPE_PROC_REF(/mob/new_player, new_player_panel_proc), TRUE)

setup_economy()

SSoldshuttle.shuttle_controller?.setup_shuttle_docks()
Expand Down
11 changes: 2 additions & 9 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -298,23 +298,14 @@ Additional game mode variables.
var/list/options = get_fax_responder_slots(responder_candidate)
if(!options || !options.len)
to_chat(responder_candidate, SPAN_WARNING("No Available Slot!"))
if(from_lobby)
var/mob/new_player/lobbied = responder_candidate
lobbied.new_player_panel()
return FALSE

var/choice = tgui_input_list(responder_candidate, "What Fax Responder do you want to join as?", "Which Responder?", options, 30 SECONDS)
if(!(choice in FAX_RESPONDER_JOB_LIST))
to_chat(responder_candidate, SPAN_WARNING("Error: No valid responder selected."))
if(from_lobby)
var/mob/new_player/lobbied = responder_candidate
lobbied.new_player_panel()
return FALSE

if(!transform_fax_responder(responder_candidate, choice))
if(from_lobby)
var/mob/new_player/lobbied = responder_candidate
lobbied.new_player_panel()
return FALSE

if(responder_candidate)
Expand Down Expand Up @@ -862,6 +853,8 @@ Additional game mode variables.
spawn_name = "[area_name] [++spawn_counter]"
spawn_list_map[spawn_name] = T

original.sight = BLIND

var/selected_spawn = tgui_input_list(original, "Where do you want you and your hive to spawn?", "Queen Spawn", spawn_list_map, QUEEN_SPAWN_TIMEOUT, theme="hive_status")
if(hive.living_xeno_queen)
to_chat(original, SPAN_XENOANNOUNCE("You have taken too long to pick a spawn location, a queen has already evolved before you."))
Expand Down
2 changes: 0 additions & 2 deletions code/game/gamemodes/extended/extended.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

/datum/game_mode/extended/post_setup()
initialize_post_marine_gear_list()
for(var/mob/new_player/np in GLOB.new_player_list)
np.new_player_panel_proc()
round_time_lobby = world.time
return ..()

Expand Down
2 changes: 0 additions & 2 deletions code/game/gamemodes/extended/extended_nospawn.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
votable = FALSE

/datum/game_mode/extended/nospawn/post_setup()
for(var/mob/new_player/np in GLOB.new_player_list)
np.new_player_panel_proc()
round_time_lobby = world.time
return ..()
2 changes: 0 additions & 2 deletions code/game/gamemodes/extended/infection.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
/datum/game_mode/infection/post_setup()
initialize_post_survivor_list()
initialize_post_marine_gear_list()
for(var/mob/new_player/np in GLOB.new_player_list)
np.new_player_panel_proc()

addtimer(CALLBACK(src, PROC_REF(ares_online)), 5 SECONDS)
addtimer(CALLBACK(src, PROC_REF(map_announcement)), 20 SECONDS)
Expand Down
2 changes: 0 additions & 2 deletions code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MODE_POSTSETUP)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(display_roundstart_logout_report)), ROUNDSTART_LOGOUT_REPORT_TIME)

for(var/mob/new_player/np in GLOB.new_player_list)
np.new_player_panel_proc()
round_time_lobby = world.time
log_game("Round started at [time2text(world.realtime)]")
log_game("Operation time at round start is [worldtime2text()]")
Expand Down
30 changes: 0 additions & 30 deletions code/game/turfs/walls/wall_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -293,36 +293,6 @@
icon_state = "fakewindows"
opacity = FALSE

INITIALIZE_IMMEDIATE(/turf/closed/wall/indestructible/splashscreen)

/turf/closed/wall/indestructible/splashscreen
name = "Lobby Art"
desc = "Assorted artworks."
icon = 'icons/lobby/title_loading.dmi'
icon_state = "title"
layer = FLY_LAYER
special_icon = TRUE

/turf/closed/wall/indestructible/splashscreen/Initialize()
. = ..()
tag = "LOBBYART"

/proc/force_lobby_art(art_id)
GLOB.displayed_lobby_art = art_id
var/turf/closed/wall/indestructible/splashscreen/lobby_art = locate("LOBBYART")
var/list/lobby_arts = CONFIG_GET(str_list/lobby_art_images)
var/list/lobby_authors = CONFIG_GET(str_list/lobby_art_authors)
lobby_art.icon = 'icons/lobby/title.dmi'
lobby_art.icon_state = lobby_arts[GLOB.displayed_lobby_art]
lobby_art.desc = "Artwork by [lobby_authors[GLOB.displayed_lobby_art]]"
lobby_art.pixel_x = -288
lobby_art.pixel_y = -288
for(var/client/player in GLOB.clients)
if(GLOB.displayed_lobby_art != -1)
var/author = lobby_authors[GLOB.displayed_lobby_art]
if(author != "Unknown")
to_chat_forced(player, SPAN_ROUNDBODY("<hr>This round's lobby art is brought to you by [author]<hr>"))

/turf/closed/wall/indestructible/other
icon_state = "r_wall"

Expand Down
4 changes: 4 additions & 0 deletions code/game/verbs/ooc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
if(!mob)
return

if(istype(mob, /mob/new_player))
var/mob/new_player/new_player = mob
new_player.initialize_lobby_screen()

for(var/I in mob.open_uis)
var/datum/nanoui/ui = I
if(!QDELETED(ui))
Expand Down
5 changes: 4 additions & 1 deletion code/modules/asset_cache/asset_list.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ GLOBAL_LIST_EMPTY(asset_datums)

//get an assetdatum or make a new one
/proc/get_asset_datum(type)
RETURN_TYPE(/datum/asset)

return GLOB.asset_datums[type] || new type()

/datum/asset
Expand Down Expand Up @@ -261,11 +263,12 @@ GLOBAL_LIST_EMPTY(asset_datums)
continue
asset = fcopy_rsc(asset) //dedupe
var/prefix2 = (length(directions) > 1) ? "[dir2text(direction)]." : ""
var/asset_name = sanitize_filename("[prefix].[prefix2][icon_state_name].png")
var/asset_name = sanitize_filename("[prefix ? "[prefix]." : ""][prefix2][icon_state_name].png")
if (generic_icon_names)
asset_name = "[generate_asset_name(asset)].png"

SSassets.transport.register_asset(asset_name, asset)
assets[asset_name] = asset

/datum/asset/simple/icon_states/multiple_icons
_abstract = /datum/asset/simple/icon_states/multiple_icons
Expand Down
30 changes: 30 additions & 0 deletions code/modules/asset_cache/assets/lobby.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/datum/asset/simple/icon_states/lobby
icon = 'icons/lobby/icon.dmi'
prefix = FALSE

/datum/asset/simple/lobby_art/register()
var/icon = SSlobby_art.selected_file_name

if(!icon)
return

var/asset = icon("config/lobby_art/[icon].png")
if (!asset)
return

asset = fcopy_rsc(asset) //dedupe
var/asset_name = "lobby_art.png"

SSassets.transport.register_asset(asset_name, asset)
assets[asset_name] = asset

/datum/asset/simple/lobby_files
keep_local_name = TRUE
assets = list(
"load.mp3" = 'sound/lobby/lobby_load.mp3',
)

/datum/asset/simple/restart_animation
assets = list(
"loading" = 'html/lobby/loading.gif'
)
6 changes: 0 additions & 6 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1926,9 +1926,6 @@ GLOBAL_LIST_INIT(bgstate_options, list(
save_preferences()
save_character()
save_cooldown = world.time + 50
var/mob/new_player/np = user
if(istype(np))
np.new_player_panel_proc()

if("reload")
if(reload_cooldown > world.time)
Expand All @@ -1952,9 +1949,6 @@ GLOBAL_LIST_INIT(bgstate_options, list(
if("changeslot")
load_character(text2num(href_list["num"]))
close_load_dialog(user)
var/mob/new_player/np = user
if(istype(np))
np.new_player_panel_proc()

update_all_pickers(user)

Expand Down
Loading

0 comments on commit a58a196

Please sign in to comment.