Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: mouse idle animation #4097

Merged
merged 5 commits into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions code/modules/mob/living/simple_animal/friendly/mouse.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#define SNIFF 1
#define SHAKE 2
#define SCRATCH 3
#define WASHUP 4

/mob/living/simple_animal/mouse
name = "mouse"
real_name = "mouse"
@@ -42,6 +47,11 @@
can_collar = 1
gold_core_spawnable = FRIENDLY_SPAWN
var/chew_probability = 1
var/static/list/animated_mouses = list(
/mob/living/simple_animal/mouse,
/mob/living/simple_animal/mouse/brown,
/mob/living/simple_animal/mouse/gray,
/mob/living/simple_animal/mouse/white)

/mob/living/simple_animal/mouse/Initialize(mapload)
. = ..()
@@ -71,19 +81,41 @@
. = ..()
if(resting)
if(prob(1))
if(is_available_for_anim())
var/anim = pick(SNIFF, SCRATCH, SHAKE, WASHUP)
do_idle_animation(anim)
StopResting()
else if(prob(5))
custom_emote(EMOTE_AUDIBLE, "соп%(ит,ят)%.")
else if(prob(0.5))
StartResting()

/mob/living/simple_animal/mouse/proc/do_idle_animation(anim)
canmove = FALSE
flick("mouse_[mouse_color]_idle[anim]",src)
addtimer(CALLBACK(src, PROC_REF(animation_end)), 2 SECONDS)

/mob/living/simple_animal/mouse/proc/animation_end()
canmove = TRUE

/mob/living/simple_animal/mouse/proc/is_available_for_anim()
. = FALSE
if(is_type_in_list(src, animated_mouses, FALSE))
return TRUE

/mob/living/simple_animal/mouse/New()
..()
pixel_x = rand(-6, 6)
pixel_y = rand(0, 10)

color_pick()

if(is_available_for_anim())
verbs += /mob/living/simple_animal/mouse/proc/sniff
verbs += /mob/living/simple_animal/mouse/proc/shake
verbs += /mob/living/simple_animal/mouse/proc/scratch
verbs += /mob/living/simple_animal/mouse/proc/washup

/mob/living/simple_animal/mouse/proc/color_pick()
if(!mouse_color)
mouse_color = pick( list("brown","gray","white") )
@@ -163,6 +195,73 @@
remains.pixel_x = pixel_x
remains.pixel_y = pixel_y

/*
* Mouse animation emotes
*/

/mob/living/simple_animal/mouse/proc/sniff()
set name = "Понюхать"
set desc = "Пытаешься что-то почуять"
set category = "Мышь"

emote("msniff", intentional = TRUE)

/mob/living/simple_animal/mouse/proc/shake()
set name = "Дрожать"
set desc = "Дрожит или дрыгается"
set category = "Мышь"

emote("mshake", intentional = TRUE)

/mob/living/simple_animal/mouse/proc/scratch()
set name = "Почесаться"
set desc = "Чешется"
set category = "Мышь"

emote("mscratch", intentional = TRUE)

/mob/living/simple_animal/mouse/proc/washup()
set name = "Умыться"
set desc = "Умывается"
set category = "Мышь"

emote("mwashup", intentional = TRUE)

/datum/emote/living/simple_animal/mouse/idle
key = "msniff"
key_third_person = "msniffs"
message = "нюха%(ет,ют)%!"
emote_type = EMOTE_AUDIBLE
muzzled_noises = list("гортанные", "громкие")
cooldown = 1 MINUTES
audio_cooldown = 1 MINUTES
var/anim_type = SNIFF
volume = 1

/datum/emote/living/simple_animal/mouse/idle/run_emote(mob/living/simple_animal/mouse/user, params, type_override, intentional)
INVOKE_ASYNC(user, TYPE_PROC_REF(/mob/living/simple_animal/mouse, do_idle_animation), anim_type)
return ..()

/datum/emote/living/simple_animal/mouse/idle/get_sound(mob/living/simple_animal/mouse/user)
return user.squeak_sound

/datum/emote/living/simple_animal/mouse/idle/shake
key = "mshake"
key_third_person = "mshakes"
message = "дрож%(ит,ат)%!"
anim_type = SHAKE

/datum/emote/living/simple_animal/mouse/idle/scratch
key = "mscratch"
key_third_person = "mscratches"
message = "чеш%(ет,ут)%ся!"
anim_type = SCRATCH

/datum/emote/living/simple_animal/mouse/idle/washup
key = "mwashup"
key_third_person = "mwashesup"
message = "умыва%(ет,ют)%ся!"
anim_type = WASHUP

/*
* Mouse types
@@ -413,3 +512,8 @@ GLOBAL_VAR_INIT(hamster_count, 0)
death()
splat(user = AM)
..()

#undef SNIFF
#undef SHAKE
#undef SCRATCH
#undef WASHUP
Binary file modified icons/mob/animal.dmi
Binary file not shown.
Loading