diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index c8cf8373e36..79644683b62 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -9,9 +9,15 @@ speak_emote = list("squeeks","squeeks","squiks") emote_hear = list("squeeks","squeaks","squiks") emote_see = list("runs in a circle", "shakes", "scritches at something") + var/soft_squeaks = list('sound/effects/creatures/mouse_squeaks_1.ogg', + 'sound/effects/creatures/mouse_squeaks_2.ogg', + 'sound/effects/creatures/mouse_squeaks_3.ogg', + 'sound/effects/creatures/mouse_squeaks_4.ogg') + var/last_softsqueak = null//Used to prevent the same soft squeak twice in a row + pass_flags = PASSTABLE small = 1 - speak_chance = 1 + speak_chance = 4 turns_per_move = 5 see_in_dark = 6 maxHealth = 5 @@ -34,9 +40,10 @@ /mob/living/simple_animal/mouse/Life() ..() - if(!stat && prob(speak_chance)) - for(var/mob/M in view()) - M << 'sound/effects/mousesqueek.ogg' + //Player-animals don't do random speech normally, so this is here + //Player-controlled mice will still squeak, but less often than NPC mice + if(client && stat == CONSCIOUS && prob(speak_chance*0.4)) + squeak_soft() if(!ckey && stat == CONSCIOUS && prob(0.5)) stat = UNCONSCIOUS @@ -49,6 +56,7 @@ stat = CONSCIOUS icon_state = "mouse_[body_color]" wander = 1 + speak_chance = initial(speak_chance) else if(prob(5)) audible_emote("snuffles.") @@ -75,6 +83,12 @@ if (body_color == "white") holder_type = /obj/item/weapon/holder/mouse/white + verbs += /mob/living/simple_animal/mouse/proc/squeak + verbs += /mob/living/simple_animal/mouse/proc/squeak_soft + verbs += /mob/living/simple_animal/mouse/proc/squeak_loud + +/mob/living/simple_animal/mouse/speak_audio() + squeak_soft() @@ -98,12 +112,48 @@ src << "You are too small to pull anything." return + + +//Plays a sound. +//This is triggered when a mob steps on an NPC mouse, or manually by a playermouse +/mob/living/simple_animal/mouse/proc/squeak() + set name = "Squeak" + set category = "Abilities" + playsound(src, 'sound/effects/mousesqueek.ogg', 90, 1) + + + + +//Plays a random selection of four sounds, at a low volume +//This is triggered randomly periodically by any mouse, or manually +/mob/living/simple_animal/mouse/proc/squeak_soft() + set name = "Soft Squeaking" + set category = "Abilities" + + var/list/new_squeaks = last_softsqueak ? soft_squeaks - last_softsqueak : soft_squeaks + var/sound = pick(new_squeaks) + + last_softsqueak = sound + playsound(src, sound, 15, 1) + + + +//Plays a loud sound +//Triggered manually, when a mouse dies, or rarely when its stepped on +/mob/living/simple_animal/mouse/proc/squeak_loud() + set name = "Squeal!" + set category = "Abilities" + playsound(src, 'sound/effects/creatures/mouse_squeak_loud.ogg', 100, 1) + /mob/living/simple_animal/mouse/Crossed(AM as mob|obj) if( ishuman(AM) ) if(!stat) var/mob/M = AM M << "\blue \icon[src] Squeek!" - M << 'sound/effects/mousesqueek.ogg' + if (prob(95)) + squeak() + else + squeak_loud()//You trod on its tail ..() /mob/living/simple_animal/mouse/MouseDrop(atom/over_object) @@ -119,10 +169,21 @@ /mob/living/simple_animal/mouse/death() layer = MOB_LAYER + squeak_loud()//deathgasp + if(client) client.time_died_as_mouse = world.time .=..() +/mob/living/simple_animal/mouse/lay_down() + set name = "Rest" + set category = "IC" + + resting = !resting + icon_state = resting ? "mouse_[body_color]_sleep" : "mouse_[body_color]" + src << "\blue You are now [resting ? "resting" : "getting up"]" + + canmove = !resting /* diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index f2b76e665cf..7ec641acf8a 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -179,6 +179,7 @@ visible_emote("[pick(emote_see)].") else audible_emote("[pick(emote_hear)].") + speak_audio() //Atmos @@ -280,6 +281,10 @@ if(act) ..(act, type, desc) +//This is called when an animal 'speaks'. It does nothing here, but descendants should override it to add audio +/mob/living/simple_animal/proc/speak_audio() + return + /mob/living/simple_animal/proc/visible_emote(var/act_desc) custom_emote(1, act_desc) diff --git a/html/changelogs/Nanako-Squeaks.yml b/html/changelogs/Nanako-Squeaks.yml new file mode 100644 index 00000000000..8674fb90990 --- /dev/null +++ b/html/changelogs/Nanako-Squeaks.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Nanako + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Mice now have a sprite for resting" + - soundadd: "Added a few squeak verbs for mice with new audio, based on samples recorded from real mice!" + - tweak: "Mice will now occasionally squeak, and squeak chance increased. Player-controlled mice will also automatically squeak but less often" + - tweak: "Mice will now squeal in pain when killed, and sometimes when stepped on" + - bugfix: "Fixed a bug where mice would permanantly stop squeaking after sleeping once" + \ No newline at end of file diff --git a/sound/effects/creatures/mouse_squeak_loud.ogg b/sound/effects/creatures/mouse_squeak_loud.ogg new file mode 100644 index 00000000000..60732123b1f Binary files /dev/null and b/sound/effects/creatures/mouse_squeak_loud.ogg differ diff --git a/sound/effects/creatures/mouse_squeaks_1.ogg b/sound/effects/creatures/mouse_squeaks_1.ogg new file mode 100644 index 00000000000..831ed0d3cd3 Binary files /dev/null and b/sound/effects/creatures/mouse_squeaks_1.ogg differ diff --git a/sound/effects/creatures/mouse_squeaks_2.ogg b/sound/effects/creatures/mouse_squeaks_2.ogg new file mode 100644 index 00000000000..4bf0b4af2f8 Binary files /dev/null and b/sound/effects/creatures/mouse_squeaks_2.ogg differ diff --git a/sound/effects/creatures/mouse_squeaks_3.ogg b/sound/effects/creatures/mouse_squeaks_3.ogg new file mode 100644 index 00000000000..31b55e9834f Binary files /dev/null and b/sound/effects/creatures/mouse_squeaks_3.ogg differ diff --git a/sound/effects/creatures/mouse_squeaks_4.ogg b/sound/effects/creatures/mouse_squeaks_4.ogg new file mode 100644 index 00000000000..72962b8f036 Binary files /dev/null and b/sound/effects/creatures/mouse_squeaks_4.ogg differ