diff --git a/code/modules/client/preference_setup/vore/07_traits.dm b/code/modules/client/preference_setup/vore/07_traits.dm index f36f94e22c..a98a276e39 100644 --- a/code/modules/client/preference_setup/vore/07_traits.dm +++ b/code/modules/client/preference_setup/vore/07_traits.dm @@ -42,6 +42,67 @@ choices = (choices | new_species) return choices +/datum/category_item/player_setup_item/vore/traits/proc/get_html_for_trait(var/datum/trait/trait, var/list/trait_prefs = null) + . = "" + if (!LAZYLEN(trait.has_preferences)) + return + . = "
" + if (altered) + switch(trait.category) + if (1) //TRAIT_TYPE_POSITIVE + pref.pos_traits[trait.type] = trait_prefs + if (0) //TRAIT_TYPE_NEUTRAL + pref.neu_traits[trait.type] = trait_prefs + if (-1)//TRAIT_TYPE_NEGATIVE + pref.neg_traits[trait.type] = trait_prefs + +/datum/category_item/player_setup_item/vore/traits/proc/get_pref_choice_from_trait(var/mob/user, var/datum/trait/trait, var/preference) + if (!trait || !preference) + return + var/list/trait_prefs + var/datum/trait/instance = all_traits[trait] + var/list/traitlist + switch(instance.category) + if (1) + traitlist = pref.pos_traits + if (0) + traitlist = pref.neu_traits + if (-1) + traitlist = pref.neg_traits + if (!LAZYLEN(instance.has_preferences) || !(preference in instance.has_preferences) || !traitlist) + return + if (!LAZYLEN(traitlist[trait])) + traitlist[trait] = instance.get_default_prefs() + trait_prefs = traitlist[trait] + if (!(preference in trait_prefs)) + trait_prefs[preference] = instance.default_value_for_pref(preference) //won't be called at all often + switch(instance.has_preferences[preference][1]) + if (1) //TRAIT_PREF_TYPE_BOOLEAN + trait_prefs[preference] = !trait_prefs[preference] + if (2) //TRAIT_PREF_TYPE_COLOR + var/new_color = input(user, "Choose the color for this trait preference:", "Trait Preference", trait_prefs[preference]) as color|null + if (new_color) + trait_prefs[preference] = new_color + // Definition of the stuff for Ears /datum/category_item/player_setup_item/vore/traits name = "Traits" @@ -167,7 +228,6 @@ else pref.custom_cold = list() - /datum/category_item/player_setup_item/vore/traits/copy_to_mob(var/mob/living/carbon/human/character) character.custom_species = pref.custom_species character.custom_say = lowertext(trim(pref.custom_say)) @@ -199,8 +259,6 @@ var/english_traits = english_list(new_S.traits, and_text = ";", comma_text = ";") log_game("TRAITS [pref.client_ckey]/([character]) with: [english_traits]") //Terrible 'fake' key_name()... but they aren't in the same entity yet - - /datum/category_item/player_setup_item/vore/traits/content(var/mob/user) . += "Custom Species Name: " . += "[pref.custom_species ? pref.custom_species : "-Input Name-"]
" @@ -227,21 +285,21 @@ . += "" . += "Neutral Trait +
" . += "" . += "Negative Trait +
" . += "" . += "Blood Color: " //People that want to use a certain species to have that species traits (xenochimera/promethean/spider) should be able to set their own blood color. @@ -331,6 +389,11 @@ instance.remove_pref(pref) return TOPIC_REFRESH + else if(href_list["clicked_trait_pref"]) + var/datum/trait/trait = text2path(href_list["clicked_trait_pref"]) + get_pref_choice_from_trait(user, trait, href_list["pref"]) + return TOPIC_REFRESH + else if(href_list["custom_say"]) var/say_choice = sanitize(tgui_input_text(usr, "This word or phrase will appear instead of 'says': [pref.real_name] says, \"Hi.\"", "Custom Say", pref.custom_say, 12), 12) if(say_choice) @@ -389,7 +452,6 @@ pref.custom_cold = raw_list return TOPIC_REFRESH - else if(href_list["reset_say"]) var/say_choice = tgui_alert(usr, "Reset your Custom Say Verb?","Reset Verb",list("Yes","No")) if(say_choice == "Yes") @@ -505,12 +567,10 @@ if(pref.dirty_synth && !(instance.can_take & SYNTHETICS)) tgui_alert_async(usr, "The trait you've selected can only be taken by organic characters!", "Error") - pref.dirty_synth = 0 //Just to be sure return TOPIC_REFRESH if(pref.gross_meatbag && !(instance.can_take & ORGANICS)) tgui_alert_async(usr, "The trait you've selected can only be taken by synthetic characters!", "Error") - pref.gross_meatbag = 0 //Just to be sure return TOPIC_REFRESH if(pref.species in instance.banned_species) @@ -546,7 +606,7 @@ return TOPIC_REFRESH instance.apply_pref(pref) - mylist += path + mylist[path] = instance.get_default_prefs() return TOPIC_REFRESH return ..() diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm index 6abec0e517..46a4b4c1d5 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm @@ -4,4 +4,11 @@ #define TRAIT_VARCHANGE_LESS_BETTER -1 #define TRAIT_VARCHANGE_ALWAYS_OVERRIDE 0 -#define TRAIT_VARCHANGE_MORE_BETTER 1 \ No newline at end of file +#define TRAIT_VARCHANGE_MORE_BETTER 1 + +#define TRAIT_PREF_TYPE_BOOLEAN 1 +#define TRAIT_PREF_TYPE_COLOR 2 + +#define TRAIT_NO_VAREDIT_TARGET 0 +#define TRAIT_VAREDIT_TARGET_SPECIES 1 +#define TRAIT_VAREDIT_TARGET_MOB 2 diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm index 61f1d7646a..025b4e283e 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral.dm @@ -195,6 +195,7 @@ cost = 0 custom_only = FALSE var_changes = list("has_glowing_eyes" = 1) + has_preferences = list("has_glowing_eyes" = list(TRAIT_PREF_TYPE_BOOLEAN, "Glowing on spawn", TRAIT_VAREDIT_TARGET_SPECIES)) /datum/trait/neutral/glowing_eyes/apply(var/datum/species/S,var/mob/living/carbon/human/H) ..(S,H) @@ -205,13 +206,14 @@ desc = "Your body glows about as much as a PDA light! Settable color and toggle in Abilities tab ingame." cost = 0 custom_only = FALSE + has_preferences = list("glow_toggle" = list(TRAIT_PREF_TYPE_BOOLEAN, "Glowing on spawn", TRAIT_VAREDIT_TARGET_MOB, FALSE), \ + "glow_color" = list(TRAIT_PREF_TYPE_COLOR, "Glow color", TRAIT_VAREDIT_TARGET_MOB)) -/datum/trait/neutral/glowing_body/apply(var/datum/species/S,var/mob/living/carbon/human/H) +/datum/trait/neutral/glowing_body/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/list/trait_prefs = null) ..(S,H) H.verbs |= /mob/living/proc/glow_toggle H.verbs |= /mob/living/proc/glow_color - //Allergen traits! Not available to any species with a base allergens var. /datum/trait/neutral/allergy name = "Allergy: Gluten" @@ -713,8 +715,8 @@ cost = 0 custom_only = FALSE can_take = SYNTHETICS + has_preferences = list("pain" = list(TRAIT_PREF_TYPE_BOOLEAN, "Enabled on spawn", TRAIT_VAREDIT_TARGET_MOB, FALSE)) - -/datum/trait/neutral/synth_cosmetic_pain/apply(var/datum/species/S,var/mob/living/carbon/human/H) +/datum/trait/neutral/synth_cosmetic_pain/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/trait_prefs = null) ..(S,H) H.verbs |= /mob/living/carbon/human/proc/toggle_pain_module diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/positive.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/positive.dm index c5355ac536..4bb31acc98 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/positive.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/positive.dm @@ -107,6 +107,7 @@ name = "Winged Flight" desc = "Allows you to fly by using your wings. Don't forget to bring them!" cost = 0 + has_preferences = list("flight_vore" = list(TRAIT_PREF_TYPE_BOOLEAN, "Flight Vore enabled on spawn", TRAIT_VAREDIT_TARGET_MOB, FALSE)) /datum/trait/positive/winged_flight/apply(var/datum/species/S,var/mob/living/carbon/human/H) ..(S,H) @@ -155,6 +156,8 @@ desc = "You can produce silk and create various articles of clothing and objects." cost = 2 var_changes = list("is_weaver" = 1) + has_preferences = list("silk_production" = list(TRAIT_PREF_TYPE_BOOLEAN, "Silk production on spawn", TRAIT_VAREDIT_TARGET_SPECIES), \ + "silk_color" = list(TRAIT_PREF_TYPE_COLOR, "Silk color", TRAIT_VAREDIT_TARGET_SPECIES)) /datum/trait/positive/weaver/apply(var/datum/species/S,var/mob/living/carbon/human/H) ..() diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm index 03e3966ff9..22d7a63416 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm @@ -13,15 +13,25 @@ var/list/allowed_species // VORESTATION EDIT:chomp port. A list of species that CAN take this trait, use this if only a few species can use it. -shark var/custom_only = TRUE // Trait only available for custom species var/varchange_type = TRAIT_VARCHANGE_ALWAYS_OVERRIDE //Mostly used for non-custom species. + var/has_preferences //if set, should be a list of the preferences for this trait in the format: list("identifier/name of var to edit" = list(typeofpref, "text to display in prefs", TRAIT_NO_VAREDIT_TARGET/TRAIT_VAREDIT_TARGET_SPECIES/etc, (optional: default value)), etc) typeofpref should follow the defines in _traits.dm (eg. TRAIT_PREF_TYPE_BOOLEAN) //Proc can be overridden lower to include special changes, make sure to call up though for the vars changes -/datum/trait/proc/apply(var/datum/species/S,var/mob/living/carbon/human/H) +/datum/trait/proc/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/trait_prefs = null) //VOREStation edit: trait_prefs is a list in the format: list(identifier = value, etc) ASSERT(S) if(var_changes) for(var/V in var_changes) if((category == TRAIT_TYPE_POSITIVE && ((varchange_type == TRAIT_VARCHANGE_LESS_BETTER && var_changes[V] > S.vars[V]) || (varchange_type == TRAIT_VARCHANGE_MORE_BETTER && var_changes[V] < S.vars[V]))) || (category == TRAIT_TYPE_NEGATIVE && ((varchange_type == TRAIT_VARCHANGE_LESS_BETTER && var_changes[V] < S.vars[V]) || (varchange_type == TRAIT_VARCHANGE_MORE_BETTER && var_changes[V] > S.vars[V])))) continue S.vars[V] = var_changes[V] + if (trait_prefs) + for (var/trait in trait_prefs) + switch(has_preferences[trait][3]) + if(TRAIT_NO_VAREDIT_TARGET) + continue + if(TRAIT_VAREDIT_TARGET_SPECIES) + S.vars[trait] = trait_prefs[trait] + if(TRAIT_VAREDIT_TARGET_MOB) + H.vars[trait] = trait_prefs[trait] return //Applying trait to preferences rather than just us. @@ -32,6 +42,8 @@ P.vars[V] = var_changes_pref[V] return +/datum/trait/proc/ + //Similar to the above, but for removing. Probably won't be called often/ever. /datum/trait/proc/remove(var/datum/species/S) ASSERT(S) @@ -44,3 +56,23 @@ for(var/V in var_changes_pref) P.vars[V] = initial(P.vars[V]) return + +//VOREStation edit: trait preferences +/datum/trait/proc/get_default_prefs() + if (!LAZYLEN(has_preferences)) + return null + var/prefs = list() + for (var/j in has_preferences) + var/default = default_value_for_pref(j) + prefs[j] = default + return prefs + +/datum/trait/proc/default_value_for_pref(var/pref) + if (length(has_preferences[pref]) > 3) //custom default + return has_preferences[pref][4] + switch(has_preferences[pref][1]) + if(TRAIT_PREF_TYPE_BOOLEAN) //boolean + return TRUE + if(TRAIT_PREF_TYPE_COLOR) //color + return "#ffffff" + return