diff --git a/code/modules/mob/living/carbon/human/species/yautja/_species.dm b/code/modules/mob/living/carbon/human/species/yautja/_species.dm index 89cc2a5a1c7f..dc6bdb1237df 100644 --- a/code/modules/mob/living/carbon/human/species/yautja/_species.dm +++ b/code/modules/mob/living/carbon/human/species/yautja/_species.dm @@ -254,6 +254,8 @@ var/static/list/yautja_emotes /// Static list of categories var/static/list/yautja_categories = list() + /// Panel allows you to spam, so a manual CD is added here + COOLDOWN_DECLARE(panel_emote_cooldown) /datum/yautja_emote_panel/New() if(!length(yautja_emotes)) @@ -275,6 +277,13 @@ ui = new(user, src, "YautjaEmotes") ui.open() +/datum/yautja_emote_panel/ui_data(mob/user) + var/list/data = list() + + data["on_cooldown"] = !COOLDOWN_FINISHED(src, panel_emote_cooldown) + + return data + /datum/yautja_emote_panel/ui_state(mob/user) return GLOB.conscious_state @@ -307,11 +316,12 @@ path = text2path(params["emotePath"]) - if(!path) - return FALSE + if(!path || !COOLDOWN_FINISHED(src, panel_emote_cooldown)) + return if(!(path in subtypesof(/datum/emote/living/carbon/human/yautja))) return FALSE + COOLDOWN_START(src, panel_emote_cooldown, 2.5 SECONDS) usr.emote(initial(path.key)) return TRUE diff --git a/tgui/packages/tgui/interfaces/YautjaEmotes.tsx b/tgui/packages/tgui/interfaces/YautjaEmotes.tsx index 2ad6d85f381a..d33e1cfbdf10 100644 --- a/tgui/packages/tgui/interfaces/YautjaEmotes.tsx +++ b/tgui/packages/tgui/interfaces/YautjaEmotes.tsx @@ -1,6 +1,7 @@ import { useBackend, useLocalState } from '../backend'; import { Box, Button, Divider, Section, Stack, Tabs } from '../components'; import { Window } from '../layouts'; +import { BooleanLike } from '../../common/react'; type Emote = { id: string; @@ -12,11 +13,12 @@ type Emote = { type BackendContext = { categories: string[]; emotes: Emote[]; + on_cooldown: BooleanLike; }; const EmoteTab = (props, context) => { const { data, act } = useBackend(context); - const { categories, emotes } = data; + const { categories, emotes, on_cooldown } = data; const [categoryIndex, setCategoryIndex] = useLocalState( context, 'category_index', @@ -74,6 +76,7 @@ const EmoteTab = (props, context) => {