mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
Implements a quirk spawn validity unit test and fixes a runtime preventing cyborg dogtag quirk from working roundstart (#89728)
## About The Pull Request Fixes a roundstart-exclusive runtime in the cyborg dogtag quirk, makes sure that spawning with a fishing toolbox (from a settler quirk) doesn't runtime and implements a unit test which ensures that all quirks set up correctly for ***both*** roundstart and latejoin mobs. The cyborg tag issue is just too stupid and may float up again, considering how easy it is to accidentally fetch owner's client instead of using the passed one. ## Changelog 🆑 fix: Cyborg pre-screening dogtags should once again be given to crew with the quirk of the same name. /🆑
This commit is contained in:
@@ -75,3 +75,36 @@
|
||||
if(!isnull(species_to_test[last_species]))
|
||||
TEST_ASSERT(!(species_to_test[last_species] in quirk.mail_goodies), \
|
||||
"Blood deficiency quirk did not update correctly for [species_type]! ([last_species] did not get its blood bag removed)")
|
||||
|
||||
/// Ensures that all quirks correctly initialized when added
|
||||
/datum/unit_test/quirk_validity
|
||||
|
||||
/datum/unit_test/quirk_validity/Run()
|
||||
// Required for language quirks to function properly
|
||||
// Assigning this manually as config is empty
|
||||
GLOB.uncommon_roundstart_languages = list(/datum/language/uncommon)
|
||||
|
||||
for (var/datum/quirk/quirk_type as anything in subtypesof(/datum/quirk))
|
||||
if (initial(quirk_type.abstract_parent_type) == quirk_type)
|
||||
continue
|
||||
|
||||
var/mob/dead/new_player/abstract_player = allocate(/mob/dead/new_player)
|
||||
var/datum/client_interface/roundstart_mock_client = new()
|
||||
abstract_player.mock_client = roundstart_mock_client
|
||||
roundstart_mock_client.prefs = new(roundstart_mock_client)
|
||||
var/mob/living/carbon/human/new_character = allocate(/mob/living/carbon/human/consistent)
|
||||
new_character.mind_initialize()
|
||||
abstract_player.new_character = new_character
|
||||
if (!new_character.add_quirk(quirk_type, roundstart_mock_client))
|
||||
TEST_FAIL("Failed to initialize quirk [quirk_type] on a roundstart character!")
|
||||
|
||||
var/mob/living/carbon/human/latejoin_character = allocate(/mob/living/carbon/human/consistent)
|
||||
var/datum/client_interface/latejoin_mock_client = new()
|
||||
latejoin_mock_client.prefs = new(latejoin_mock_client)
|
||||
latejoin_character.mock_client = latejoin_mock_client
|
||||
latejoin_character.mind_initialize()
|
||||
if (!latejoin_character.add_quirk(quirk_type, latejoin_mock_client))
|
||||
TEST_FAIL("Failed to initialize quirk [quirk_type] on a latejoin character!")
|
||||
|
||||
// Clean up after ourselves
|
||||
GLOB.uncommon_roundstart_languages.Cut()
|
||||
|
||||
Reference in New Issue
Block a user