mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user