mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 01:34:01 +00:00
Preference support for Guests (#72332)
## About The Pull Request Makes it to where if you connect as a guest preferences don't error out the ass Resolves https://github.com/tgstation/tgstation/issues/72268 ## Why It's Good For The Game Easier local debugging, and for servers that let guests join ## Changelog 🆑 server: Preferences now support guests /🆑
This commit is contained in:
@@ -2,20 +2,26 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
|
||||
/datum/preferences
|
||||
var/client/parent
|
||||
//doohickeys for savefiles
|
||||
/// The path to the general savefile for this datum
|
||||
var/path
|
||||
var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used
|
||||
/// Whether or not we allow saving/loading. Used for guests, if they're enabled
|
||||
var/load_and_save = TRUE
|
||||
/// Ensures that we always load the last used save, QOL
|
||||
var/default_slot = 1
|
||||
/// The maximum number of slots we're allowed to contain
|
||||
var/max_save_slots = 3
|
||||
|
||||
//non-preference stuff
|
||||
var/muted = 0
|
||||
/// Bitflags for communications that are muted
|
||||
var/muted = NONE
|
||||
/// Last IP that this client has connected from
|
||||
var/last_ip
|
||||
/// Last CID that this client has connected from
|
||||
var/last_id
|
||||
|
||||
//game-preferences
|
||||
var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
|
||||
/// Cached changelog size, to detect new changelogs since last join
|
||||
var/lastchangelog = ""
|
||||
|
||||
//Antag preferences
|
||||
/// List of ROLE_X that the client wants to be eligible for
|
||||
var/list/be_special = list() //Special role selection
|
||||
|
||||
/// Custom keybindings. Map of keybind names to keyboard inputs.
|
||||
@@ -95,13 +101,13 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
middleware += new middleware_type(src)
|
||||
|
||||
if(IS_CLIENT_OR_MOCK(parent))
|
||||
if(!is_guest_key(parent.key))
|
||||
load_path(parent.ckey)
|
||||
if(!fexists(path))
|
||||
try_savefile_type_migration()
|
||||
unlock_content = !!parent.IsByondMember()
|
||||
if(unlock_content)
|
||||
max_save_slots = 8
|
||||
load_and_save = !is_guest_key(parent.key)
|
||||
load_path(parent.ckey)
|
||||
if(load_and_save && !fexists(path))
|
||||
try_savefile_type_migration()
|
||||
unlock_content = !!parent.IsByondMember()
|
||||
if(unlock_content)
|
||||
max_save_slots = 8
|
||||
else
|
||||
CRASH("attempted to create a preferences datum without a client or mock!")
|
||||
load_savefile()
|
||||
|
||||
Reference in New Issue
Block a user