diff --git a/code/datums/ai/basic_mobs/basic_subtrees/speech_subtree.dm b/code/datums/ai/basic_mobs/basic_subtrees/speech_subtree.dm index bdb96ea4cf4..b3b7bd09d0a 100644 --- a/code/datums/ai/basic_mobs/basic_subtrees/speech_subtree.dm +++ b/code/datums/ai/basic_mobs/basic_subtrees/speech_subtree.dm @@ -7,11 +7,15 @@ var/list/emote_see = list() ///Possible lines of speech the AI can have var/list/speak = list() + ///The sound effects associated with this speech, if any + var/list/sound = list() /datum/ai_planning_subtree/random_speech/New() . = ..() if(speak) speak = string_list(speak) + if(sound) + sound = string_list(sound) if(emote_hear) emote_hear = string_list(emote_hear) if(emote_see) @@ -32,7 +36,7 @@ else if(random_number_in_range <= (audible_emotes_length + non_audible_emotes_length)) controller.queue_behavior(/datum/ai_behavior/perform_emote, pick(emote_see)) else - controller.queue_behavior(/datum/ai_behavior/perform_speech, pick(speak)) + controller.queue_behavior(/datum/ai_behavior/perform_speech, pick(speak), length(sound) > 0 ? pick(sound) : null) /datum/ai_planning_subtree/random_speech/insect speech_chance = 5 @@ -55,6 +59,7 @@ /datum/ai_planning_subtree/random_speech/sheep speech_chance = 5 speak = list("baaa","baaaAAAAAH!","baaah") + sound = list('sound/creatures/sheep1.ogg', 'sound/creatures/sheep2.ogg', 'sound/creatures/sheep3.ogg') emote_hear = list("bleats.") emote_see = list("shakes her head.", "stares into the distance.") @@ -83,6 +88,7 @@ /datum/ai_planning_subtree/random_speech/cow speech_chance = 1 speak = list("moo?","moo","MOOOOOO") + sound = list('sound/creatures/cow.ogg') emote_hear = list("brays.") emote_see = list("shakes her head.") @@ -93,6 +99,7 @@ /datum/ai_planning_subtree/random_speech/cow/wisdom/New() . = ..() speak = GLOB.wisdoms //Done here so it's setup properly + sound = list() /datum/ai_planning_subtree/random_speech/dog speech_chance = 1 @@ -120,3 +127,10 @@ /datum/ai_planning_subtree/random_speech/tree speech_chance = 3 emote_see = list("photosynthesizes angirly.") + +/datum/ai_planning_subtree/random_speech/pig + speech_chance = 3 + speak = list("oink?","oink","snurf") + sound = list('sound/creatures/pig1.ogg', 'sound/creatures/pig2.ogg') + emote_hear = list("snorts.") + emote_see = list("sniffs around.") diff --git a/code/datums/ai/generic/generic_behaviors.dm b/code/datums/ai/generic/generic_behaviors.dm index 9934a5c0a6c..ac2846ef684 100644 --- a/code/datums/ai/generic/generic_behaviors.dm +++ b/code/datums/ai/generic/generic_behaviors.dm @@ -300,11 +300,13 @@ /datum/ai_behavior/perform_speech -/datum/ai_behavior/perform_speech/perform(seconds_per_tick, datum/ai_controller/controller, speech) +/datum/ai_behavior/perform_speech/perform(seconds_per_tick, datum/ai_controller/controller, speech, speech_sound) var/mob/living/living_pawn = controller.pawn if(!istype(living_pawn)) return living_pawn.say(speech, forced = "AI Controller") + if(speech_sound) + playsound(living_pawn, speech_sound, 80, vary = TRUE) finish_action(controller, TRUE) //song behaviors diff --git a/code/modules/mob/living/basic/farm_animals/pig.dm b/code/modules/mob/living/basic/farm_animals/pig.dm index abe5b9c3a74..46655e50341 100644 --- a/code/modules/mob/living/basic/farm_animals/pig.dm +++ b/code/modules/mob/living/basic/farm_animals/pig.dm @@ -59,4 +59,5 @@ /datum/ai_planning_subtree/flee_target, /datum/ai_planning_subtree/target_retaliate, /datum/ai_planning_subtree/basic_melee_attack_subtree, + /datum/ai_planning_subtree/random_speech/pig, ) diff --git a/sound/creatures/attribution.txt b/sound/creatures/attribution.txt new file mode 100644 index 00000000000..1d2d543aa15 --- /dev/null +++ b/sound/creatures/attribution.txt @@ -0,0 +1,8 @@ +cow.ogg sound adapted from Benboncan on Freesound +https://freesound.org/people/Benboncan/sounds/58277/ + +pig1.ogg and pig2.ogg adapted from Jofae on Freesound +https://freesound.org/people/Jofae/sounds/352698/ + +sheep1, sheep2, and sheep3.ogg adapted from milkotz on Freesound +https://freesound.org/people/milkotz/sounds/618865/ \ No newline at end of file diff --git a/sound/creatures/cow.ogg b/sound/creatures/cow.ogg new file mode 100644 index 00000000000..c3143c8dd44 Binary files /dev/null and b/sound/creatures/cow.ogg differ diff --git a/sound/creatures/pig1.ogg b/sound/creatures/pig1.ogg new file mode 100644 index 00000000000..470be7a86d3 Binary files /dev/null and b/sound/creatures/pig1.ogg differ diff --git a/sound/creatures/pig2.ogg b/sound/creatures/pig2.ogg new file mode 100644 index 00000000000..597a13464fb Binary files /dev/null and b/sound/creatures/pig2.ogg differ diff --git a/sound/creatures/sheep1.ogg b/sound/creatures/sheep1.ogg new file mode 100644 index 00000000000..33c1041086e Binary files /dev/null and b/sound/creatures/sheep1.ogg differ diff --git a/sound/creatures/sheep2.ogg b/sound/creatures/sheep2.ogg new file mode 100644 index 00000000000..eed7d6aadbd Binary files /dev/null and b/sound/creatures/sheep2.ogg differ diff --git a/sound/creatures/sheep3.ogg b/sound/creatures/sheep3.ogg new file mode 100644 index 00000000000..7a596e088da Binary files /dev/null and b/sound/creatures/sheep3.ogg differ