Refactors Sun and Inactivity processes to subsystems, and a few globa lvariables to be managed

This commit is contained in:
Atermonera
2018-12-03 17:21:00 -08:00
committed by VirgoBot
parent 4579aed0ed
commit bf86b408fa
9 changed files with 56 additions and 63 deletions

View File

@@ -0,0 +1,42 @@
SUBSYSTEM_DEF(inactivity)
name = "AFK Kick"
wait = 600
flags = SS_BACKGROUND | SS_NO_TICK_CHECK
/datum/controller/subsystem/inactivity/fire()
if(config.kick_inactive)
<<<<<<< HEAD:code/controllers/Processes/inactivity.dm
for(last_object in clients)
var/client/C = last_object
if(C.is_afk(config.kick_inactive MINUTES) && !C.holder) // VOREStation Edit - Allow admins to idle
=======
for(var/i in clients)
var/client/C = i
if(C.is_afk(config.kick_inactive MINUTES))
>>>>>>> 414cf71... Merge pull request #5726 from kevinz000/ss_refactor_3:code/controllers/subsystems/inactivity.dm
to_chat(C,"<span class='warning'>You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected.</span>")
var/information
if(C.mob)
if(ishuman(C.mob))
var/job
var/mob/living/carbon/human/H = C.mob
var/datum/data/record/R = find_general_record("name", H.real_name)
if(R)
job = R.fields["real_rank"]
if(!job && H.mind)
job = H.mind.assigned_role
if(!job && H.job)
job = H.job
if(job)
information = " while [job]."
else if(issilicon(C.mob))
information = " while a silicon."
var/adminlinks
adminlinks = " (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[C.mob.x];Y=[C.mob.y];Z=[C.mob.z]'>JMP</a>|<A HREF='?_src_=holder;cryoplayer=\ref[C.mob]'>CRYO</a>)"
log_and_message_admins("being kicked for AFK[information][adminlinks]", C.mob)
qdel(C)