[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:
SkyratBot
2021-09-23 01:40:37 +02:00
committed by GitHub
parent a5bfc42228
commit 124ddd7cca
582 changed files with 19548 additions and 8366 deletions
+2
View File
@@ -75,7 +75,9 @@
#include "outfit_sanity.dm"
#include "pills.dm"
#include "plantgrowth_tests.dm"
#include "preferences.dm"
#include "projectiles.dm"
#include "quirks.dm"
#include "rcd.dm"
#include "reagent_id_typos.dm"
#include "reagent_mod_expose.dm"
@@ -12,3 +12,25 @@
Fail("[ruleset] has a scaling_cost, but is also a lone/highlander ruleset.")
else if (!has_scaling_cost && !is_lone)
Fail("[ruleset] has no scaling cost, but is also not a lone/highlander ruleset.")
/// Verifies that dynamic rulesets have unique antag_flag.
/datum/unit_test/dynamic_unique_antag_flags
/datum/unit_test/dynamic_unique_antag_flags/Run()
var/list/known_antag_flags = list()
for (var/datum/dynamic_ruleset/ruleset as anything in subtypesof(/datum/dynamic_ruleset))
if (isnull(initial(ruleset.antag_datum)))
continue
var/antag_flag = initial(ruleset.antag_flag)
if (isnull(antag_flag))
Fail("[ruleset] has a null antag_flag!")
continue
if (antag_flag in known_antag_flags)
Fail("[ruleset] has a non-unique antag_flag [antag_flag] (used by [known_antag_flags[antag_flag]])!")
continue
known_antag_flags[antag_flag] = ruleset
+51
View File
@@ -0,0 +1,51 @@
/// Requires all preferences to implement required methods.
/datum/unit_test/preferences_implement_everything
/datum/unit_test/preferences_implement_everything/Run()
var/datum/preferences/preferences = new
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
for (var/preference_type in GLOB.preference_entries)
var/datum/preference/preference = GLOB.preference_entries[preference_type]
if (preference.savefile_identifier == PREFERENCE_CHARACTER)
preference.apply_to_human(human, preference.create_informed_default_value(preferences))
if (istype(preference, /datum/preference/choiced))
var/datum/preference/choiced/choiced_preference = preference
choiced_preference.init_possible_values()
// Smoke-test is_valid
preference.is_valid(TRUE)
preference.is_valid("string")
preference.is_valid(100)
preference.is_valid(list(1, 2, 3))
/// Requires all preferences to have a valid, unique savefile_identifier.
/datum/unit_test/preferences_valid_savefile_key
/datum/unit_test/preferences_valid_savefile_key/Run()
var/list/known_savefile_keys = list()
for (var/preference_type in GLOB.preference_entries)
var/datum/preference/preference = GLOB.preference_entries[preference_type]
if (!istext(preference.savefile_key))
Fail("[preference_type] has an invalid savefile_key.")
if (preference.savefile_key in known_savefile_keys)
Fail("[preference_type] has a non-unique savefile_key `[preference.savefile_key]`!")
known_savefile_keys += preference.savefile_key
/// Requires all main features have a main_feature_name
/datum/unit_test/preferences_valid_main_feature_name
/datum/unit_test/preferences_valid_main_feature_name/Run()
for (var/preference_type in GLOB.preference_entries)
var/datum/preference/choiced/preference = GLOB.preference_entries[preference_type]
if (!istype(preference))
continue
if (preference.category != PREFERENCE_CATEGORY_FEATURES && preference.category != PREFERENCE_CATEGORY_CLOTHING)
continue
TEST_ASSERT(!isnull(preference.main_feature_name), "Preference [preference_type] does not have a main_feature_name set!")
+21
View File
@@ -0,0 +1,21 @@
/// Ensure every quirk has a unique icon
/datum/unit_test/quirk_icons
/datum/unit_test/quirk_icons/Run()
var/list/used_icons = list()
for (var/datum/quirk/quirk_type as anything in subtypesof(/datum/quirk))
if (initial(quirk_type.abstract_parent_type) == quirk_type)
continue
var/icon = initial(quirk_type.icon)
if (isnull(icon))
Fail("[quirk_type] has no icon!")
continue
if (icon in used_icons)
Fail("[icon] used in both [quirk_type] and [used_icons[icon]]!")
continue
used_icons[icon] = quirk_type
@@ -4,7 +4,6 @@
/datum/unit_test/reagent_id_typos/Run()
build_chemical_reactions_lists()
build_chemical_reagent_list()
for(var/I in GLOB.chemical_reactions_list_reactant_index)
for(var/V in GLOB.chemical_reactions_list_reactant_index[I])
@@ -1,4 +1,10 @@
#define SECURITY_OFFICER_DEPARTMENTS list("a", "b", "c", "d")
#define SECURITY_OFFICER_DEPARTMENTS_TO_NAMES (list( \
"a" = SEC_DEPT_ENGINEERING, \
"b" = SEC_DEPT_MEDICAL, \
"c" = SEC_DEPT_SCIENCE, \
"d" = SEC_DEPT_SUPPLY, \
))
/// Test that security officers with specific distributions get their departments.
/datum/unit_test/security_officer_roundstart_distribution
@@ -45,17 +51,22 @@
SECURITY_OFFICER_DEPARTMENTS,
)
TEST_ASSERT_EQUAL(outcome[REF(officer_a.new_character)], "a", "Officer A's department outcome was incorrect.")
TEST_ASSERT_EQUAL(outcome[REF(officer_b.new_character)], "b", "Officer B's department outcome was incorrect.")
TEST_ASSERT_EQUAL(outcome[REF(officer_c.new_character)], "b", "Officer C's department outcome was incorrect.")
TEST_ASSERT_EQUAL(outcome[REF(officer_d.new_character)], "a", "Officer D's department outcome was incorrect.")
TEST_ASSERT_EQUAL(outcome[REF(officer_a.new_character)], SECURITY_OFFICER_DEPARTMENTS_TO_NAMES["a"], "Officer A's department outcome was incorrect.")
TEST_ASSERT_EQUAL(outcome[REF(officer_b.new_character)], SECURITY_OFFICER_DEPARTMENTS_TO_NAMES["b"], "Officer B's department outcome was incorrect.")
TEST_ASSERT_EQUAL(outcome[REF(officer_c.new_character)], SECURITY_OFFICER_DEPARTMENTS_TO_NAMES["b"], "Officer C's department outcome was incorrect.")
TEST_ASSERT_EQUAL(outcome[REF(officer_d.new_character)], SECURITY_OFFICER_DEPARTMENTS_TO_NAMES["a"], "Officer D's department outcome was incorrect.")
/datum/unit_test/security_officer_roundstart_distribution/proc/create_officer(preference)
var/mob/dead/new_player/new_player = allocate(/mob/dead/new_player)
var/datum/client_interface/mock_client = new
mock_client.prefs = new
mock_client.prefs.prefered_security_department = preference
var/write_success = mock_client.prefs.write_preference(
GLOB.preference_entries[/datum/preference/choiced/security_department],
SECURITY_OFFICER_DEPARTMENTS_TO_NAMES[preference],
)
TEST_ASSERT(write_success, "Couldn't write department [SECURITY_OFFICER_DEPARTMENTS_TO_NAMES[preference]]")
var/mob/living/carbon/human/new_character = allocate(/mob/living/carbon/human)
new_character.mind_initialize()