From 10f2cbe2c331f99318b06ec0b21d582a8dc6663b Mon Sep 17 00:00:00 2001 From: Timberpoes Date: Wed, 15 Sep 2021 03:14:11 +0100 Subject: [PATCH] Fix ping_update errors when certain operations resolve to scientific notation (#61443) Sometimes when logging on Campbell, fancy chat fails to load and my non-fancy chat is spammed with the following. image In addition, ping fails to update correct on the status tab when this happens. Hypothesis: Sometimes world.time can report a number that displays as scientific notation when converted to text. The following code leads to calling the update_ping verb. winset(C, null, "command=.update_ping+[world.time+world.tick_lag*TICK_USAGE_REAL/100]") I suspect what's happening is world.time is being converted to text and you're getting the following command: command=.update_ping+2.1313e And this is causing an error in update_ping since it can't resolve 2.1313e as a valid number. Wrapping that in text2num with 32 significant figures (arbitrary number, heat death of the universe proof by several orders of magnitude) means the update_ping verb always gets a number that isn't in scientific notation. --- code/controllers/subsystem/server_maint.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/server_maint.dm b/code/controllers/subsystem/server_maint.dm index 1b8fad3dfdc..8ccf836c92d 100644 --- a/code/controllers/subsystem/server_maint.dm +++ b/code/controllers/subsystem/server_maint.dm @@ -69,7 +69,7 @@ SUBSYSTEM_DEF(server_maint) continue if (!(!C || world.time - C.connection_time < PING_BUFFER_TIME || C.inactivity >= (wait-1))) - winset(C, null, "command=.update_ping+[world.time+world.tick_lag*TICK_USAGE_REAL/100]") + winset(C, null, "command=.update_ping+[num2text(world.time+world.tick_lag*TICK_USAGE_REAL/100, 32)]") if (MC_TICK_CHECK) //one day, when ss13 has 1000 people per server, you guys are gonna be glad I added this tick check return