Skip to content

Commit

Permalink
Farm Sounds DLC (basic mobs can make sounds when speaking) (tgstation…
Browse files Browse the repository at this point in the history
…#74906)

## About The Pull Request

https://user-images.githubusercontent.com/66640614/233747544-aac153b9-a100-486c-9a7a-4a436b8303b8.mov

Cows, pigs, and sheep make noise when their AI makes them speak. 
~~Also House Flipper Farm DLC came out but that's incidental.~~

## Why It's Good For The Game
It's funny, also more sound effects are fun. Gives basic mob creators
more customizability.

## Changelog
:cl: Tattle
qol: basicmobs can now make sounds when their speech is triggered
qol: pigs will now make sounds and emote on their own
sound: cows, pigs, and sheep have new sound effects!
/:cl:

---------

Co-authored-by: tattle <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
3 people authored Apr 22, 2023
1 parent 7d7d32b commit 4035064
Showing 10 changed files with 27 additions and 2 deletions.
16 changes: 15 additions & 1 deletion code/datums/ai/basic_mobs/basic_subtrees/speech_subtree.dm
Original file line number Diff line number Diff line change
@@ -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.")
4 changes: 3 additions & 1 deletion code/datums/ai/generic/generic_behaviors.dm
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions code/modules/mob/living/basic/farm_animals/pig.dm
Original file line number Diff line number Diff line change
@@ -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,
)
8 changes: 8 additions & 0 deletions sound/creatures/attribution.txt
Original file line number Diff line number Diff line change
@@ -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/
Binary file added sound/creatures/cow.ogg
Binary file not shown.
Binary file added sound/creatures/pig1.ogg
Binary file not shown.
Binary file added sound/creatures/pig2.ogg
Binary file not shown.
Binary file added sound/creatures/sheep1.ogg
Binary file not shown.
Binary file added sound/creatures/sheep2.ogg
Binary file not shown.
Binary file added sound/creatures/sheep3.ogg
Binary file not shown.

0 comments on commit 4035064

Please sign in to comment.