Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions code/datums/emotes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var/sound //Sound to play when emote is called
var/vary = FALSE //used for the honk borg emote
var/only_forced_audio = FALSE //can only code call this event instead of the player.
var/cooldown = 0.4 SECONDS

/datum/emote/New()
if (ispath(mob_type_allowed_typecache))
Expand Down Expand Up @@ -75,6 +76,19 @@
else
user.visible_message(msg)

/// For handling emote cooldown, return true to allow the emote to happen
/datum/emote/proc/check_cooldown(mob/user, intentional, update=TRUE)
if(!intentional)
return TRUE
if(user.emotes_used && user.emotes_used[src] + cooldown > world.time)
return FALSE
if(!update)
return TRUE
if(!user.emotes_used)
Comment thread
Hopekz marked this conversation as resolved.
user.emotes_used = list()
user.emotes_used[src] = world.time
return TRUE

/datum/emote/proc/get_sound(mob/living/user)
return sound //by default just return this var.

Expand Down
14 changes: 11 additions & 3 deletions code/modules/mob/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,26 @@
if(!length(key_emotes))
if(intentional)
to_chat(src, "<span class='notice'>'[act]' emote does not exist. Say *help for a list.</span>")
return
return FALSE
var/silenced = FALSE
for(var/datum/emote/P in key_emotes)
if(!P.check_cooldown(src, intentional))
silenced = TRUE
continue
if(P.run_emote(src, param, m_type, intentional))
return
if(intentional)
return TRUE
if(intentional && !silenced)
to_chat(src, "<span class='notice'>Unusable emote '[act]'. Say *help for a list.</span>")
return FALSE


/datum/emote/flip
key = "flip"
key_third_person = "flips"
restraint_check = TRUE
mob_type_allowed_typecache = list(/mob/living, /mob/dead/observer)
mob_type_ignore_stat_typecache = list(/mob/dead/observer)
cooldown = 0 SECONDS

/datum/emote/flip/run_emote(mob/user, params , type_override, intentional)
. = ..()
Expand All @@ -38,6 +45,7 @@
restraint_check = TRUE
mob_type_allowed_typecache = list(/mob/living, /mob/dead/observer)
mob_type_ignore_stat_typecache = list(/mob/dead/observer)
cooldown = 0 SECONDS

/datum/emote/spin/run_emote(mob/user, params , type_override, intentional)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
message_monkey = "lets out a faint chimper as it collapses and stops moving..."
message_simple = "stops moving..."
stat_allowed = UNCONSCIOUS
cooldown = 3.4 SECONDS

/datum/emote/living/deathgasp/run_emote(mob/user, params, type_override, intentional)
var/mob/living/simple_animal/S = user
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@
var/registered_z

var/memory_amt = 0

var/list/emotes_used /// Used for tracking last uses of emotes for cooldown purposes