mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
Fix BYOND membership status available to non-members (#25902)
* split byond member from server donator * Update preferences.dm * Update preferences.dm * Update player_ranks.dm * Update preferences.dm
This commit is contained in:
@@ -109,8 +109,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
load_path(parent.ckey)
|
||||
if(load_and_save && !fexists(path))
|
||||
try_savefile_type_migration()
|
||||
unlock_content = !!parent.IsByondMember() || GLOB.donator_list[parent.ckey] //SKYRAT EDIT - ADDED DONATOR CHECK
|
||||
if(unlock_content)
|
||||
unlock_content = !!parent.IsByondMember()
|
||||
donator_status = !!GLOB.donator_list[parent.ckey] //SKYRAT EDIT ADD - DONATOR CHECK
|
||||
if(unlock_content || donator_status) //SKYRAT EDIT - ADD DONATOR CHECK
|
||||
max_save_slots = 50 //SKYRAT EDIT - ORIGINAL 8
|
||||
else
|
||||
CRASH("attempted to create a preferences datum without a client or mock!")
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
return FALSE
|
||||
|
||||
if(SSplayer_ranks.initialized)
|
||||
SSplayer_ranks.update_prefs_unlock_content(client?.prefs)
|
||||
SSplayer_ranks.update_prefs_donator_status(client?.prefs)
|
||||
|
||||
return TRUE
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
/datum/preferences
|
||||
/// Does this member have donator status on the server
|
||||
var/donator_status = FALSE
|
||||
@@ -111,7 +111,7 @@ SUBSYSTEM_DEF(player_ranks)
|
||||
|
||||
if(CONFIG_GET(flag/donator_legacy_system))
|
||||
donator_controller.load_legacy()
|
||||
update_all_prefs_unlock_contents()
|
||||
update_all_prefs_donator_status()
|
||||
return
|
||||
|
||||
if(!SSdbcore.Connect())
|
||||
@@ -124,30 +124,31 @@ SUBSYSTEM_DEF(player_ranks)
|
||||
return
|
||||
|
||||
load_player_rank_sql(donator_controller)
|
||||
update_all_prefs_unlock_contents()
|
||||
update_all_prefs_donator_status()
|
||||
|
||||
|
||||
/**
|
||||
* Handles updating all of the preferences datums to have the appropriate
|
||||
* `unlock_content` and `max_save_slots` once donators are loaded.
|
||||
* `donator_status` and `max_save_slots` once donators are loaded.
|
||||
*/
|
||||
/datum/controller/subsystem/player_ranks/proc/update_all_prefs_unlock_contents()
|
||||
/datum/controller/subsystem/player_ranks/proc/update_all_prefs_donator_status()
|
||||
for(var/ckey as anything in GLOB.preferences_datums)
|
||||
update_prefs_unlock_content(GLOB.preferences_datums[ckey])
|
||||
update_prefs_donator_status(GLOB.preferences_datums[ckey])
|
||||
|
||||
|
||||
/**
|
||||
* Updates the `unlock_contents` and the `max_save_slots`
|
||||
* Updates the `donator_status` and the `max_save_slots`
|
||||
*
|
||||
* Arguments:
|
||||
* * prefs - The preferences datum to check the unlock_content eligibility.
|
||||
* * prefs - The preferences datum to check the donator_status eligibility.
|
||||
*/
|
||||
/datum/controller/subsystem/player_ranks/proc/update_prefs_unlock_content(datum/preferences/prefs)
|
||||
/datum/controller/subsystem/player_ranks/proc/update_prefs_donator_status(datum/preferences/prefs)
|
||||
if(!prefs)
|
||||
return
|
||||
|
||||
prefs.unlock_content = !!prefs.parent.IsByondMember() || is_donator(prefs.parent)
|
||||
if(prefs.unlock_content)
|
||||
prefs.unlock_content = !!prefs.parent.IsByondMember()
|
||||
prefs.donator_status = is_donator(prefs.parent)
|
||||
if(prefs.unlock_content || prefs.donator_status)
|
||||
prefs.max_save_slots = 50
|
||||
|
||||
|
||||
|
||||
@@ -7776,6 +7776,7 @@
|
||||
#include "modular_skyrat\modules\pixel_shift\code\pixel_shift_component.dm"
|
||||
#include "modular_skyrat\modules\pixel_shift\code\pixel_shift_keybind.dm"
|
||||
#include "modular_skyrat\modules\pixel_shift\code\pixel_shift_mob.dm"
|
||||
#include "modular_skyrat\modules\player_ranks\code\preferences.dm"
|
||||
#include "modular_skyrat\modules\player_ranks\code\world_topic.dm"
|
||||
#include "modular_skyrat\modules\player_ranks\code\player_rank_controller\_player_rank_controller.dm"
|
||||
#include "modular_skyrat\modules\player_ranks\code\player_rank_controller\config_entry.dm"
|
||||
|
||||
Reference in New Issue
Block a user