Skip to content

Commit

Permalink
Периодические статус репорты об онлайне в дискорд (#306)
Browse files Browse the repository at this point in the history
* Раз в 15 минут пик + текущий

* Whoops

* pk lets do with client, not mob

* ы

* s

* sd

* Сервер только инитнулся. Там никого нет дебич

* Пробуем глобалки

* помогите

* адбуздииии

* ФЫВ

* поднимаем таймер до 25 минут
  • Loading branch information
Archemagus committed Jun 20, 2023
1 parent be679d3 commit 4aad921
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,27 @@
return TRUE
send2chat(new /datum/tgs_message_content("**[admin_rank == null ? null : admin_rank][ckey]:** *[replacetext_char(replacetext_char(message, "'", "'"), " "", "\"")]*"), "ooc-chat")
return TRUE



// Max online notifier
var/max_client = 0
var/timer = null

/client/New()
. = ..()
max_client = max(max_client, GLOB.clients.len)

/hook/roundstart/proc/round_status_notifier()
send2chat(new /datum/tgs_message_content("**Раунд начался!**\nКоличество экипажа: [GLOB.clients.len].[max_client != GLOB.clients.len ? " А ведь их было [max_client]!":""]"), "launch-alert")
timer = addtimer(CALLBACK(GLOBAL_PROC, .proc/gen_report), 25 MINUTES, TIMER_UNIQUE | TIMER_STOPPABLE | TIMER_LOOP)
return TRUE

/proc/gen_report()
max_client = max(max_client, GLOB.clients.len)
send2chat(new /datum/tgs_message_content("**Отчет по раунду.**\n__Продолжительность:__ *[roundduration2text()]*\n__Онлайн:__ *[GLOB.clients.len]*\n__Пиковый онлайн:__ *[max_client]*"), "launch-alert")

/hook/roundend/proc/round_status_notifier()
deltimer(timer)
timer = null
return TRUE
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define TGS_WRITE_GLOBAL(Name, Value) global._tgs_##Name = ##Value

/// Disallow ANYONE from reflecting a given `path`, security measure to prevent in-game use of DD -> TGS capabilities.
#define TGS_PROTECT_DATUM(Path)
#define TGS_PROTECT_DATUM(Path) // Nope. But close GLOBAL_PROTECT(Path)

/// Display an announcement `message` from the server to all players.
#define TGS_WORLD_ANNOUNCE(message) to_world(html_encode(message))
Expand Down

0 comments on commit 4aad921

Please sign in to comment.