Merge pull request #16159 from AffectedArc07/new-player-gc-hopefully-please

(Hopefully) makes new players GC
This commit is contained in:
Fox McCloud
2021-07-01 22:14:21 -04:00
committed by GitHub
5 changed files with 32 additions and 8 deletions
+16
View File
@@ -0,0 +1,16 @@
SUBSYSTEM_DEF(chat_pings)
name = "Chat Pings"
flags = SS_NO_INIT
runlevels = RUNLEVEL_INIT | RUNLEVEL_LOBBY | RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME // ALL OF THEM
wait = 30 SECONDS // Chat pings every 30 seconds
/// List of all held chat datums
var/list/datum/chatOutput/chat_datums = list() // Do NOT put this in Initialize(). You will cause issues.
/datum/controller/subsystem/chat_pings/fire(resumed)
for(var/datum/chatOutput/CO as anything in chat_datums)
CO.updatePing()
if(MC_TICK_CHECK)
return
/datum/controller/subsystem/chat_pings/stat_entry()
..("P: [length(chat_datums)]")
+1 -1
View File
@@ -225,7 +225,7 @@
to_chat(H, "<span class='danger'>Failed to locate a storage object on your mob, either you spawned with no hands free and no backpack or this is a bug.</span>")
qdel(G)
qdel(gear_leftovers)
gear_leftovers.Cut()
return 1
+1
View File
@@ -421,6 +421,7 @@
GLOB.admins -= src
GLOB.directory -= ckey
GLOB.clients -= src
QDEL_NULL(chatOutput)
if(movingmob)
movingmob.client_mobs_in_contents -= mob
UNSETEMPTY(movingmob.client_mobs_in_contents)
+13 -7
View File
@@ -37,6 +37,7 @@ var/list/chatResources = list(
. = ..()
owner = C
SSchat_pings.chat_datums += src
/datum/chatOutput/proc/start()
if(!owner)
@@ -126,14 +127,14 @@ var/list/chatResources = list(
if(owner.tos_consent)
sendClientData()
pingLoop()
updatePing()
/datum/chatOutput/proc/pingLoop()
set waitfor = FALSE
while (owner)
ehjax_send(data = owner.is_afk(29 SECONDS) ? "softPang" : "pang") // SoftPang isn't handled anywhere but it'll always reset the opts.lastPang.
sleep(30 SECONDS)
// PARADISE EDIT: This just updates the ping and is called from SSchat_pings
/datum/chatOutput/proc/updatePing()
if(!owner)
qdel(src)
return
ehjax_send(data = owner.is_afk(29 SECONDS) ? "softPang" : "pang") // SoftPang isn't handled anywhere but it'll always reset the opts.lastPang.
/datum/chatOutput/proc/ehjax_send(client/C = owner, window = "browseroutput", data)
if(islist(data))
@@ -221,6 +222,11 @@ var/list/chatResources = list(
/datum/chatOutput/proc/clear_syndicate_codes()
owner << output(null, "browseroutput:codewordsClear")
/datum/chatOutput/Destroy(force)
SSchat_pings.chat_datums -= src
return ..()
/client/verb/debug_chat()
set hidden = 1
chatOutput.ehjax_send(data = list("firebug" = 1))
+1
View File
@@ -194,6 +194,7 @@
#include "code\controllers\subsystem\atoms.dm"
#include "code\controllers\subsystem\blackbox.dm"
#include "code\controllers\subsystem\changelog.dm"
#include "code\controllers\subsystem\chat_pings.dm"
#include "code\controllers\subsystem\cleanup.dm"
#include "code\controllers\subsystem\dbcore.dm"
#include "code\controllers\subsystem\discord.dm"