[MIRROR] Fix random names breaking preferences [MDB IGNORE] (#9370)

* Fix random names breaking preferences (#62668)

The randomization (specifically from the random names secret) overrode your preferences, this fixes that.

* Fix random names breaking preferences

* Should fix the issue with that damn unit test.

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
SkyratBot
2021-11-23 13:36:22 -05:00
committed by GitHub
co-authored by Mothblocks Useroth GoldenAlpharex
parent d5d8269ba6
commit 6ac6dae856
6 changed files with 33 additions and 8 deletions
+1
View File
@@ -45,6 +45,7 @@
#include "achievements.dm"
#include "anchored_mobs.dm"
#include "anonymous_themes.dm"
#include "bespoke_id.dm"
#include "binary_insert.dm"
#include "bloody_footprints.dm"
@@ -0,0 +1,23 @@
/// Ensure that anonymous themes works without changing your preferences
/datum/unit_test/anonymous_themes
/datum/unit_test/anonymous_themes/Run()
GLOB.current_anonymous_theme = new /datum/anonymous_theme
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/datum/client_interface/client = new
human.mock_client = client
client.prefs = new
client.prefs.write_preference(GLOB.preference_entries[/datum/preference/name/real_name], "Prefs Biddle")
human.apply_prefs_job(client, SSjob.GetJobType(/datum/job/assistant))
TEST_ASSERT_NOTEQUAL(human.real_name, "Prefs Biddle", "apply_prefs_job didn't randomize human name with an anonymous theme")
TEST_ASSERT_EQUAL(client.prefs.read_preference(/datum/preference/name/real_name), "Prefs Biddle", "Anonymous theme overrode original prefs")
/datum/unit_test/anonymous_themes/Destroy()
QDEL_NULL(GLOB.current_anonymous_theme)
return ..()