Skip to content

Commit

Permalink
[MIRROR] [NO GBP] Emote Panel TGUI, now should be fixed [MDB IGNORE] (#…
Browse files Browse the repository at this point in the history
…642)

* [NO GBP] Emote Panel TGUI, now should be fixed (#79481)

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: larentoun <[email protected]>
  • Loading branch information
3 people authored Nov 15, 2023
1 parent 10fd35a commit 4dca85a
Show file tree
Hide file tree
Showing 6 changed files with 358 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/datums/emotes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
var/key = ""
/// This will also call the emote.
var/key_third_person = ""
/// Needed for more user-friendly emote names, so emotes with keys like "aflap" will show as "flap angry". Defaulted to key.
var/name = ""
/// Message displayed when emote is used.
var/message = ""
/// Message displayed if the user is a mime.
Expand Down Expand Up @@ -77,6 +79,9 @@
mob_type_blacklist_typecache = typecacheof(mob_type_blacklist_typecache)
mob_type_ignore_stat_typecache = typecacheof(mob_type_ignore_stat_typecache)

if(!name)
name = key

/**
* Handles the modifications and execution of emotes.
*
Expand Down
64 changes: 64 additions & 0 deletions code/modules/emote_panel/emote_panel.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/datum/emote_panel
var/list/blacklisted_emotes = list("me", "help")

/datum/emote_panel/ui_static_data(mob/user)
var/list/data = list()

var/list/emotes = list()
var/list/keys = list()

for(var/key in GLOB.emote_list)
for(var/datum/emote/emote in GLOB.emote_list[key])
if(emote.key in keys)
continue
if(emote.key in blacklisted_emotes)
continue
if(emote.can_run_emote(user, status_check = FALSE, intentional = FALSE))
keys += emote.key
emotes += list(list(
"key" = emote.key,
"name" = emote.name,
"hands" = emote.hands_use_check,
"visible" = emote.emote_type & EMOTE_VISIBLE,
"audible" = emote.emote_type & EMOTE_AUDIBLE,
"sound" = !isnull(emote.get_sound(user)),
"use_params" = emote.message_param,
))

data["emotes"] = emotes

return data

/datum/emote_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("play_emote")
var/emote_key = params["emote_key"]
if(isnull(emote_key) || !GLOB.emote_list[emote_key])
return
var/use_params = params["use_params"]
var/datum/emote/emote = GLOB.emote_list[emote_key][1]
var/emote_param
if(emote.message_param && use_params)
emote_param = tgui_input_text(ui.user, "Add params to the emote...", emote.message_param)
ui.user.emote(emote_key, message = emote_param, intentional = TRUE)

/datum/emote_panel/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "EmotePanel")
ui.open()

/datum/emote_panel/ui_state(mob/user)
return GLOB.always_state

/mob/living/verb/emote_panel()
set name = "Emote Panel"
set category = "IC"

var/static/datum/emote_panel/emote_panel
if(isnull(emote_panel))
emote_panel = new
emote_panel.ui_interact(src)
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

/datum/emote/living/carbon/blink_r
key = "blink_r"
name = "blink (Rapid)"
message = "blinks rapidly."

//SKYRAT EDIT REMOVAL BEGIN - EMOTES - (Moved to modular_skyrat/modules/emotes/code/emotes.dm as /datum/emote/living/clap)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
/datum/emote/living/flap/aflap
key = "aflap"
key_third_person = "aflaps"
name = "flap (Angry)"
message = "flaps their wings ANGRILY!"
hands_use_check = TRUE
wing_time = 10
Expand Down Expand Up @@ -194,6 +195,7 @@
/datum/emote/living/gasp_shock
key = "gaspshock"
key_third_person = "gaspsshock"
name = "gasp (Shock)"
message = "gasps in shock!"
message_mime = "gasps in silent shock!"
emote_type = EMOTE_VISIBLE | EMOTE_AUDIBLE
Expand Down Expand Up @@ -529,6 +531,7 @@

/datum/emote/living/twitch_s
key = "twitch_s"
name = "twitch (Slight)"
message = "twitches."

/datum/emote/living/twitch_s/run_emote(mob/living/user, params, type_override, intentional)
Expand All @@ -553,6 +556,7 @@
/datum/emote/living/wsmile
key = "wsmile"
key_third_person = "wsmiles"
name = "smile (Weak)"
message = "smiles weakly."

/// The base chance for your yawn to propagate to someone else if they're on the same tile as you
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3831,6 +3831,7 @@
#include "code\modules\economy\account.dm"
#include "code\modules\economy\holopay.dm"
#include "code\modules\emoji\emoji_parse.dm"
#include "code\modules\emote_panel\emote_panel.dm"
#include "code\modules\error_handler\error_handler.dm"
#include "code\modules\error_handler\error_viewer.dm"
#include "code\modules\escape_menu\details.dm"
Expand Down
Loading

0 comments on commit 4dca85a

Please sign in to comment.