mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] Auto-AFK (#8450)
Co-authored-by: Killian <49700375+KillianKirilenko@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
@@ -416,6 +416,13 @@ var/list/_client_preferences_by_type
|
|||||||
disabled_description = "Silent"
|
disabled_description = "Silent"
|
||||||
// CHOMPAdd End
|
// CHOMPAdd End
|
||||||
|
|
||||||
|
/datum/client_preference/auto_afk
|
||||||
|
description = "Automatic AFK Status"
|
||||||
|
key = "AUTO_AFK"
|
||||||
|
enabled_by_default = TRUE
|
||||||
|
enabled_description = "Automatic"
|
||||||
|
disabled_description = "Manual Only"
|
||||||
|
|
||||||
|
|
||||||
/********************
|
/********************
|
||||||
* Staff Preferences *
|
* Staff Preferences *
|
||||||
|
|||||||
@@ -167,3 +167,14 @@
|
|||||||
toggle_preference(pref_path)
|
toggle_preference(pref_path)
|
||||||
|
|
||||||
to_chat(src, "The cooldown between pain messages for minor (under 20/5 injury. Multi-limb injuries are still faster) is now [ (is_preference_enabled(pref_path)) ? "extended" : "default"].")
|
to_chat(src, "The cooldown between pain messages for minor (under 20/5 injury. Multi-limb injuries are still faster) is now [ (is_preference_enabled(pref_path)) ? "extended" : "default"].")
|
||||||
|
|
||||||
|
/client/verb/toggle_automatic_afk()
|
||||||
|
set name = "Toggle Automatic AFK"
|
||||||
|
set category = "Preferences"
|
||||||
|
set desc = "When enabled, causes you to be automatically marked as AFK if you are idle for too long."
|
||||||
|
|
||||||
|
var/pref_path = /datum/client_preference/auto_afk
|
||||||
|
|
||||||
|
toggle_preference(pref_path)
|
||||||
|
|
||||||
|
to_chat(src, "You will [ (is_preference_enabled(pref_path)) ? "now" : "not"] be automatically marked as AFK if you are idle for ten minutes or more.")
|
||||||
|
|||||||
@@ -311,7 +311,9 @@
|
|||||||
else if(!client)
|
else if(!client)
|
||||||
msg += "<span class='deadsay'>[T.He] [T.is] [ssd_msg].</span>"
|
msg += "<span class='deadsay'>[T.He] [T.is] [ssd_msg].</span>"
|
||||||
//VOREStation Add Start
|
//VOREStation Add Start
|
||||||
if(client && ((client.inactivity / 10) / 60 > 10)) //10 Minutes
|
if(away_from_keyboard && manual_afk)
|
||||||
|
msg += "\[Away From Keyboard for [round((client.inactivity/10)/60)] minutes\]"
|
||||||
|
else if(client && ((client.inactivity / 10) / 60 > 10)) //10 Minutes
|
||||||
msg += "\[Inactive for [round((client.inactivity/10)/60)] minutes\]"
|
msg += "\[Inactive for [round((client.inactivity/10)/60)] minutes\]"
|
||||||
else if(disconnect_time)
|
else if(disconnect_time)
|
||||||
msg += "\[Disconnected/ghosted [round(((world.realtime - disconnect_time)/10)/60)] minutes ago\]"
|
msg += "\[Disconnected/ghosted [round(((world.realtime - disconnect_time)/10)/60)] minutes ago\]"
|
||||||
|
|||||||
@@ -37,6 +37,17 @@
|
|||||||
|
|
||||||
. = 1
|
. = 1
|
||||||
|
|
||||||
|
if(client)
|
||||||
|
var/idle_limit = 10 MINUTES
|
||||||
|
if(client.inactivity >= idle_limit && !away_from_keyboard && src.is_preference_enabled(/datum/client_preference/auto_afk)) //if we're not already afk and we've been idle too long, and we have automarking enabled... then automark it
|
||||||
|
add_status_indicator("afk")
|
||||||
|
to_chat(src, "<span class='notice'>You have been idle for too long, and automatically marked as AFK.</span>")
|
||||||
|
away_from_keyboard = TRUE
|
||||||
|
else if(away_from_keyboard && client.inactivity < idle_limit && !manual_afk) //if we're afk but we do something AND we weren't manually flagged as afk, unmark it
|
||||||
|
remove_status_indicator("afk")
|
||||||
|
to_chat(src, "<span class='notice'>You have been automatically un-marked as AFK.</span>")
|
||||||
|
away_from_keyboard = FALSE
|
||||||
|
|
||||||
//Chemicals in the body, this is moved over here so that blood can be added after death
|
//Chemicals in the body, this is moved over here so that blood can be added after death
|
||||||
handle_chemicals_in_body()
|
handle_chemicals_in_body()
|
||||||
|
|
||||||
|
|||||||
@@ -125,10 +125,12 @@
|
|||||||
remove_status_indicator("afk")
|
remove_status_indicator("afk")
|
||||||
to_chat(src, "<span class='notice'>You are no longer marked as AFK.</span>")
|
to_chat(src, "<span class='notice'>You are no longer marked as AFK.</span>")
|
||||||
away_from_keyboard = FALSE
|
away_from_keyboard = FALSE
|
||||||
|
manual_afk = FALSE
|
||||||
else
|
else
|
||||||
add_status_indicator("afk")
|
add_status_indicator("afk")
|
||||||
to_chat(src, "<span class='notice'>You are now marked as AFK.</span>")
|
to_chat(src, "<span class='notice'>You are now marked as AFK.</span>")
|
||||||
away_from_keyboard = TRUE
|
away_from_keyboard = TRUE
|
||||||
|
manual_afk = TRUE
|
||||||
|
|
||||||
/mob/living/proc/updatehealth()
|
/mob/living/proc/updatehealth()
|
||||||
if(status_flags & GODMODE)
|
if(status_flags & GODMODE)
|
||||||
|
|||||||
@@ -157,6 +157,7 @@
|
|||||||
|
|
||||||
var/can_be_antagged = FALSE // To prevent pAIs/mice/etc from getting antag in autotraitor and future auto- modes. Uses inheritance instead of a bunch of typechecks.
|
var/can_be_antagged = FALSE // To prevent pAIs/mice/etc from getting antag in autotraitor and future auto- modes. Uses inheritance instead of a bunch of typechecks.
|
||||||
var/away_from_keyboard = FALSE //are we at, or away, from our keyboard?
|
var/away_from_keyboard = FALSE //are we at, or away, from our keyboard?
|
||||||
|
var/manual_afk = FALSE //did we set afk manually or was it automatic?
|
||||||
|
|
||||||
//Generic list for proc holders. Only way I can see to enable certain verbs/procs. Should be modified if needed.
|
//Generic list for proc holders. Only way I can see to enable certain verbs/procs. Should be modified if needed.
|
||||||
var/proc_holder_list[] = list()//Right now unused.
|
var/proc_holder_list[] = list()//Right now unused.
|
||||||
|
|||||||
Reference in New Issue
Block a user