Skip to content

Commit

Permalink
Yautja emote panel (#3906)
Browse files Browse the repository at this point in the history
# About the pull request
Adds a panel I shamelessly ripped from #3792 for Yautja emotes.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
Easy management of emotes is nice!
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
ui: Adds a UI panel for Yautja emotes, all credit to Zonespace.
/:cl:

---------

Co-authored-by: Zonespace <[email protected]>
Co-authored-by: harryob <[email protected]>
  • Loading branch information
3 people authored Jul 24, 2023
1 parent 0938ac8 commit 7ce0f0e
Show file tree
Hide file tree
Showing 15 changed files with 401 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
#define JOE_EMOTE_CATEGORY_WARNING "Warning"
#define JOE_EMOTE_CATEGORY_QUESTION "Question"
#define JOE_EMOTE_CATEGORY_NOTICE "Notice"

#define YAUTJA_EMOTE_CATEGORY_FAKESOUND "Fake Sound"
#define YAUTJA_EMOTE_CATEGORY_VOICE "Voice Synthesizer"
#define YAUTJA_EMOTE_CATEGORY_SPECIES "Yautja"
145 changes: 0 additions & 145 deletions code/modules/mob/living/carbon/human/species/emote-yautja.dm

This file was deleted.

4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/species/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@
/datum/species/proc/larva_impregnated(obj/item/alien_embryo/embryo)
return

/// Override to add an emote panel to a species
/datum/species/proc/open_emote_panel()
return

/datum/species/proc/handle_npc(mob/living/carbon/human/H)
set waitfor = FALSE
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
species_type_allowed_typecache = list(/datum/species/synthetic/colonial/working_joe)
keybind_category = CATEGORY_SYNTH_EMOTE
volume = 75
/// A general category for the emote, for use in the WJ emote panel. See [code/__DEFINES/wj_emotes.dm] for categories.
/// A general category for the emote, for use in the WJ emote panel. See [code/__DEFINES/emote_panels.dm] for categories.
var/category = ""
/// Override text for the emote to be displayed in the WJ emote panel
var/override_say = ""
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
return ..()

/// Open the WJ's emote panel, which allows them to use voicelines
/datum/species/synthetic/colonial/working_joe/proc/open_emote_panel()
/datum/species/synthetic/colonial/working_joe/open_emote_panel()
var/datum/joe_emote_panel/ui = new(usr)
ui.ui_interact(usr)

Expand Down
10 changes: 10 additions & 0 deletions code/modules/mob/living/carbon/human/species/yautja/_emote.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/datum/emote/living/carbon/human/yautja
species_type_allowed_typecache = list(/datum/species/yautja)
keybind_category = CATEGORY_YAUTJA_EMOTE
emote_type = EMOTE_AUDIBLE
/// A general category for the emote, for use in the Yautja emote panel. See [code/__DEFINES/emote_panels.dm] for categories.
var/category = ""
/// Override text for the emote to be displayed in the Yautja emote panel
var/override_say = ""
/// Override for being in panel or not
var/no_panel = FALSE
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@
limb.max_damage = 35
limb.time_to_knit = -1

/datum/species/yautja/handle_post_spawn(mob/living/carbon/human/H)
GLOB.alive_human_list -= H
H.universal_understand = 1
/datum/species/yautja/handle_post_spawn(mob/living/carbon/human/hunter)
GLOB.alive_human_list -= hunter
hunter.universal_understand = 1

H.blood_type = "Y*"
H.h_style = "Standard"
hunter.blood_type = "Y*"
hunter.h_style = "Standard"
#ifndef UNIT_TESTS // Since this is a hard ref, we shouldn't confuse create_and_destroy
GLOB.yautja_mob_list += H
GLOB.yautja_mob_list += hunter
#endif
for(var/obj/limb/limb in H.limbs)
for(var/obj/limb/limb in hunter.limbs)
switch(limb.name)
if("groin","chest")
limb.min_broken_damage = 145
Expand All @@ -208,7 +208,8 @@
limb.max_damage = 150
limb.time_to_knit = 600 // 1 minute to self heal bone break, time is in tenths of a second

H.set_languages(list(LANGUAGE_YAUTJA))
hunter.set_languages(list(LANGUAGE_YAUTJA))
give_action(hunter, /datum/action/yautja_emote_panel)
return ..()

/datum/species/yautja/get_hairstyle(style)
Expand All @@ -220,3 +221,105 @@

/datum/species/yautja/handle_paygrades()
return ""

/// Open the Yautja emote panel, which allows them to use their emotes easier.
/datum/species/yautja/open_emote_panel()
var/datum/yautja_emote_panel/ui = new(usr)
ui.ui_interact(usr)

/datum/action/yautja_emote_panel
name = "Open Emote Panel"
action_icon_state = "looc_toggle"

/datum/action/yautja_emote_panel/can_use_action()
. = ..()
if(!.)
return FALSE

if(!isyautja(owner))
return FALSE

return TRUE

/datum/action/yautja_emote_panel/action_activate()
if(!can_use_action())
return

var/mob/living/carbon/human/human_owner = owner
var/datum/species/yautja/yautja_species = human_owner.species
yautja_species.open_emote_panel()

/datum/yautja_emote_panel
/// Static dict ("category" : (emotes)) of every yautja emote typepath
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))
var/list/emotes_to_add = list()
for(var/datum/emote/living/carbon/human/yautja/emote as anything in subtypesof(/datum/emote/living/carbon/human/yautja))
if(!initial(emote.key) || initial(emote.no_panel))
continue

if(!(initial(emote.category) in yautja_categories))
yautja_categories += initial(emote.category)
emotes_to_add += emote
yautja_emotes = emotes_to_add

/datum/yautja_emote_panel/proc/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
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

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

data["categories"] = yautja_categories
data["emotes"] = list()

for(var/datum/emote/living/carbon/human/yautja/emote as anything in yautja_emotes)
data["emotes"] += list(list(
"id" = initial(emote.key),
"text" = (initial(emote.override_say) || initial(emote.say_message) || initial(emote.key)),
"category" = initial(emote.category),
"path" = "[emote]",
))

return data

/datum/yautja_emote_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return

switch(action)
if("emote")
var/datum/emote/living/carbon/human/yautja/path
if(!params["emotePath"])
return FALSE

path = text2path(params["emotePath"])

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
22 changes: 22 additions & 0 deletions code/modules/mob/living/carbon/human/species/yautja/fake_sounds.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/datum/emote/living/carbon/human/yautja/fake_sound
category = YAUTJA_EMOTE_CATEGORY_FAKESOUND

/datum/emote/living/carbon/human/yautja/fake_sound/aliengrowl
key = "aliengrowl"

/datum/emote/living/carbon/human/yautja/fake_sound/aliengrowl/get_sound(mob/living/user)
return pick('sound/voice/alien_growl1.ogg', 'sound/voice/alien_growl2.ogg')

/datum/emote/living/carbon/human/yautja/fake_sound/alienhelp
key = "alienhelp"

/datum/emote/living/carbon/human/yautja/fake_sound/alienhelp/get_sound(mob/living/user)
return pick('sound/voice/alien_help1.ogg', 'sound/voice/alien_help2.ogg')

/datum/emote/living/carbon/human/yautja/fake_sound/malescream
key = "malescream"
sound = "male_scream"

/datum/emote/living/carbon/human/yautja/fake_sound/femalescream
key = "femalescream"
sound = "female_scream"
Loading

0 comments on commit 7ce0f0e

Please sign in to comment.