Update 1.0

Refactors lists into #defines, promptly cries. This part is agony and still worked on.

Simplemobs can play injury sounds as well, selecting a sound based off a global list.
Pain emotes occur based on updatehealth(), with respect to silicons and such.
Pain emotes also occur at a 60% chance on traumatic shock.
Simplemobs can also play death sounds based off the species sounds lists.
Add Mouse, Robotic, Spider, None as options to the voice list.
Fixes runtime/bug with Silicons (borgs) trying to get species var.
This commit is contained in:
Rykka Stormheart
2023-02-28 16:02:13 -08:00
parent 6a837244da
commit 2940d67c4d
53 changed files with 720 additions and 171 deletions

View File

@@ -62,8 +62,9 @@
pref.size_multiplier = initial(pref.size_multiplier)
if(!(pref.custom_speech_bubble in selectable_speech_bubbles))
pref.custom_speech_bubble = "default"
if(!(pref.species_sound)) // CHOMPEdit
pref.species_sound = "Unset" // CHOMPEdit
// var/datum/species/selected_species = GLOB.all_species[pref.species] // CHOMPEdit
if(!(pref.species_sound)) // CHOMPEdit // && selected_species.selects_bodytype
pref.species_sound = "Unset" // CHOMPEdit - otherwise, we leave this as null or w/e the default is
/datum/category_item/player_setup_item/vore/size/copy_to_mob(var/mob/living/carbon/human/character)
character.weight = pref.weight_vr
@@ -120,10 +121,10 @@
. += "<a href='?src=\ref[src];voice_test=1'><b>Test Selected Voice</b></a><br>"
. += "<b>Custom Speech Bubble:</b> <a href='?src=\ref[src];customize_speech_bubble=1'>[pref.custom_speech_bubble]</a><br>"
// CHOMPEdit Start: Pain/Scream/Death Custom Sounds
var/datum/species/selected_species = GLOB.all_species[pref.species]
if(selected_species.selects_bodytype)
. += "<br>"
. += "<b>Species Sounds:</b> <a href='?src=\ref[src];species_sound_options=1'>[pref.species_sound]</a><br>"
// var/datum/species/selected_species = GLOB.all_species[pref.species]
// if(selected_species.selects_bodytype)
. += "<br>"
. += "<b>Species Injury Sounds:</b> <a href='?src=\ref[src];species_sound_options=1'>[pref.species_sound]</a><br>"
. += "<a href='?src=\ref[src];scream_test=1'><b>Test Scream Sounds</b></a><br>"
. += "<a href='?src=\ref[src];pain_test=1'><b>Test Pain Sounds</b></a><br>"
. += "<a href='?src=\ref[src];gasp_test=1'><b>Test Gasp Sounds</b></a><br>"
@@ -273,26 +274,28 @@
return TOPIC_REFRESH // CHOMPEdit
// CHOMPEdit Start: Pain/Scream/Death sounds
else if(href_list["species_sound_options"]) // You shouldn't be able to see this option if you don't have the option to select a custom icon base, so we don't need to re-check for safety here.
var/list/possible_species_sound_types = list(
"Unset",
"Generic/Human",
"Canine",
"Feline",
"Cervine")
//"Vulpine") TBD! Need moar sounds. :3
var/list/possible_species_sound_types = species_sound_map
testing("Loading species sound types for selection.")
var/choice = tgui_input_list(usr, "Which set of sounds would you like to use for your character's pain, death, gasp, and scream sounds?", "Species Sounds", possible_species_sound_types)
if(!choice)
return TOPIC_REFRESH // No choice? Don't reset our selection
else
pref.species_sound = choice
testing("Setting species sound type to [choice].")
return TOPIC_REFRESH
else if(href_list["scream_test"])
var/datum/species/selected_species = GLOB.all_species[pref.species]
if(selected_species.selects_bodytype)
var/sound/S
// if(selected_species.selects_bodytype)
var/sound/S
testing("About to test our voice. User is [user]. Our chosen species sound is [pref.species_sound].")
testing("Species Sound map returns [get_species_sound(pref.species_sound)].")
testing("We are fetching a sound, and will get [pick(species_sound_map[pref.species_sound["scream"]])].")
S = sound(pick(species_sound_map[pref.species_sound["scream"]]))
//S = sound(pick(get_species_sound(pref.species_sound["scream"])))
/*
switch(pref.species_sound)
if("Canine")
S = sound(pick(canine_scream_sounds))
S = sound(pick(canine_sounds["scream"]))
if("Feline")
S = sound(pick(feline_scream_sounds))
if("Cervine")
@@ -303,38 +306,60 @@
else
S = sound(pick(male_generic_scream_sounds))
if("Unset")
var/datum/species/os = GLOB.all_species[pref.custom_base]
var/datum/species/os
if(!pref.custom_base) // Safety
os = selected_species
else
os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_scream_sound))
else
S = sound(pick(os.male_scream_sound))
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
if("Robotic")
S = sound(pick(robot_scream_sounds))
if("None" || null)
to_chat(user, "<span class='warning'>This set does not have scream sounds!</span>")
return TOPIC_REFRESH
*/
if(pref.species_sound == "Unset")
S = sound(pick(get_species_sound(coalesce(pref.species_sound, pref.custom_base, pref.species))["scream"]))
if(pref.species_sound == "None" || pref.species_sound["scream"] == null || S == null)
to_chat(user, "<span class='warning'>This set does not have scream sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
/*
else
var/sound/S
var/datum/species/os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_scream_sound))
S = sound(pick(selected_species.female_scream_sound))
else
S = sound(pick(os.male_scream_sound))
S = sound(pick(selected_species.male_scream_sound))
if(S == null)
to_chat(user, "<span class='warning'>This species does not have scream sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
*/
else if(href_list["pain_test"])
var/datum/species/selected_species = GLOB.all_species[pref.species]
if(selected_species.selects_bodytype)
var/sound/S
//if(selected_species.selects_bodytype)
var/sound/S
S = sound(pick(species_sound_map[pref.species_sound["pain"]]))
//S = sound(pick(get_species_sound(pref.species_sound["pain"])))
/*
switch(pref.species_sound)
if("Canine")
S = sound(pick(canine_pain_sounds))
if("Feline")
S = sound(pick(feline_pain_sounds))
if("Cervine")
to_chat("<span class='warning'>This set does not have pain sounds!</span>")
to_chat(user, "<span class='warning'>This set does not have pain sounds!</span>")
return TOPIC_REFRESH
if("Generic/Human")
if(pref.identifying_gender == FEMALE)
@@ -342,37 +367,59 @@
else
S = sound(pick(male_generic_pain_sounds))
if("Unset")
var/datum/species/os = GLOB.all_species[pref.custom_base]
var/datum/species/os
if(!pref.custom_base) // Safety
os = selected_species
else
os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_pain_sound))
else
S = sound(pick(os.male_pain_sound))
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
if("Robotic")
S = sound(pick(robot_pain_sounds))
if("None" || null)
to_chat(user, "<span class='warning'>This set does not have pain sounds!</span>")
return TOPIC_REFRESH
*/
if(pref.species_sound == "Unset")
S = sound(pick(get_species_sound(coalesce(pref.species_sound, pref.custom_base, pref.species))["pain"]))
if(pref.species_sound == "None" || pref.species_sound["pain"] == null || S == null)
to_chat(user, "<span class='warning'>This set does not have pain sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
/*
else
var/sound/S
var/datum/species/os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_pain_sound))
S = sound(pick(selected_species.female_pain_sound))
else
S = sound(pick(os.male_pain_sound))
S = sound(pick(selected_species.male_pain_sound))
if(S == null)
to_chat(user, "<span class='warning'>This species does not have pain sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
*/
else if(href_list["gasp_test"])
var/datum/species/selected_species = GLOB.all_species[pref.species]
if(selected_species.selects_bodytype)
var/sound/S
// if(selected_species.selects_bodytype)
var/sound/S
S = sound(pick(species_sound_map[pref.species_sound["gasp"]]))
//S = sound(pick(get_species_sound(pref.species_sound["gasp"])))
/*
switch(pref.species_sound)
if("Canine")
S = sound(pick(canine_gasp_sounds))
if("Feline")
S = sound(pick(feline_gasp_sounds))
if("Cervine")
to_chat("<span class='warning'>This set does not have gasp sounds!</span>")
to_chat(user, "<span class='warning'>This set does not have gasp sounds!</span>")
return TOPIC_REFRESH
if("Generic/Human")
if(pref.identifying_gender == FEMALE)
@@ -380,30 +427,53 @@
else
S = sound(pick(male_generic_gasp_sounds))
if("Unset")
var/datum/species/os = GLOB.all_species[pref.custom_base]
var/datum/species/os
if(!pref.custom_base) // Safety
os = selected_species
else
os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_gasp_sound))
else
S = sound(pick(os.male_gasp_sound))
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
if("Robotic")
to_chat(user, "<span class='warning'>This set does not have gasp sounds!</span>")
return TOPIC_REFRESH
if("None" || null)
to_chat(user, "<span class='warning'>This set does not have gasp sounds!</span>")
return TOPIC_REFRESH
*/
if(pref.species_sound == "Unset")
S = sound(pick(get_species_sound(coalesce(pref.species_sound, pref.custom_base, pref.species))["gasp"]))
if(pref.species_sound == "None" || pref.species_sound["gasp"] == null || S == null)
to_chat(user, "<span class='warning'>This set does not have gasp sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
/*
else
var/sound/S
var/datum/species/os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_gasp_sound))
S = sound(pick(selected_species.female_gasp_sound))
else
S = sound(pick(os.male_gasp_sound))
S = sound(pick(selected_species.male_gasp_sound))
if(S == null)
to_chat(user, "<span class='warning'>This species does not have gasp sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
*/
else if(href_list["death_test"])
var/datum/species/selected_species = GLOB.all_species[pref.species]
if(selected_species.selects_bodytype)
var/sound/S
// if(selected_species.selects_bodytype)
var/sound/S
S = sound(pick(species_sound_map[pref.species_sound["death"]]))
// S = sound(pick(get_species_sound(pref.species_sound["death"])))
/*
switch(pref.species_sound)
if("Canine")
S = sound(pick(canine_death_sounds))
@@ -417,25 +487,44 @@
else
S = sound(pick(male_generic_death_sounds))
if("Unset")
var/datum/species/os = GLOB.all_species[pref.custom_base]
var/datum/species/os
if(!pref.custom_base) // Safety
os = selected_species
else
os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_death_sound))
else
S = sound(pick(os.male_death_sound))
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
if("Robotic")
S = sound(pick(robot_death_sounds))
if("None" || null)
to_chat(user, "<span class='warning'>This set does not have death sounds!</span>")
return TOPIC_REFRESH
*/
if(pref.species_sound == "Unset")
S = sound(pick(get_species_sound(coalesce(pref.species_sound, pref.custom_base, pref.species))["death"]))
if(pref.species_sound == "None" || pref.species_sound["gasp"] == null || S == null)
to_chat(user, "<span class='warning'>This set does not have gasp sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
/*
else
var/sound/S
var/datum/species/os = GLOB.all_species[pref.custom_base]
if(pref.identifying_gender == FEMALE)
S = sound(pick(os.female_death_sound))
S = sound(pick(selected_species.female_death_sound))
else
S = sound(pick(os.male_death_sound))
S = sound(pick(selected_species.male_death_sound))
if(S == null)
to_chat(user, "<span class='warning'>This species does not have death sounds!</span>")
return TOPIC_REFRESH
S.frequency = pick(pref.voice_freq)
S.volume = 20
SEND_SOUND(user, S)
return TOPIC_REFRESH
*/
// CHOMPEdit End
return ..();

View File

@@ -257,8 +257,12 @@
//Any additional non-trait settings can be applied here
new_S.blood_color = pref.blood_color
if(pref.species_sound && new_S.selects_bodytype && pref.custom_base) // CHOMPEdit: Custom Scream/Death/Gasp/Pain Sounds. Don't try to do this if it doesn't exist, we aren't a custom species, and we don't have a custom base.
/*
if(pref.species_sound) // CHOMPEdit: Custom Scream/Death/Gasp/Pain Sounds. Don't try to do this if it doesn't exist. // && new_S.selects_bodytype && pref.custom_base) // we aren't a custom species, and we don't have a custom base.
new_S.copy_species_sounds(new_S, pref.species_sound, pref.custom_base) // CHOMPEdit: Custom Scream/Death/Gasp/Pain Sounds
*/
// CHOMPEdit: Custom Scream/Death/Gasp/Pain Sounds.
new_S.species_sounds = coalesce(pref.species_sound, pref.custom_base, pref.species)
if(pref.species == SPECIES_CUSTOM)
//Statistics for this would be nice