From 996c483f890a0fd2fc4abf6980ac061cb66f5ce3 Mon Sep 17 00:00:00 2001 From: Runa Dacino Date: Thu, 26 Jan 2023 00:57:25 +0100 Subject: [PATCH] Adds ability to customize discomfort Both pre-made and custom species may now choose up to 10 messages each for warnings while overheated or cold. If there are no custom messages, game falls back to defaults (which, if the pre-baked species lacks fluff, uses human) There is a way to reset to defaults. It is possible to go back and edit any of the 10 messages. The editor shows you the previously set message with an option to cancel out (this avoids over-writing the previous message). --- code/game/dna/dna2.dm | 6 ++ code/game/dna/dna2_helpers.dm | 2 + .../client/preference_setup/vore/07_traits.dm | 91 +++++++++++++++++++ .../carbon/human/species/species_getters.dm | 12 ++- code/modules/mob/living/living_defines_vr.dm | 5 +- 5 files changed, 113 insertions(+), 3 deletions(-) diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index df62ad8ecf4..791524d221b 100644 --- a/code/game/dna/dna2.dm +++ b/code/game/dna/dna2.dm @@ -118,6 +118,8 @@ var/global/list/datum/dna/gene/dna_genes[0] var/custom_ask var/custom_whisper var/custom_exclaim + var/list/custom_heat = list() + var/list/custom_cold = list() // VOREStation // New stuff @@ -144,6 +146,8 @@ var/global/list/datum/dna/gene/dna_genes[0] new_dna.custom_ask=custom_ask //VOREStaton Edit new_dna.custom_whisper=custom_whisper //VOREStaton Edit new_dna.custom_exclaim=custom_exclaim //VOREStaton Edit + new_dna.custom_heat=custom_heat //VOREStation Edit + new_dna.custom_cold=custom_cold //VOREStation Edit var/list/body_markings_genetic = (body_markings - body_marking_nopersist_list) new_dna.body_markings=body_markings_genetic.Copy() for(var/b=1;b<=DNA_SE_LENGTH;b++) @@ -216,6 +220,8 @@ var/global/list/datum/dna/gene/dna_genes[0] src.custom_ask = character.custom_ask src.custom_whisper = character.custom_whisper src.custom_exclaim = character.custom_exclaim + src.custom_heat = character.custom_heat + src.custom_cold = character.custom_cold // +1 to account for the none-of-the-above possibility SetUIValueRange(DNA_UI_EAR_STYLE, ear_style + 1, ear_styles_list.len + 1, 1) diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index d5cdc700c73..9b57cd87e12 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -244,6 +244,8 @@ H.custom_whisper = dna.custom_whisper H.custom_exclaim = dna.custom_exclaim H.species.blood_color = dna.blood_color + H.custom_heat = dna.custom_heat + H.custom_cold = dna.custom_cold var/datum/species/S = H.species S.produceCopy(dna.species_traits, H, dna.base_species) // VOREStation Edit End diff --git a/code/modules/client/preference_setup/vore/07_traits.dm b/code/modules/client/preference_setup/vore/07_traits.dm index 5a9922dd4ff..e72b22a4096 100644 --- a/code/modules/client/preference_setup/vore/07_traits.dm +++ b/code/modules/client/preference_setup/vore/07_traits.dm @@ -15,6 +15,9 @@ var/custom_ask = null var/custom_exclaim = null + var/list/custom_heat = list() + var/list/custom_cold = list() + var/list/pos_traits = list() // What traits they've selected for their custom species var/list/neu_traits = list() var/list/neg_traits = list() @@ -47,6 +50,9 @@ S["custom_ask"] >> pref.custom_ask S["custom_exclaim"] >> pref.custom_exclaim + S["custom_heat"] >> pref.custom_heat + S["custom_cold"] >> pref.custom_cold + /datum/category_item/player_setup_item/vore/traits/save_character(var/savefile/S) S["custom_species"] << pref.custom_species S["custom_base"] << pref.custom_base @@ -64,6 +70,9 @@ S["custom_ask"] << pref.custom_ask S["custom_exclaim"] << pref.custom_exclaim + S["custom_heat"] << pref.custom_heat + S["custom_cold"] << pref.custom_cold + /datum/category_item/player_setup_item/vore/traits/sanitize_character() if(!pref.pos_traits) pref.pos_traits = list() if(!pref.neu_traits) pref.neu_traits = list() @@ -137,6 +146,9 @@ character.custom_ask = lowertext(trim(pref.custom_ask)) character.custom_whisper = lowertext(trim(pref.custom_whisper)) character.custom_exclaim = lowertext(trim(pref.custom_exclaim)) + character.custom_heat = pref.custom_heat + character.custom_cold = pref.custom_cold + if(character.isSynthetic()) //Checking if we have a synth on our hands, boys. pref.dirty_synth = 1 @@ -159,6 +171,8 @@ 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-"]
" @@ -223,6 +237,14 @@ . += "Set Exclaim Verb" . += "(Reset)" . += "
" + . += "Custom heat Discomfort: " + . += "Set Heat Messages" + . += "(Reset)" + . += "
" + . += "Custom Cold Discomfort: " + . += "Set Cold Messages" + . += "(Reset)" + . += "
" /datum/category_item/player_setup_item/vore/traits/OnTopic(var/href,var/list/href_list, var/mob/user) if(!CanUseTopic(user)) @@ -313,6 +335,63 @@ pref.custom_exclaim = exclaim_choice return TOPIC_REFRESH + else if(href_list["custom_heat"]) + var/numMessages = pref.custom_heat.len + if(numMessages > 0) + var/alert = tgui_alert(user, "Edit current messages or add a new one?","Selection",list("Edit","Add", "Cancel")) + switch(alert) + if("Edit") + var/list/indices = list() + var/i + for(i=1, i<= numMessages, i++) + indices.Add(i) + var/index = tgui_input_list(user,"Select a message to edit:","Select Message", indices) + var/new_message = sanitize(tgui_input_text(usr, "Currently editing : [pref.custom_heat[index]]","Heat Discomfort", null, 300), 300) + if(new_message) + pref.custom_heat[index] = new_message + if("Add") + if(numMessages >= 10) + tgui_alert_async(usr, "Can't add more messages!", "Error") + return TOPIC_REFRESH + else + var/new_message = sanitize(tgui_input_text(usr, "Adding a new heat discomfort message", "Heat Discomfort", null, 300), 300) + if(new_message) + pref.custom_heat.Add(new_message) + else + var/new_message = sanitize(tgui_input_text(usr, "Adding a custom heat discomfort message !!!Overrides defaults!!!", "Heat Discomfort", null, 300), 300) + if(new_message) + pref.custom_heat.Add(new_message) + return TOPIC_REFRESH + + else if(href_list["custom_cold"]) + var/numMessages = pref.custom_cold.len + if(numMessages > 0) + var/alert = tgui_alert(user, "Edit current messages or add a new one?","Selection",list("Edit","Add", "Cancel")) + switch(alert) + if("Edit") + var/list/indices = list() + var/i + for(i=1, i<= numMessages, i++) + indices.Add(i) + var/index = tgui_input_list(user,"Select a message to edit:","Select Message", indices) + var/new_message = sanitize(tgui_input_text(usr, "Currently editing : [pref.custom_cold[index]]", "Custom Cold Discomfort", null, 300), 300) + if(new_message) + pref.custom_cold[index] = new_message + if("Add") + if(numMessages >= 10) + tgui_alert_async(usr, "Can't add more messages!", "Error") + return TOPIC_REFRESH + else + var/new_message = sanitize(tgui_input_text(usr, "Adding a new cold discomfort message", "Cold Discomfort", null, 300), 300) + if(new_message) + pref.custom_cold.Add(new_message) + else + var/new_message = sanitize(tgui_input_text(usr, "Adding a custom cold discomfort message !!!Overrides Defaults!!!","Cold Discomfort", null, 300), 300) + if(new_message) + pref.custom_cold.Add(new_message) + 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") @@ -337,6 +416,18 @@ pref.custom_exclaim = null return TOPIC_REFRESH + else if(href_list["reset_cold"]) + var/cold_choice = tgui_alert(usr, "Reset your Custom Cold Discomfort messages?", "Reset Discomfort",list("Yes","No")) + if(cold_choice == "Yes") + pref.custom_cold = list() + return TOPIC_REFRESH + + else if(href_list["reset_heat"]) + var/heat_choice = tgui_alert(usr, "Reset your Custom Heat Discomfort messages?", "Reset Discomfort",list("Yes","No")) + if(heat_choice == "Yes") + pref.custom_heat = list() + return TOPIC_REFRESH + else if(href_list["add_trait"]) var/mode = text2num(href_list["add_trait"]) var/list/picklist diff --git a/code/modules/mob/living/carbon/human/species/species_getters.dm b/code/modules/mob/living/carbon/human/species/species_getters.dm index 27bb09baa6f..3d5faafcfab 100644 --- a/code/modules/mob/living/carbon/human/species/species_getters.dm +++ b/code/modules/mob/living/carbon/human/species/species_getters.dm @@ -90,10 +90,18 @@ */ var/discomfort_message + var/list/custom_cold = H.custom_cold + var/list/custom_heat = H.custom_heat if(msg_type == ENVIRONMENT_COMFORT_MARKER_COLD && length(cold_discomfort_strings) /*&& !covered*/) - discomfort_message = pick(cold_discomfort_strings) + if(custom_cold.len > 0) + discomfort_message = pick(custom_cold) + else + discomfort_message = pick(cold_discomfort_strings) else if(msg_type == ENVIRONMENT_COMFORT_MARKER_HOT && length(heat_discomfort_strings) /*&& covered*/) - discomfort_message = pick(heat_discomfort_strings) + if(custom_heat.len > 0) + discomfort_message = pick(custom_heat) + else + discomfort_message = pick(heat_discomfort_strings) if(discomfort_message && prob(5)) to_chat(H, SPAN_DANGER(discomfort_message)) diff --git a/code/modules/mob/living/living_defines_vr.dm b/code/modules/mob/living/living_defines_vr.dm index 06eeee7ac37..2a547811c2f 100644 --- a/code/modules/mob/living/living_defines_vr.dm +++ b/code/modules/mob/living/living_defines_vr.dm @@ -10,4 +10,7 @@ var/custom_say = null var/custom_ask = null var/custom_exclaim = null - var/custom_whisper = null \ No newline at end of file + var/custom_whisper = null +//custom temperature discomfort vars + var/list/custom_heat = list() + var/list/custom_cold = list()