[MODULAR] properly fixes titlescreen glitching in dreamseeker launch (#16222)

properly fixes titlescreen gltiching in dreamseeker launch
This commit is contained in:
Tastyfish
2022-09-14 15:13:27 -07:00
committed by GitHub
parent 50968086a0
commit 4bcebbc7bc
3 changed files with 26 additions and 5 deletions
@@ -1,3 +1,7 @@
/mob/dead/new_player
/// Title screen is ready to receive signals
var/title_screen_is_ready = FALSE
/mob/dead/new_player/Topic(href, href_list[])
if(src != usr)
return
@@ -111,6 +115,10 @@
vote_on_poll_handler(poll, href_list)
return
if(href_list["title_is_ready"])
title_screen_is_ready = TRUE
return
/mob/dead/new_player/Login()
. = ..()
@@ -71,7 +71,7 @@ GLOBAL_LIST_EMPTY(startup_messages)
}
// Recalculate gap as a % within a % since they're nested.
const progress_sub_current_position = (progress_current_position - progress_sub_start) / progress_current_position * 100;
var progress_sub_current_position = (progress_current_position - progress_sub_start) / progress_current_position * 100;
progress_bar.style.width = "" + progress_current_position + "%";
sub_progress_bar.style.width = "" + progress_sub_current_position + "%";
@@ -164,7 +164,16 @@ GLOBAL_LIST_EMPTY(startup_messages)
function update_loading_progress() {}
</script>
"}
// Tell the server this page loaded.
dat += {"
<script>
var ready_request = new XMLHttpRequest();
ready_request.open("GET", "?src=\ref[src];title_is_ready=1", true);
ready_request.send();
</script>
"}
dat += "</body></html>"
return dat
@@ -167,7 +167,10 @@ SUBSYSTEM_DEF(title)
* * user - The user being updated
* * name - the real name of the current slot.
*/
/datum/controller/subsystem/title/proc/update_character_name(mob/user, name)
/datum/controller/subsystem/title/proc/update_character_name(mob/dead/new_player/user, name)
if(!(istype(user) && user.title_screen_is_ready))
return
user.client << output(name, "title_browser:update_current_character")
/**
@@ -193,7 +196,8 @@ SUBSYSTEM_DEF(title)
SStitle.startup_message_timings[msg] = new_timing
for(var/mob/dead/new_player/new_player in GLOB.new_player_list)
#ifndef LOWMEMORYMODE // Prevents the pre-load screen from running but ensures that the bare minimum of errors happen, doesn't happen on live
if(!new_player.title_screen_is_ready)
continue
new_player.client << output(msg_dat, "title_browser:append_terminal_text")
new_player.client << output(list2params(list(new_timing, SStitle.average_completion_time)), "title_browser:update_loading_progress")
#endif