Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Jul 19, 2023
1 parent 617c31f commit 64db114
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 12 additions & 2 deletions code/modules/mob/living/carbon/human/species/yautja/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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

Expand Down Expand Up @@ -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
5 changes: 4 additions & 1 deletion tgui/packages/tgui/interfaces/YautjaEmotes.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,11 +13,12 @@ type Emote = {
type BackendContext = {
categories: string[];
emotes: Emote[];
on_cooldown: BooleanLike;
};

const EmoteTab = (props, context) => {
const { data, act } = useBackend<BackendContext>(context);
const { categories, emotes } = data;
const { categories, emotes, on_cooldown } = data;
const [categoryIndex, setCategoryIndex] = useLocalState(
context,
'category_index',
Expand Down Expand Up @@ -74,6 +76,7 @@ const EmoteTab = (props, context) => {
<Button
content={item.text}
tooltip={item.id}
disabled={on_cooldown}
onClick={() =>
act('emote', {
emotePath: item.path,
Expand Down

0 comments on commit 64db114

Please sign in to comment.