Skip to content

Commit

Permalink
implement ceilings, dehardcode limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsar-Salat committed Dec 8, 2024
1 parent a8b9149 commit c7ff6bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions code/datums/emotes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
var/general_emote_audio_cooldown = 10 SECONDS
/// How long is the specific emote cooldown triggered by this emote?
var/specific_emote_audio_cooldown = 15 SECONDS
//Every time a emote is made, it increases this counter by one. When the integer equals 5, the mob is forced into a cooldown period
/// Every time a emote is made, it increases this counter by one. When the integer equals cooldown_integer_ceiling, the mob is forced into a cooldown period
var/cooldown_integer = 0
/// Maximum amount of emotes that can be made
var/cooldown_integer_ceiling = 5
/// Does this emote's sound ignore walls?
var/sound_wall_ignore = FALSE

Expand Down Expand Up @@ -195,11 +197,12 @@
check_cooldown_integer(user)

/datum/emote/proc/check_cooldown_integer(mob/user)
if(cooldown_integer == 5)
if(cooldown_integer <= cooldown_integer_ceiling)
to_chat(user, "<span class='warning'>emote limit reached</span>")
TIMER_COOLDOWN_START(user, type, specific_emote_audio_cooldown)
TIMER_COOLDOWN_START(user, "general_emote_audio_cooldown", general_emote_audio_cooldown)
cooldown_integer = 0
//Defaults to integer of 0
cooldown_integer = initial(cooldown_integer)

/**
* For handling emote cooldown, return true to allow the emote to happen.
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
message = "screams"
emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE
specific_emote_audio_cooldown = 5 SECONDS
cooldown_integer_ceiling = 2
vary = TRUE

/datum/emote/living/carbon/human/scream/get_sound(mob/living/carbon/human/user)
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 @@ -247,6 +247,7 @@
message_mime = "laughs silently"
emote_type = EMOTE_VISIBLE | EMOTE_AUDIBLE
specific_emote_audio_cooldown = 5 SECONDS
cooldown_integer_ceiling = 3
vary = TRUE

/datum/emote/living/laugh/can_run_emote(mob/living/user, status_check = TRUE , intentional)
Expand Down

0 comments on commit c7ff6bd

Please sign in to comment.