From c7e9dc0df09a6a807772039f05a0fe09124bdd2b Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Sat, 4 Sep 2021 21:47:40 +0100
Subject: [PATCH 1/8] Makes the Chat/Verbs actually work after reconnect
*hopefully*
---
code/modules/client/client_procs.dm | 5 +++--
code/modules/tgui_panel/tgui_panel.dm | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 7abea7d3f3e4..4f1d747920be 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -291,7 +291,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
// Instantiate tgui panel
tgui_panel = new(src)
- tgui_panel?.send_connected()
+ tgui_panel.send_connected()
GLOB.ahelp_tickets.ClientLogin(src)
var/connecting_admin = FALSE //because de-admined admins connecting should be treated like admins.
@@ -416,7 +416,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
// Initialize tgui panel
tgui_panel.initialize()
src << browse(file('html/statbrowser.html'), "window=statbrowser")
- addtimer(CALLBACK(src, .proc/check_panel_loaded), 30 SECONDS)
+ addtimer(CALLBACK(src, .proc/check_panel_loaded), 10 SECONDS)
if(alert_mob_dupe_login)
@@ -1128,3 +1128,4 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
if(statbrowser_ready)
return
to_chat(src, "Statpanel failed to load, click here to reload the panel ")
+ tgui_panel.initialize()
diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm
index d34b7b4c5fae..a5ef8be9f0b3 100644
--- a/code/modules/tgui_panel/tgui_panel.dm
+++ b/code/modules/tgui_panel/tgui_panel.dm
@@ -12,6 +12,7 @@
var/datum/tgui_window/window
var/broken = FALSE
var/initialized_at
+ var/retries = 0
/datum/tgui_panel/New(client/client)
src.client = client
@@ -37,6 +38,9 @@
* Initializes tgui panel.
*/
/datum/tgui_panel/proc/initialize(force = FALSE)
+ set waitfor = FALSE
+ // Minimal sleep to defer initialization to after client constructor
+ sleep(1)
initialized_at = world.time
// Perform a clean initialization
window.initialize(inline_assets = list(
@@ -46,13 +50,28 @@
window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/fontawesome))
window.send_asset(get_asset_datum(/datum/asset/spritesheet/chat))
request_telemetry()
+ world.log << "Trying to initialize"
+ addtimer(CALLBACK(src, .proc/check_telemetry), 2 SECONDS)
addtimer(CALLBACK(src, .proc/on_initialize_timed_out), 2 SECONDS)
+/datum/tgui_panel/proc/check_telemetry()
+ if(!telemetry_connections) /// Somethings fucked lets try again.
+ world.log << "Shits fucked attempt [retries]"
+ if(retries > 2)
+ winset(usr, null, "command=.reconnect") /// Kitchen Sink
+ retries++
+ src << browse(file('html/statbrowser.html'), "window=statbrowser") /// Reloads the statpanel as well
+ initialize() /// Lets just start again
+ var/mob/dead/new_player/M = client.mob
+ if(istype(M)
+ M.login()
+
/**
* private
*
* Called when initialization has timed out.
*/
+
/datum/tgui_panel/proc/on_initialize_timed_out()
// Currently does nothing but sending a message to old chat.
SEND_TEXT(client, "Failed to load fancy chat, click HERE to attempt to reload it.")
From 24d03adcc34027aa1331333e8e0a17e2d143bf84 Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Sat, 4 Sep 2021 22:23:32 +0100
Subject: [PATCH 2/8] e
---
code/modules/tgui_panel/tgui_panel.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm
index a5ef8be9f0b3..b4997a35bf2d 100644
--- a/code/modules/tgui_panel/tgui_panel.dm
+++ b/code/modules/tgui_panel/tgui_panel.dm
@@ -63,7 +63,7 @@
src << browse(file('html/statbrowser.html'), "window=statbrowser") /// Reloads the statpanel as well
initialize() /// Lets just start again
var/mob/dead/new_player/M = client.mob
- if(istype(M)
+ if(istype(M))
M.login()
/**
From e54f57acd535de8a8e8a9d7df3a2ccfae1514e66 Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Sat, 4 Sep 2021 22:44:02 +0100
Subject: [PATCH 3/8] OMG
---
code/modules/tgui_panel/tgui_panel.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm
index b4997a35bf2d..35cc32900d90 100644
--- a/code/modules/tgui_panel/tgui_panel.dm
+++ b/code/modules/tgui_panel/tgui_panel.dm
@@ -64,7 +64,7 @@
initialize() /// Lets just start again
var/mob/dead/new_player/M = client.mob
if(istype(M))
- M.login()
+ M.Login()
/**
* private
From e1c6a24b7c23496792c3d0c548af0e7b4de983e9 Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Sat, 4 Sep 2021 23:30:26 +0100
Subject: [PATCH 4/8] Should fix a couple runtimes.
---
code/modules/tgui_panel/tgui_panel.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm
index 35cc32900d90..d95cc4d8a858 100644
--- a/code/modules/tgui_panel/tgui_panel.dm
+++ b/code/modules/tgui_panel/tgui_panel.dm
@@ -58,11 +58,11 @@
if(!telemetry_connections) /// Somethings fucked lets try again.
world.log << "Shits fucked attempt [retries]"
if(retries > 2)
- winset(usr, null, "command=.reconnect") /// Kitchen Sink
+ winset(client, null, "command=.reconnect") /// Kitchen Sink
retries++
src << browse(file('html/statbrowser.html'), "window=statbrowser") /// Reloads the statpanel as well
initialize() /// Lets just start again
- var/mob/dead/new_player/M = client.mob
+ var/mob/dead/new_player/M = client?.mob
if(istype(M))
M.Login()
From 98c7df52acf147e1b432e3a7281fb3d1fd3808fa Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Sun, 5 Sep 2021 16:31:19 +0100
Subject: [PATCH 5/8] eee
---
code/modules/tgui_panel/tgui_panel.dm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm
index d95cc4d8a858..535771672d7b 100644
--- a/code/modules/tgui_panel/tgui_panel.dm
+++ b/code/modules/tgui_panel/tgui_panel.dm
@@ -58,7 +58,8 @@
if(!telemetry_connections) /// Somethings fucked lets try again.
world.log << "Shits fucked attempt [retries]"
if(retries > 2)
- winset(client, null, "command=.reconnect") /// Kitchen Sink
+ if(client && istype(client))
+ winset(client, null, "command=.reconnect") /// Kitchen Sink
retries++
src << browse(file('html/statbrowser.html'), "window=statbrowser") /// Reloads the statpanel as well
initialize() /// Lets just start again
From 9d938a8211072abb62b919be6d125213b12d1ac3 Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Mon, 6 Sep 2021 00:14:27 +0100
Subject: [PATCH 6/8] LOOPS
---
code/modules/tgui_panel/tgui_panel.dm | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm
index 535771672d7b..b973e0b047d0 100644
--- a/code/modules/tgui_panel/tgui_panel.dm
+++ b/code/modules/tgui_panel/tgui_panel.dm
@@ -51,7 +51,8 @@
window.send_asset(get_asset_datum(/datum/asset/spritesheet/chat))
request_telemetry()
world.log << "Trying to initialize"
- addtimer(CALLBACK(src, .proc/check_telemetry), 2 SECONDS)
+ if(!telemetry_connections && retries < 6)
+ addtimer(CALLBACK(src, .proc/check_telemetry), 2 SECONDS)
addtimer(CALLBACK(src, .proc/on_initialize_timed_out), 2 SECONDS)
/datum/tgui_panel/proc/check_telemetry()
@@ -60,7 +61,13 @@
if(retries > 2)
if(client && istype(client))
winset(client, null, "command=.reconnect") /// Kitchen Sink
- retries++
+ qdel(client)
+ if(retries > 3)
+ qdel(client)
+ if(retries > 5)
+ return // I give up
+ if(retries < 6)
+ retries++
src << browse(file('html/statbrowser.html'), "window=statbrowser") /// Reloads the statpanel as well
initialize() /// Lets just start again
var/mob/dead/new_player/M = client?.mob
From a01463287186322843e130b439ba70ee9bc445b9 Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Wed, 8 Sep 2021 20:01:12 +0100
Subject: [PATCH 7/8] Apply suggestions from code review
---
code/modules/tgui_panel/tgui_panel.dm | 2 --
1 file changed, 2 deletions(-)
diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm
index b973e0b047d0..fb7a1e926c4e 100644
--- a/code/modules/tgui_panel/tgui_panel.dm
+++ b/code/modules/tgui_panel/tgui_panel.dm
@@ -50,14 +50,12 @@
window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/fontawesome))
window.send_asset(get_asset_datum(/datum/asset/spritesheet/chat))
request_telemetry()
- world.log << "Trying to initialize"
if(!telemetry_connections && retries < 6)
addtimer(CALLBACK(src, .proc/check_telemetry), 2 SECONDS)
addtimer(CALLBACK(src, .proc/on_initialize_timed_out), 2 SECONDS)
/datum/tgui_panel/proc/check_telemetry()
if(!telemetry_connections) /// Somethings fucked lets try again.
- world.log << "Shits fucked attempt [retries]"
if(retries > 2)
if(client && istype(client))
winset(client, null, "command=.reconnect") /// Kitchen Sink
From 0c20857fd63778c08c83c48d159ab1035784576e Mon Sep 17 00:00:00 2001
From: Jamie D <993128+JamieD1@users.noreply.github.com>
Date: Fri, 17 Sep 2021 12:51:56 +0100
Subject: [PATCH 8/8] Update code/modules/client/client_procs.dm
---
code/modules/client/client_procs.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 4f1d747920be..b4bfc4f21bad 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -416,7 +416,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
// Initialize tgui panel
tgui_panel.initialize()
src << browse(file('html/statbrowser.html'), "window=statbrowser")
- addtimer(CALLBACK(src, .proc/check_panel_loaded), 10 SECONDS)
+ addtimer(CALLBACK(src, .proc/check_panel_loaded), 5 SECONDS)
if(alert_mob_dupe_login)