Emote
Most of the text that's not someone talking is based off of this.
Vars | |
age_based | Whether or not to adjust the frequency of the emote sound based on age. |
---|---|
audio_cooldown | How long is the cooldown on the audio of the emote, if it has one? |
bypass_unintentional_cooldown | If true, an emote will completely bypass any cooldown when called unintentionally. Necessary for things like deathgasp. |
cooldown | The cooldown between the uses of the emote. |
emote_target_type | If our target behavior isn't to ignore, what should we look for with targets? |
emote_type | Whether the emote is visible or audible. |
hands_use_check | Checks if the mob can use its hands before performing the emote. |
key | What calls the emote. |
key_third_person | This will also call the emote. |
max_stat_allowed | How unconscious/dead can you be while still being able to use this emote intentionally? If this is set to DEFAULT_STAT_ALLOWED, it'll behave as if it isn't set. |
max_unintentional_stat_allowed | Same as above, how unconscious/dead do you need to be to have this emote forced out of you? If this is set to DEFAULT_STAT_ALLOWED, it'll behave as if it isn't set. |
message | Message displayed when emote is used. |
message_AI | Message displayed if the user is an AI. |
message_alien | Message displayed if the user is a grown alien. |
message_larva | Message displayed if the user is an alien larva. |
message_mime | Message displayed if the user is a mime. |
message_monkey | Message displayed if the user is a monkey. |
message_observer | Message to display if the user is a spooky observer ghost. |
message_param | Message with %t at the end to allow adding params to the message, like for mobs doing an emote relatively to something else. Set this to EMOTE_PARAM_USE_POSTFIX to just use the postfix. |
message_postfix | Message postfix with %t used when we don't want to use message_param for our targeting. Used for things like message_monkey or message_mime. Punctuation from the message will be stripped when this is applied, so make sure it's punctuated as well. |
message_robot | Message displayed if the user is a robot. |
message_simple | Message to display if the user is a simple_animal. |
mob_type_allowed_typecache | Types that are allowed to use that emote. |
mob_type_blacklist_typecache | Types that are NOT allowed to use that emote. |
mob_type_ignore_stat_typecache | Types that can use this emote regardless of their state. |
muzzle_ignore | If the emote type is EMOTE_MOUTH but should still bypass a muzzle. |
muzzled_noises | Sounds emitted when the user is muzzled. Generally used like "[user] makes a pick(muzzled_noises) noise!" |
only_forced_audio | If true, this emote will only make a sound effect when called unintentionally. |
only_unintentional | Whether or not the emote can even be called at all if it's not intentional |
param_desc | Description appended to the emote name describing what the target should be, like for help commands. |
sound | Sound to play when emote is called. If you want to adjust this dynamically, see get_sound(). |
species_type_blacklist_typecache | Species types which the emote will be exclusively not available to. Should be subclasses of /datum/species |
species_type_whitelist_typecache | Species types which the emote will be exclusively available to. Should be subclasses of /datum/species |
stat_allowed | How conscious do you need to be to use this emote intentionally? |
target_behavior | If we get a target, how do we want to treat it? |
unintentional_audio_cooldown | If the emote is triggered unintentionally, how long would that cooldown be? |
unintentional_stat_allowed | How conscious do you need to be to have this emote forced out of you? |
vary | Whether or not to vary the sound of the emote. |
volume | How loud is the audio emote? |
Procs | |
act_on_target | Perform an action on the target of an emote, if one was found. |
can_run_emote | Check to see if the user is allowed to run the emote. |
can_vocalize_emotes | Return whether a user should be able to vocalize emotes or not, due to a mask or inability to speak. If this returns false, any mouth emotes will be replaced with muzzled noises. |
check_cooldown | Check whether or not an emote can be used due to a cooldown. This applies to per-emote cooldowns, preventing individual emotes from being used (intentionally) too frequently. This also checks audio cooldowns, so that intentional uses of audio emotes across the mob are time-constrained. |
find_target | Find a target for the emote based on the message parameter fragment passed in. |
get_sound | To get the sound that the emote plays, for special sound interactions depending on the mob. |
get_volume | Get the volume of the audio emote to play. |
play_sound_effect | Play the sound effect in an emote. If you want to change the way the playsound call works, override this. Note! If you want age_based to work, you need to force vary to TRUE. |
replace_pronoun | Replace pronouns in the inputed string with the user's proper pronouns. |
reset_emote | Reset the emote back to its original state. Necessary if you've made modifications to the emote itself over the course of its execution, as emotes are singletons, and changes would be reflected on every usage of the emote. |
run_emote | Handles the modifications and execution of emotes. |
runechat_emote | Send an emote to runechat for all (listening) users in the vicinity. |
select_message_type | Selects the message type to override the message with. |
select_param | Replaces the %t in the message in message_param by params. |
should_play_sound | Check to see if the user should play a sound when performing the emote. |
try_run_emote | Try to run an emote, checking can_run_emote once before executing the emote itself. |
Var Details
age_based
Whether or not to adjust the frequency of the emote sound based on age.
audio_cooldown
How long is the cooldown on the audio of the emote, if it has one?
bypass_unintentional_cooldown
If true, an emote will completely bypass any cooldown when called unintentionally. Necessary for things like deathgasp.
cooldown
The cooldown between the uses of the emote.
emote_target_type
If our target behavior isn't to ignore, what should we look for with targets?
emote_type
Whether the emote is visible or audible.
hands_use_check
Checks if the mob can use its hands before performing the emote.
key
What calls the emote.
key_third_person
This will also call the emote.
max_stat_allowed
How unconscious/dead can you be while still being able to use this emote intentionally? If this is set to DEFAULT_STAT_ALLOWED, it'll behave as if it isn't set.
max_unintentional_stat_allowed
Same as above, how unconscious/dead do you need to be to have this emote forced out of you? If this is set to DEFAULT_STAT_ALLOWED, it'll behave as if it isn't set.
message
Message displayed when emote is used.
message_AI
Message displayed if the user is an AI.
message_alien
Message displayed if the user is a grown alien.
message_larva
Message displayed if the user is an alien larva.
message_mime
Message displayed if the user is a mime.
message_monkey
Message displayed if the user is a monkey.
message_observer
Message to display if the user is a spooky observer ghost.
message_param
Message with %t at the end to allow adding params to the message, like for mobs doing an emote relatively to something else. Set this to EMOTE_PARAM_USE_POSTFIX to just use the postfix.
message_postfix
Message postfix with %t used when we don't want to use message_param for our targeting. Used for things like message_monkey or message_mime. Punctuation from the message will be stripped when this is applied, so make sure it's punctuated as well.
message_robot
Message displayed if the user is a robot.
message_simple
Message to display if the user is a simple_animal.
mob_type_allowed_typecache
Types that are allowed to use that emote.
mob_type_blacklist_typecache
Types that are NOT allowed to use that emote.
mob_type_ignore_stat_typecache
Types that can use this emote regardless of their state.
muzzle_ignore
If the emote type is EMOTE_MOUTH but should still bypass a muzzle.
muzzled_noises
Sounds emitted when the user is muzzled. Generally used like "[user] makes a pick(muzzled_noises) noise!"
only_forced_audio
If true, this emote will only make a sound effect when called unintentionally.
only_unintentional
Whether or not the emote can even be called at all if it's not intentional
param_desc
Description appended to the emote name describing what the target should be, like for help commands.
sound
Sound to play when emote is called. If you want to adjust this dynamically, see get_sound().
species_type_blacklist_typecache
Species types which the emote will be exclusively not available to. Should be subclasses of /datum/species
species_type_whitelist_typecache
Species types which the emote will be exclusively available to. Should be subclasses of /datum/species
stat_allowed
How conscious do you need to be to use this emote intentionally?
target_behavior
If we get a target, how do we want to treat it?
unintentional_audio_cooldown
If the emote is triggered unintentionally, how long would that cooldown be?
unintentional_stat_allowed
How conscious do you need to be to have this emote forced out of you?
vary
Whether or not to vary the sound of the emote.
volume
How loud is the audio emote?
Proc Details
act_on_target
Perform an action on the target of an emote, if one was found.
This gets called in select_param if a valid object target was found, and should let you interact with the object being targeted while it's still in scope.
- user - Person who is triggering the emote.
- Target - The target of the emote itself.
can_run_emote
Check to see if the user is allowed to run the emote.
Arguments:
- user - Person that is trying to send the emote.
- status_check - Bool that says whether we should check their stat or not.
- intentional - Bool that says whether the emote was forced (FALSE) or not (TRUE).
Returns a bool about whether or not the user can run the emote.
can_vocalize_emotes
Return whether a user should be able to vocalize emotes or not, due to a mask or inability to speak. If this returns false, any mouth emotes will be replaced with muzzled noises.
check_cooldown
Check whether or not an emote can be used due to a cooldown. This applies to per-emote cooldowns, preventing individual emotes from being used (intentionally) too frequently. This also checks audio cooldowns, so that intentional uses of audio emotes across the mob are time-constrained.
Arguments:
- user - Person that is trying to send the emote.
- intentional - Bool that says whether the emote was forced (FALSE) or not (TRUE).
Returns FALSE if the cooldown is not over, TRUE if the cooldown is over.
find_target
Find a target for the emote based on the message parameter fragment passed in.
- user - The user looking for a target.
- fragment - The mesage parameter or fragment of text they're using to try to find a target.
- emote_target_type - Define denoting the type of target to use when searching.
Returns a matched target, or null if a specific match couldn't be made.
get_sound
To get the sound that the emote plays, for special sound interactions depending on the mob.
Arguments:
- user - Person that is trying to send the emote.
Returns the sound that will be made while sending the emote.
get_volume
Get the volume of the audio emote to play.
Override this if you want to dynamically change the volume of an emote.
Arguments:
- user - Person that is trying to send the emote.
Returns the volume level for an emote's audio component.
play_sound_effect
Play the sound effect in an emote. If you want to change the way the playsound call works, override this. Note! If you want age_based to work, you need to force vary to TRUE.
- user - The user of the emote.
- intentional - Whether or not the emote was triggered intentionally.
- sound_path - Filesystem path to the audio clip to play.
- sound_volume - Volume at which to play the audio clip.
replace_pronoun
Replace pronouns in the inputed string with the user's proper pronouns.
Specifically replaces they/them/their pronouns with the user's pronouns, as well as %s (like theirs)
Arguments:
- user - Person that is trying to send the emote.
- msg - The string to modify.
Returns the modified msg string.
reset_emote
Reset the emote back to its original state. Necessary if you've made modifications to the emote itself over the course of its execution, as emotes are singletons, and changes would be reflected on every usage of the emote.
run_emote
Handles the modifications and execution of emotes.
In general, what this does:
- Checks if the user can run the emote at all
- Checks and applies the message parameter, if it exists
- Replaces pronouns with a mob's specific pronouns
- Checks for and plays sound if the emote supports it
- Sends the emote to users
- Runechats the emote
You most likely want to use try_run_emote() anywhere you would otherwise call this directly, as that will incorporate can_run_emote() checking as well.
Arguments:
- user - Person that is trying to send the emote.
- emote_arg - String parameter added after the emote.
- type_override - Override to the current emote_type.
- intentional - Bool that says whether the emote was forced (FALSE) or not (TRUE).
Returns TRUE if it was able to run the emote, FALSE otherwise.
runechat_emote
Send an emote to runechat for all (listening) users in the vicinity.
- user - The user of the emote.
- text - The text of the emote.
select_message_type
Selects the message type to override the message with.
Arguments:
- user - Person that is trying to send the emote.
- msg - The string to modify.
- intentional - Bool that says whether the emote was forced (FALSE) or not (TRUE).
Returns the new message, or msg directly, if no change was needed.
select_param
Replaces the %t in the message in message_param by params.
The behavior of this proc is particularly dependent on target_behavior
and emote_target_type
.
If target_behavior is EMOTE_TARGET_BHVR_RAW, we ignore any sort of target searching.
Otherwise, we try to find a target in view to call this emote on based on emote_target_type.
If you want to call something on the target object itself while it's still in scope, override act_on_target().
Arguments:
- user - Person that is trying to send the emote.
- params - Parameters added after the emote.
- substitution_str - String to substitute the target into.
- base_message - If passed, the original message before any sort of modification occurred. Useful when dealing with non-standard message types.
Returns the modified string, or null if the given parameter is invalid. May also return EMOTE_ACT_STOP_EXECUTION if acting on the target should stop emote execution.
should_play_sound
Check to see if the user should play a sound when performing the emote.
Arguments:
- user - Person that is doing the emote.
- intentional - Bool that says whether the emote was forced (FALSE) or not (TRUE).
Returns a bool about whether or not the user should play a sound when performing the emote.
try_run_emote
Try to run an emote, checking can_run_emote once before executing the emote itself.
- user - User of the emote
- params - An optional extra argument included after the emote key.
- type_override - emote type to override the existing one with, if given.
- intentional - Whether or not the emote was triggered intentionally (if false, the emote was forced by code).
Returns TRUE if the emote was able to be run (or failed successfully), or FALSE if the emote is unusable.