mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
[MIRROR] tgui Preferences Menu + total rewrite of the preferences backend (#8153)
* tgui Preferences Menu + total rewrite of the preferences backend * nah, we dont need to ping those people * trying to remove the funny stuff * unmodularizing this * prefs reset * this may need to be reverted, who knows * okay, this part * perhaps * EEEEEEEEE * unsanitary * E * Stage 1 + loadout system * more fixes * E * I mean, it launches? * More fixes and reorganisation * E * customisation code is spaget. * disable ERP prefs * Update erp_preferences.dm * Update erp_preferences.dm * E * Slowly getting there * It may be time for help :) * tri...colors... help * preferences now pass preferences * Update dna.dm * Fuck this man * missing savefile return, set_species works, removed dumb stuff from updateappearance * https://github.com/Skyrat-SS13/Skyrat-tg/pull/8199 * https://github.com/Skyrat-SS13/Skyrat-tg/pull/8224 * https://github.com/tgstation/tgstation/pull/61519 * https://github.com/Skyrat-SS13/Skyrat-tg/pull/8278 * e * le butonAZARAK HELLO * hhh * Proper recognition where it's due, MrMelbert! * EEEE * examine block * Better gen hit sounds from whitedream * final loadout touches, more bug fixes im sure to come * i said there would be bugfixes * Update LoadoutManager.js * Missing preferences in the html menu * LIVE TESTING PHASE BABY * Update LoadoutManager.js * EEE * LAUNCH TEST FIRE * Update job.dm * Update new_player.dm * 50gb DAY ONE PATCH * EEE * Update preferences.dm * buggle fixes * Update examine.dm * >LOOC starts on Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: jjpark-kb <55967837+jjpark-kb@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com> Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
co-authored by
Mothblocks
jjpark-kb
Gandalf
Azarak
parent
a5bfc42228
commit
124ddd7cca
@@ -17,6 +17,9 @@ SUBSYSTEM_DEF(atoms)
|
||||
///initAtom() adds the atom its creating to this list iff InitializeAtoms() has been given a list to populate as an argument
|
||||
var/list/created_atoms
|
||||
|
||||
/// Atoms that will be deleted once the subsystem is initialized
|
||||
var/list/queued_deletions = list()
|
||||
|
||||
initialized = INITIALIZATION_INSSATOMS
|
||||
|
||||
/datum/controller/subsystem/atoms/Initialize(timeofday)
|
||||
@@ -75,6 +78,12 @@ SUBSYSTEM_DEF(atoms)
|
||||
atoms_to_return += created_atoms
|
||||
created_atoms = null
|
||||
|
||||
for (var/queued_deletion in queued_deletions)
|
||||
qdel(queued_deletion)
|
||||
|
||||
testing("[queued_deletions.len] atoms were queued for deletion.")
|
||||
queued_deletions.Cut()
|
||||
|
||||
/// Init this specific atom
|
||||
/datum/controller/subsystem/atoms/proc/InitAtom(atom/A, from_template = FALSE, list/arguments)
|
||||
var/the_type = A.type
|
||||
@@ -169,6 +178,14 @@ SUBSYSTEM_DEF(atoms)
|
||||
if(fails & BAD_INIT_SLEPT)
|
||||
. += "- Slept during Initialize()\n"
|
||||
|
||||
/// Prepares an atom to be deleted once the atoms SS is initialized.
|
||||
/datum/controller/subsystem/atoms/proc/prepare_deletion(atom/target)
|
||||
if (initialized == INITIALIZATION_INNEW_REGULAR)
|
||||
// Atoms SS has already completed, just kill it now.
|
||||
qdel(target)
|
||||
else
|
||||
queued_deletions += WEAKREF(target)
|
||||
|
||||
/datum/controller/subsystem/atoms/Shutdown()
|
||||
var/initlog = InitLog()
|
||||
if(initlog)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/// Initializes any assets that need to be loaded ASAP.
|
||||
/// This houses preference menu assets, since they can be loaded at any time,
|
||||
/// most dangerously before the atoms SS initializes.
|
||||
/// Thus, we want it to fail consistently in CI as if it would've if a player
|
||||
/// opened it up early.
|
||||
SUBSYSTEM_DEF(early_assets)
|
||||
name = "Early Assets"
|
||||
init_order = INIT_ORDER_EARLY_ASSETS
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
/datum/controller/subsystem/early_assets/Initialize(start_timeofday)
|
||||
for (var/datum/asset/asset_type as anything in subtypesof(/datum/asset))
|
||||
if (initial(asset_type._abstract) == asset_type)
|
||||
continue
|
||||
|
||||
if (!initial(asset_type.early))
|
||||
continue
|
||||
|
||||
if (!get_asset_datum(asset_type))
|
||||
stack_trace("Could not initialize early asset [asset_type]!")
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
return ..()
|
||||
@@ -74,7 +74,6 @@ SUBSYSTEM_DEF(job)
|
||||
SetupOccupations()
|
||||
if(CONFIG_GET(flag/load_jobs_from_txt))
|
||||
LoadJobs()
|
||||
generate_selectable_species()
|
||||
set_overflow_role(CONFIG_GET(string/overflow_job))
|
||||
return ..()
|
||||
|
||||
@@ -175,6 +174,7 @@ SUBSYSTEM_DEF(job)
|
||||
return name_occupations[rank]
|
||||
|
||||
/datum/controller/subsystem/job/proc/GetJobType(jobtype)
|
||||
RETURN_TYPE(/datum/job)
|
||||
if(!length(all_occupations))
|
||||
SetupOccupations()
|
||||
return type_occupations[jobtype]
|
||||
@@ -529,27 +529,32 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
//We couldn't find a job from prefs for this guy.
|
||||
/datum/controller/subsystem/job/proc/HandleUnassigned(mob/dead/new_player/player)
|
||||
var/jobless_role = player.client.prefs.read_preference(/datum/preference/choiced/jobless_role)
|
||||
|
||||
if(PopcapReached())
|
||||
RejectPlayer(player)
|
||||
else if(player.client.prefs.joblessrole == BEOVERFLOW)
|
||||
var/datum/job/overflow_role_datum = GetJobType(overflow_role)
|
||||
var/allowed_to_be_a_loser = !is_banned_from(player.ckey, overflow_role_datum.title)
|
||||
if(QDELETED(player) || !allowed_to_be_a_loser)
|
||||
RejectPlayer(player)
|
||||
else
|
||||
if(!AssignRole(player, overflow_role_datum))
|
||||
return
|
||||
|
||||
switch (jobless_role)
|
||||
if (BEOVERFLOW)
|
||||
var/datum/job/overflow_role_datum = GetJobType(overflow_role)
|
||||
var/allowed_to_be_a_loser = !is_banned_from(player.ckey, overflow_role_datum.title)
|
||||
if(QDELETED(player) || !allowed_to_be_a_loser)
|
||||
RejectPlayer(player)
|
||||
else if(player.client.prefs.joblessrole == BERANDOMJOB)
|
||||
if(!GiveRandomJob(player))
|
||||
else
|
||||
if(!AssignRole(player, overflow_role_datum))
|
||||
RejectPlayer(player)
|
||||
if (BERANDOMJOB)
|
||||
if(!GiveRandomJob(player))
|
||||
RejectPlayer(player)
|
||||
if (RETURNTOLOBBY)
|
||||
RejectPlayer(player)
|
||||
else //Something gone wrong if we got here.
|
||||
var/message = "DO: [player] fell through handling unassigned"
|
||||
JobDebug(message)
|
||||
log_game(message)
|
||||
message_admins(message)
|
||||
RejectPlayer(player)
|
||||
else if(player.client.prefs.joblessrole == RETURNTOLOBBY)
|
||||
RejectPlayer(player)
|
||||
else //Something gone wrong if we got here.
|
||||
var/message = "DO: [player] fell through handling unassigned"
|
||||
JobDebug(message)
|
||||
log_game(message)
|
||||
message_admins(message)
|
||||
RejectPlayer(player)
|
||||
|
||||
|
||||
//Gives the player the stuff he should have with his rank
|
||||
@@ -559,18 +564,10 @@ SUBSYSTEM_DEF(job)
|
||||
SEND_SIGNAL(equipping, COMSIG_JOB_RECEIVED, job)
|
||||
|
||||
equipping.mind?.set_assigned_role(job)
|
||||
//SKYRAT EDIT ADD - ALTERNATE JOB TITLES
|
||||
var/display_rank = job.title
|
||||
if(player_client && player_client.prefs && player_client.prefs.alt_titles_preferences[job.title])
|
||||
display_rank = player_client.prefs.alt_titles_preferences[job.title]
|
||||
if(player_client)
|
||||
to_chat(player_client, "<span class='infoplain'><b>You are the [display_rank].</b></span>")
|
||||
/* SKYRAT EDIT ORIGINAL
|
||||
if(player_client)
|
||||
to_chat(player_client, "<span class='infoplain'><b>You are the [job.title].</b></span>")
|
||||
*/ // SKYRAT EDIT END
|
||||
to_chat(player_client, span_infoplain("You are the [job.title]."))
|
||||
|
||||
equipping.on_job_equipping(job)
|
||||
equipping.on_job_equipping(job, player_client?.prefs) //SKYRAT EDIT CHANGE
|
||||
|
||||
job.announce_job(equipping)
|
||||
|
||||
@@ -581,15 +578,8 @@ SUBSYSTEM_DEF(job)
|
||||
handle_auto_deadmin_roles(player_client, job.title)
|
||||
|
||||
|
||||
var/list/packed_items //SKYRAT EDIT ADD - CUSTOMISATION
|
||||
if(job)
|
||||
if (player_client && job.no_dresscode && job.loadout)
|
||||
packed_items = player_client.prefs.equip_preference_loadout(equipping,FALSE,job,blacklist=job.blacklist_dresscode_slots,initial=TRUE)
|
||||
//SKYRAT EDIT ADDITION END
|
||||
|
||||
if(player_client)
|
||||
to_chat(player_client, "<span class='infoplain'><b>As the [display_rank] you answer directly to [job.supervisors]. Special circumstances may change this. Your role is that of a [job.title]. Regardless of what your job title may be, please work to fulfil that role.</b></span>") //SKYRAT EDIT -- ALT TITLES
|
||||
// to_chat(player_client, "<span class='infoplain'><b>As the [job.title] you answer directly to [job.supervisors]. Special circumstances may change this.</span></b>" // SKYRAT EDIT ORIGINAL
|
||||
to_chat(player_client, span_infoplain("As the [job.title] you answer directly to [job.supervisors]. Special circumstances may change this.")) // SKYRAT EDIT ORIGINAL
|
||||
|
||||
job.radio_help_message(equipping)
|
||||
|
||||
@@ -610,14 +600,6 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
job.after_spawn(equipping, player_client)
|
||||
|
||||
//SKYRAT CHANGE ADDITION BEGIN - CUSTOMIZATION
|
||||
if(!job.no_dresscode && job.loadout)
|
||||
if(player_client)
|
||||
packed_items = player_client.prefs.equip_preference_loadout(equipping, FALSE, job,initial=TRUE)
|
||||
if(packed_items)
|
||||
player_client.prefs.add_packed_items(equipping, packed_items)
|
||||
//SKYRAT CHANGE ADDITION END
|
||||
|
||||
/datum/controller/subsystem/job/proc/handle_auto_deadmin_roles(client/C, rank)
|
||||
if(!C?.holder)
|
||||
return TRUE
|
||||
|
||||
@@ -378,7 +378,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
||||
var/pmv = CONFIG_GET(flag/preference_map_voting)
|
||||
if(pmv)
|
||||
for (var/client/c in GLOB.clients)
|
||||
var/vote = c.prefs.preferred_map
|
||||
var/vote = c.prefs.read_preference(/datum/preference/choiced/preferred_map)
|
||||
if (!vote)
|
||||
if (global.config.defaultmap)
|
||||
mapvotes[global.config.defaultmap.map_name] += 1
|
||||
|
||||
@@ -21,8 +21,6 @@ SUBSYSTEM_DEF(persistence)
|
||||
var/list/picture_logging_information = list()
|
||||
var/list/obj/structure/sign/picture_frame/photo_frames
|
||||
var/list/obj/item/storage/photo_album/photo_albums
|
||||
var/list/obj/structure/sign/painting/painting_frames = list()
|
||||
var/list/paintings = list()
|
||||
|
||||
|
||||
/datum/controller/subsystem/persistence/Initialize()
|
||||
@@ -33,7 +31,6 @@ SUBSYSTEM_DEF(persistence)
|
||||
LoadRecentMaps()
|
||||
LoadPhotoPersistence()
|
||||
LoadRandomizedRecipes()
|
||||
LoadPaintings()
|
||||
LoadPanicBunker() //SKYRAT EDIT ADDITION - PANICBUNKER
|
||||
load_custom_outfits()
|
||||
|
||||
@@ -48,7 +45,6 @@ SUBSYSTEM_DEF(persistence)
|
||||
SavePhotoPersistence() //THIS IS PERSISTENCE, NOT THE LOGGING PORTION.
|
||||
SaveRandomizedRecipes()
|
||||
SavePanicBunker()//SKYRAT EDIT ADDITION - PANICBUNKER
|
||||
SavePaintings()
|
||||
SaveScars()
|
||||
save_custom_outfits()
|
||||
|
||||
@@ -413,22 +409,6 @@ SUBSYSTEM_DEF(persistence)
|
||||
fdel(json_file)
|
||||
WRITE_FILE(json_file, json_encode(file_data))
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/LoadPaintings()
|
||||
var/json_file = file("data/paintings.json")
|
||||
if(fexists(json_file))
|
||||
paintings = json_decode(file2text(json_file))
|
||||
|
||||
for(var/obj/structure/sign/painting/P in painting_frames)
|
||||
P.load_persistent()
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/SavePaintings()
|
||||
for(var/obj/structure/sign/painting/P in painting_frames)
|
||||
P.save_persistent()
|
||||
|
||||
var/json_file = file("data/paintings.json")
|
||||
fdel(json_file)
|
||||
WRITE_FILE(json_file, json_encode(paintings))
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/SaveScars()
|
||||
for(var/i in GLOB.joined_player_list)
|
||||
var/mob/living/carbon/human/ending_human = get_mob_by_ckey(i)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
SUBSYSTEM_DEF(persistent_paintings)
|
||||
name = "Persistent Paintings"
|
||||
init_order = INIT_ORDER_PERSISTENT_PAINTINGS
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
/// A list of painting frames that this controls
|
||||
var/list/obj/structure/sign/painting/painting_frames = list()
|
||||
|
||||
/// A map of identifiers (such as library) to paintings from paintings.json
|
||||
var/list/paintings = list()
|
||||
|
||||
/datum/controller/subsystem/persistent_paintings/Initialize(start_timeofday)
|
||||
var/json_file = file("data/paintings.json")
|
||||
if(fexists(json_file))
|
||||
paintings = json_decode(file2text(json_file))
|
||||
|
||||
for(var/obj/structure/sign/painting/painting_frame as anything in painting_frames)
|
||||
painting_frame.load_persistent()
|
||||
|
||||
return ..()
|
||||
|
||||
/// Saves all persistent paintings
|
||||
/datum/controller/subsystem/persistent_paintings/proc/save_paintings()
|
||||
for(var/obj/structure/sign/painting/painting_frame as anything in painting_frames)
|
||||
painting_frame.save_persistent()
|
||||
|
||||
var/json_file = file("data/paintings.json")
|
||||
fdel(json_file)
|
||||
WRITE_FILE(json_file, json_encode(paintings))
|
||||
@@ -69,21 +69,6 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
var/datum/quirk/wayfinder = /datum/quirk/item_quirk/needswayfinder
|
||||
if(user.add_quirk(wayfinder))
|
||||
SSblackbox.record_feedback("nested tally", "quirks_taken", 1, list(initial(wayfinder.name)))
|
||||
|
||||
|
||||
// SKYRAT EDIT ADDITION START - Customization (food prefs)
|
||||
// This was done in this proc on old skyrat and i cba to find a better way
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(istype(H))
|
||||
if(cli.prefs.foodlikes.len)
|
||||
H.dna.species.liked_food = 0
|
||||
for(var/V in cli.prefs.foodlikes)
|
||||
H.dna.species.liked_food |= cli.prefs.foodlikes[V]
|
||||
if(cli.prefs.fooddislikes.len)
|
||||
H.dna.species.disliked_food = 0
|
||||
for(var/V in cli.prefs.fooddislikes)
|
||||
H.dna.species.disliked_food |= cli.prefs.fooddislikes[V]
|
||||
// SKYRAT EDIT ADDITION END
|
||||
/*
|
||||
*Randomises the quirks for a specified mob
|
||||
*/
|
||||
@@ -147,5 +132,66 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
for(var/datum/quirk/quirk as anything in quirks_to_add)
|
||||
user.add_quirk(quirks[quirk]) //these are typepaths converted from string
|
||||
|
||||
/// Takes a list of quirk names and returns a new list of quirks that would
|
||||
/// be valid.
|
||||
/// If no changes need to be made, will return the same list.
|
||||
/// Expects all quirk names to be unique, but makes no other expectations.
|
||||
/datum/controller/subsystem/processing/quirks/proc/filter_invalid_quirks(list/quirks)
|
||||
var/list/new_quirks = list()
|
||||
var/list/positive_quirks = list()
|
||||
var/balance = 0
|
||||
|
||||
for (var/quirk_name in quirks)
|
||||
var/datum/quirk/quirk = SSquirks.quirks[quirk_name]
|
||||
if (isnull(quirk))
|
||||
continue
|
||||
|
||||
if (initial(quirk.mood_quirk) && CONFIG_GET(flag/disable_human_mood))
|
||||
continue
|
||||
|
||||
var/blacklisted = FALSE
|
||||
|
||||
for (var/list/blacklist as anything in quirk_blacklist)
|
||||
if (!(quirk in blacklist))
|
||||
continue
|
||||
|
||||
for (var/other_quirk in blacklist)
|
||||
if (other_quirk in new_quirks)
|
||||
blacklisted = TRUE
|
||||
break
|
||||
|
||||
if (blacklisted)
|
||||
break
|
||||
|
||||
if (blacklisted)
|
||||
continue
|
||||
|
||||
var/value = initial(quirk.value)
|
||||
if (value > 0)
|
||||
if (positive_quirks.len == MAX_QUIRKS)
|
||||
continue
|
||||
|
||||
positive_quirks[quirk_name] = value
|
||||
|
||||
balance += value
|
||||
new_quirks += quirk_name
|
||||
|
||||
if (balance > 0)
|
||||
var/balance_left_to_remove = balance
|
||||
|
||||
for (var/positive_quirk in positive_quirks)
|
||||
var/value = positive_quirks[positive_quirk]
|
||||
balance_left_to_remove -= value
|
||||
new_quirks -= positive_quirk
|
||||
|
||||
if (balance_left_to_remove <= 0)
|
||||
break
|
||||
|
||||
// It is guaranteed that if no quirks are invalid, you can simply check through `==`
|
||||
if (new_quirks.len == quirks.len)
|
||||
return quirks
|
||||
|
||||
return new_quirks
|
||||
|
||||
#undef RANDOM_QUIRK_BONUS
|
||||
#undef MINIMUM_RANDOM_QUIRKS
|
||||
|
||||
@@ -17,7 +17,6 @@ PROCESSING_SUBSYSTEM_DEF(reagents)
|
||||
///Blacklists these reagents from being added to the master list. the exact type only. Children are not blacklisted.
|
||||
GLOB.fake_reagent_blacklist = list(/datum/reagent/medicine/c2, /datum/reagent/medicine, /datum/reagent/reaction_agent)
|
||||
//Build GLOB lists - see holder.dm
|
||||
build_chemical_reagent_list()
|
||||
build_chemical_reactions_lists()
|
||||
return
|
||||
|
||||
|
||||
@@ -414,6 +414,12 @@ SUBSYSTEM_DEF(ticker)
|
||||
if(new_player_mob.client?.prefs?.should_be_random_hardcore(player_assigned_role, new_player_living.mind))
|
||||
new_player_mob.client.prefs.hardcore_random_setup(new_player_living)
|
||||
SSquirks.AssignQuirks(new_player_living, new_player_mob.client)
|
||||
|
||||
//SKYRAT EDIT ADDITION
|
||||
if(ishuman(new_player_living))
|
||||
for(var/datum/loadout_item/item as anything in loadout_list_to_datums(new_player_mob.client?.prefs?.loadout_list))
|
||||
item.post_equip_item(new_player_mob.client?.prefs, new_player_living)
|
||||
//SKYRAT EDIT END
|
||||
CHECK_TICK
|
||||
|
||||
if(captainless)
|
||||
@@ -437,7 +443,7 @@ SUBSYSTEM_DEF(ticker)
|
||||
officer_mobs += character
|
||||
|
||||
var/datum/client_interface/client = GET_CLIENT(new_player_mob)
|
||||
var/preference = client?.prefs?.prefered_security_department || SEC_DEPT_NONE
|
||||
var/preference = client?.prefs?.read_preference(/datum/preference/choiced/security_department)
|
||||
officer_preferences += preference
|
||||
|
||||
var/distribution = get_officer_departments(officer_preferences, departments)
|
||||
@@ -483,7 +489,7 @@ SUBSYSTEM_DEF(ticker)
|
||||
m = pick(memetips)
|
||||
|
||||
if(m)
|
||||
to_chat(world, span_purple("<span class='oocplain'><b>Tip of the round: </b>[html_encode(m)]</span>"))
|
||||
to_chat(world, span_purple(examine_block("<span class='oocplain'><b>Tip of the round: </b>[html_encode(m)]</span>"))) //SKYRAT EDIT CHAGNE
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/check_queue()
|
||||
if(!queued_players.len)
|
||||
|
||||
@@ -64,7 +64,7 @@ SUBSYSTEM_DEF(vote)
|
||||
else if(mode == "map")
|
||||
for (var/non_voter_ckey in non_voters)
|
||||
var/client/C = non_voters[non_voter_ckey]
|
||||
var/preferred_map = C.prefs.preferred_map
|
||||
var/preferred_map = C.prefs.read_preference(/datum/preference/choiced/preferred_map)
|
||||
if(isnull(global.config.defaultmap))
|
||||
continue
|
||||
if(!preferred_map)
|
||||
|
||||
Reference in New Issue
Block a user