Files
VOREStation/code/modules/emotes/custom_emote.dm
ShadowLarkens 31e8e009db Character Setup Rework (#17576)
* Character Setup Rework

Little tweaks

Species selection done~

Merk randomize body button

Body color and eye color

Merk more replaced code

Convert robolimbs to tgui

Add a warning if flavor text/ooc notes are too short

Custom preview icons for species selector!

A sidequest that only took 8
hours. Also add digitigrade and blood type.

Remove unused body_descriptor system completely

Finish the general tab~

Reorganization to prepare for loadout page creation

* Start of work on the loadout screen

* Only send the data that's actually selected

* Get rid of these ugly ../../../..

* Retype this to avoid conflicts

* Holy shit why did this work this way

* Finish loadout screen

* Add copy loadout function

* Finish occupation page

* Move Special Roles into general tab

* Fix path conflict

* Move size prefs to general tab

* Convert jukebox and volume settings to datum/preference

* Fix a little mergery fuckery in loadout

* Migrate jukebox to new range

* Fix TabbedMenu tabs

* Fix wordwrap for loadout screen

* Kill the vore tab, just traits left to convert

* Convert custom messages

* Convert custom species name

* Convert blood color and reagents

* Move icobase to tgui

* Finished

* This can fuck off too

* Fix a few bugs

* Update index.tsx

* initial for emote sound mode switch

* Make show_roles actually work, hide fluff items

* Fix not being able to select species

* Add emote_sound_mode to body tab

* Fix runtime when no active gear list is present

* Add a save notification to character setup

* Switch to floating

* Add more search bars

* Whoops forgot to add this

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2025-05-25 03:20:51 +02:00

117 lines
4.8 KiB
Plaintext

/// This is the custom_emote that you'll want to use if you want the mob to be able to input their emote.
/mob/proc/custom_emote(var/m_type = VISIBLE_MESSAGE, var/message, var/range = world.view, var/check_stat = TRUE)
if((check_stat && (src && stat)) || (!use_me && usr == src))
to_chat(src, "You are unable to emote.")
return
var/input
if(!message)
input = sanitize(tgui_input_text(src,"Choose an emote to display."))
else
input = message
process_normal_emote(m_type, message, input, range)
/// This is the custom_emote that you'll want to use if you're forcing something to custom emote with no input from the mob.
/// By default, we have a visible message, our range is world.view, and we do NOT check the stat.
/mob/proc/automatic_custom_emote(var/m_type = VISIBLE_MESSAGE, var/message, var/range = world.view, var/check_stat = FALSE)
if(check_stat && (src && stat))
return
var/input = message
process_automatic_emote(m_type, message, input, range)
//The actual meat and potatoes of the emote processing.
/mob/proc/process_normal_emote(var/m_type = VISIBLE_MESSAGE, var/message, var/input, var/range = world.view)
var/list/formatted
var/runemessage
if(input)
formatted = format_emote(src, message)
if(!islist(formatted))
return
message = formatted["pretext"] + formatted["nametext"] + formatted["subtext"]
runemessage = formatted["subtext"]
// This is just personal preference (but I'm objectively right) that custom emotes shouldn't have periods at the end in runechat
runemessage = replacetext(runemessage,".","",length(runemessage),length(runemessage)+1)
else
return
log_the_emote(m_type, message, input, range, runemessage)
/mob/proc/format_the_emote(var/m_type = VISIBLE_MESSAGE, var/message, var/input, var/range = world.view)
/mob/proc/process_automatic_emote(var/m_type = VISIBLE_MESSAGE, var/message, var/input, var/range = world.view)
var/list/formatted
var/runemessage
if(input)
formatted = format_emote(src, message)
if(!islist(formatted))
return
message = formatted["pretext"] + formatted["nametext"] + formatted["subtext"]
runemessage = formatted["subtext"]
// This is just personal preference (but I'm objectively right) that custom emotes shouldn't have periods at the end in runechat
runemessage = replacetext(runemessage,".","",length(runemessage),length(runemessage)+1)
else
return
build_the_emote(m_type, message, input, range, runemessage)
/mob/proc/log_the_emote(m_type, message, input, range, runemessage)
log_emote(message,src) //Log before we add junk
build_the_emote(m_type, message, input, range, runemessage)
/mob/proc/build_the_emote(m_type, message, input, range, runemessage)
if(client)
message = span_emote(span_bold("[src]") + " [input]")
else
message = span_npc_emote(span_bold("[src]") + " [input]")
if(message)
send_the_emote(m_type, message, input, range, runemessage)
/mob/proc/send_the_emote(m_type, message, input, range, runemessage)
message = encode_html_emphasis(message)
var/turf/T = get_turf(src)
if(!T) return
if(client)
switch(emote_sound_mode)
if(EMOTE_SOUND_NO_FREQ)
playsound(T, pick(GLOB.emote_sound), 75, TRUE, falloff = 1 , is_global = TRUE, frequency = 0, ignore_walls = TRUE, preference = /datum/preference/toggle/emote_sounds)
if(EMOTE_SOUND_VOICE_FREQ)
playsound(T, pick(GLOB.emote_sound), 75, TRUE, falloff = 1 , is_global = TRUE, frequency = voice_freq, ignore_walls = TRUE, preference = /datum/preference/toggle/emote_sounds)
if(EMOTE_SOUND_VOICE_LIST)
playsound(T, pick(voice_sounds_list), 75, TRUE, falloff = 1 , is_global = TRUE, frequency = voice_freq, ignore_walls = TRUE, preference = /datum/preference/toggle/emote_sounds)
var/list/in_range = get_mobs_and_objs_in_view_fast(T,range,2,remote_ghosts = client ? TRUE : FALSE)
var/list/m_viewers = in_range["mobs"]
var/list/o_viewers = in_range["objs"]
for(var/obj/o in contents)
o_viewers |= o
for(var/mob/M as anything in m_viewers)
if(M)
var/final_message = message
if(isobserver(M))
final_message = span_emote(span_bold("[src]") + " ([ghost_follow_link(src, M)]) [input]")
if(src.client && M && !(get_z(src) == get_z(M)))
final_message = span_multizsay("[final_message]")
// If you are in the same tile, right next to, or being held by a person doing an emote, you should be able to see it while blind
if(m_type != AUDIBLE_MESSAGE && (src.Adjacent(M) || (istype(src.loc, /obj/item/holder) && src.loc.loc == M)))
M.show_message(final_message)
else
M.show_message(final_message, m_type)
M.create_chat_message(src, "[runemessage]", FALSE, list("emote"), (m_type == AUDIBLE_MESSAGE))
for(var/obj/O as anything in o_viewers)
if(O)
var/final_message = message
if(src.client && O && !(get_z(src) == get_z(O)))
final_message = span_multizsay("[final_message]")
O.see_emote(src, final_message, m_type)