-
-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Quirk Customization: Take 2 (#10357)
* Adds Quirk Customization: Take 2 * Properly implement. I think.
- Loading branch information
Showing
19 changed files
with
267 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
code/modules/client/preferences/entries/character/quirks.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/datum/preference/choiced/quirk | ||
category = PREFERENCE_CATEGORY_NON_CONTEXTUAL | ||
preference_type = PREFERENCE_CHARACTER | ||
can_randomize = TRUE | ||
abstract_type = /datum/preference/choiced/quirk | ||
/// typepath of the quirk to be checked for (exact) | ||
var/required_quirk | ||
|
||
/datum/preference/choiced/quirk/deserialize(input, datum/preferences/preferences) | ||
// stupid, but if you have a better solution, then go ahead and write it | ||
var/input_path = text2path(input) | ||
if(ispath(input_path)) | ||
return ..(input_path, preferences) | ||
else | ||
return ..(input, preferences) | ||
|
||
/datum/preference/choiced/quirk/create_default_value() | ||
return "Random" | ||
|
||
/datum/preference/choiced/quirk/apply_to_human(mob/living/carbon/human/target, value) | ||
return | ||
|
||
/datum/preference/choiced/quirk/is_accessible(datum/preferences/preferences, ignore_page = FALSE) | ||
if (!..()) | ||
return FALSE | ||
var/datum/quirk/quirk = required_quirk | ||
if(initial(quirk.name) in preferences.all_quirks) | ||
return TRUE | ||
return FALSE | ||
|
||
/datum/preference/choiced/quirk/init_possible_values() | ||
return list("Random") |
14 changes: 14 additions & 0 deletions
14
code/modules/client/preferences/entries/character/quirks/alcoholic.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/datum/preference/choiced/quirk/alcohol_type | ||
db_key = "quirk_alcohol_type" | ||
required_quirk = /datum/quirk/alcoholic | ||
|
||
/datum/preference/choiced/quirk/alcohol_type/init_possible_values() | ||
return ..() + GLOB.alcoholic_bottles | ||
|
||
/datum/preference/choiced/quirk/alcohol_type/compile_constant_data() | ||
var/list/data = ..() | ||
var/list/clean_names = list("Random" = "Random") | ||
for(var/obj/item/reagent_containers/food/drinks/bottle/S as() in GLOB.alcoholic_bottles) | ||
clean_names[S] = initial(S.name) | ||
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = clean_names | ||
return data |
14 changes: 14 additions & 0 deletions
14
code/modules/client/preferences/entries/character/quirks/junkie.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/datum/preference/choiced/quirk/junkie_drug | ||
db_key = "quirk_junkie_drug" | ||
required_quirk = /datum/quirk/junkie | ||
|
||
/datum/preference/choiced/quirk/junkie_drug/init_possible_values() | ||
return ..() + GLOB.junkie_drugs | ||
|
||
/datum/preference/choiced/quirk/junkie_drug/compile_constant_data() | ||
var/list/data = ..() | ||
var/list/clean_names = list("Random" = "Random") | ||
for(var/datum/reagent/drug/D as() in GLOB.junkie_drugs) | ||
clean_names[D] = initial(D.name) | ||
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = clean_names | ||
return data |
16 changes: 16 additions & 0 deletions
16
code/modules/client/preferences/entries/character/quirks/multilingual.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/datum/preference/choiced/quirk/multilingual_language | ||
db_key = "quirk_multilingual_language" | ||
required_quirk = /datum/quirk/multilingual | ||
|
||
/datum/preference/choiced/quirk/multilingual_language/init_possible_values() | ||
return ..() + assoc_to_keys(GLOB.multilingual_language_list) | ||
|
||
/datum/preference/choiced/quirk/multilingual_language/compile_constant_data() | ||
var/list/data = ..() | ||
var/list/clean_names = list("Random" = "Random") | ||
for(var/datum/language/L as() in GLOB.multilingual_language_list) | ||
clean_names[L] = initial(L.name) | ||
|
||
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = clean_names | ||
|
||
return data |
6 changes: 6 additions & 0 deletions
6
code/modules/client/preferences/entries/character/quirks/phobia.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/datum/preference/choiced/quirk/phobia | ||
db_key = "quirk_phobia" | ||
required_quirk = /datum/quirk/trauma | ||
|
||
/datum/preference/choiced/quirk/phobia/init_possible_values() | ||
return ..() + assoc_to_keys(GLOB.available_random_trauma_list) |
19 changes: 19 additions & 0 deletions
19
code/modules/client/preferences/entries/character/quirks/prosthetic.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/datum/preference/choiced/quirk/prosthetic_limb_location | ||
db_key = "quirk_prosthetic_limb_location" | ||
required_quirk = /datum/quirk/prosthetic_limb | ||
|
||
/datum/preference/choiced/quirk/prosthetic_limb_location/init_possible_values() | ||
return ..() + list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) | ||
|
||
/datum/preference/choiced/quirk/prosthetic_limb_location/compile_constant_data() | ||
var/list/data = ..() | ||
|
||
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = list( | ||
"Random" = "Random", | ||
BODY_ZONE_L_ARM = "Left Arm", | ||
BODY_ZONE_R_ARM = "Right Arm", | ||
BODY_ZONE_L_LEG = "Left Leg", | ||
BODY_ZONE_R_LEG = "Right Leg", | ||
) | ||
|
||
return data |
16 changes: 16 additions & 0 deletions
16
code/modules/client/preferences/entries/character/quirks/smoker.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/datum/preference/choiced/quirk/smoker_cigarettes | ||
db_key = "quirk_smoker_cigarettes" | ||
required_quirk = /datum/quirk/junkie/smoker | ||
|
||
/datum/preference/choiced/quirk/smoker_cigarettes/init_possible_values() | ||
return ..() + GLOB.smoker_cigarettes | ||
|
||
/datum/preference/choiced/quirk/smoker_cigarettes/compile_constant_data() | ||
var/list/data = ..() | ||
var/list/clean_names = list("Random" = "Random") | ||
for(var/obj/item/storage/fancy/cigarettes/S as() in GLOB.smoker_cigarettes) | ||
clean_names[S] = initial(S.name) | ||
|
||
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = clean_names | ||
|
||
return data |
Oops, something went wrong.