Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ SUBSYSTEM_DEF(ticker)

start_at = world.time + (CONFIG_GET(number/lobby_countdown) * 10)
apply_scheduled_pregame_delay() // modular_solaris/code/modules/admin/delay_pregame_on_reboot.dm
apply_persistent_admin_notice() // modular_solaris/code/modules/admin/persistent_admin_notice.dm
// Offset time drift but start right in the morning of Monday.
gametime_offset = 288001
return ..()
Expand Down
2 changes: 2 additions & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ GLOBAL_PROTECT(admin_verbs_admin)
/datum/admins/proc/toggleguests, /*toggles whether guests can join the current game*/
/datum/admins/proc/announce, /*priority announce something to all clients.*/
/datum/admins/proc/set_admin_notice, /*announcement all clients see when joining the server.*/
/datum/admins/proc/set_persistent_admin_notice, /*same as above, but survives a reboot until cleared. modular_solaris/code/modules/admin/persistent_admin_notice.dm*/
/client/proc/toggle_game_master, /*opens the game master panel*/
/client/proc/toggle_aghost_invis, /* lets us choose whether our in-game mob goes visible when we aghost (off by default) */
/client/proc/admin_ghost, /*allows us to ghost/reenter body at will*/
Expand Down Expand Up @@ -253,6 +254,7 @@ GLOBAL_LIST_INIT(admin_verbs_hideable, list(
/datum/admins/proc/toggleguests,
/datum/admins/proc/announce,
/datum/admins/proc/set_admin_notice,
/datum/admins/proc/set_persistent_admin_notice,
/client/proc/toggle_aghost_invis,
/client/proc/admin_ghost,
/client/proc/toggle_view_range,
Expand Down
48 changes: 48 additions & 0 deletions modular_solaris/code/modules/admin/persistent_admin_notice.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/// Text of the persistent admin notice, if one has been set. Stored separately from GLOB.admin_notice so it
/// survives a world restart (GLOB.admin_notice itself is not saved anywhere and always starts blank on boot).
GLOBAL_VAR_INIT(persistent_admin_notice, load_persistent_admin_notice())

/proc/load_persistent_admin_notice()
var/savefile = file("data/persistent_admin_notice.txt")
if(!fexists(savefile))
return ""
return file2text(savefile)

/proc/save_persistent_admin_notice(text)
var/savefile = file("data/persistent_admin_notice.txt")
fdel(savefile)
if(text)
WRITE_FILE(savefile, text)

/// Re-applies the persisted notice (if any) into GLOB.admin_notice at round start, reusing the existing
/// admin_notice display pipeline (new player login message, the Adminnotice check verb, etc.) as-is.
/// Called once from ticker Initialize() so it's in place before anyone can join.
/datum/controller/subsystem/ticker/proc/apply_persistent_admin_notice()
if(GLOB.persistent_admin_notice)
GLOB.admin_notice = GLOB.persistent_admin_notice

/datum/admins/proc/set_persistent_admin_notice()
set category = "Server"
set name = "Set Persistent Admin Notice"
set desc = "Set an announcement that appears to everyone who joins the server, every round, until cleared. Unlike Set Admin Notice, this survives a server reboot."
if(!check_rights(0))
return

var/new_notice = input(src, "Set a public notice that persists across round reboots.\nEveryone who joins the server will see it, every round, until this is cleared.\n(Leaving it blank will delete the current persistent notice):", "Set Persistent Notice", GLOB.persistent_admin_notice) as message|null
if(new_notice == null)
return
if(new_notice == GLOB.persistent_admin_notice)
return

GLOB.persistent_admin_notice = new_notice
save_persistent_admin_notice(new_notice)
GLOB.admin_notice = new_notice // shares the same display pipeline as the round-only notice, so setting/clearing this also updates what's currently shown

if(new_notice == "")
message_admins("[key_name(usr)] removed the persistent admin notice.")
log_admin("[key_name(usr)] removed the persistent admin notice.")
else
message_admins("[key_name(usr)] set the persistent admin notice.")
log_admin("[key_name(usr)] set the persistent admin notice:\n[new_notice]")
to_world(span_adminnotice("<b>Admin Notice:</b>\n \t [new_notice]"))
SSblackbox.record_feedback("tally", "admin_verb", 1, "Set Persistent Admin Notice") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
1 change: 1 addition & 0 deletions roguetown.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3726,6 +3726,7 @@
#include "modular_solaris\code\game\objects\items\rogueweapons\ranged\handgonne.dm"
#include "modular_solaris\code\modules\admin\delay_pregame_on_reboot.dm"
#include "modular_solaris\code\modules\admin\loud_asay.dm"
#include "modular_solaris\code\modules\admin\persistent_admin_notice.dm"
#include "modular_solaris\code\modules\clothing\rogueclothes\ammopouch.dm"
#include "modular_solaris\code\modules\jobs\job_types\roguetown\adventurer\types\antag\smokerat.dm"
#include "modular_solaris\code\modules\jobs\job_types\roguetown\adventurer\types\combat\ranger.dm"
Expand Down
Loading