Mice: Resting and squeaking (#598)

A PR for mice
Adds a resting animation, several new audio files, verbs to use them, and a variety of audio changes.
Also fixes a bug where speech_chance was set to zero while sleeping, but not set back when the mouse wakes up
This commit is contained in:
NanakoAC
2016-08-02 23:26:26 +03:00
committed by skull132
parent 59233807ee
commit 73cc47a04c
8 changed files with 112 additions and 5 deletions
@@ -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 << "<span class='warning'>You are too small to pull anything.</span>"
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
/*
@@ -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)