tModLoader v2024.04
A mod to make and play Terraria mods
ModEmoteBubble Class Reference

Represents an emote. Emotes are typically used by players or NPC. Players can use the emotes menu or chat commands to display an emote, while town NPC spawn emotes when talking to each other. More...

Inherits ModType< EmoteBubble, ModEmoteBubble >, and ILocalizedModType.

Public Member Functions

void AddToCategory (int categoryId)
 Allows you to add this emote to a specific vanilla category.
This should only be called in ModType.SetStaticDefaults More...
 
virtual ? Rectangle GetFrame ()
 Allows you to modify the frame rectangle for drawing this emote. Useful for emote bubbles that share the same texture. More...
 
virtual ? Rectangle GetFrameInEmoteMenu (int frame, int frameCounter)
 Allows you to modify the frame rectangle for drawing this emote in emotes menu. Useful for emote bubbles that share the same texture. More...
 
virtual bool IsUnlocked ()
 Allows you to determine whether or not this emote can be seen in emotes menu. Returns true by default.
Do note that this doesn't effect emote command and NPC using. More...
 
virtual void OnSpawn ()
 Gets called when your emote bubble spawns in world.
 
virtual void PostDraw (SpriteBatch spriteBatch, Texture2D texture, Vector2 position, Rectangle frame, Vector2 origin, SpriteEffects spriteEffects)
 Allows you to draw things in front of this emote bubble. This method is called even if PreDraw returns false. More...
 
virtual void PostDrawInEmoteMenu (SpriteBatch spriteBatch, EmoteButton uiEmoteButton, Vector2 position, Rectangle frame, Vector2 origin)
 Allows you to draw things in front of this emote bubble. This method is called even if PreDraw returns false.
Do note that you should NEVER use the EmoteBubble field in this method because it's null. More...
 
virtual bool PreDraw (SpriteBatch spriteBatch, Texture2D texture, Vector2 position, Rectangle frame, Vector2 origin, SpriteEffects spriteEffects)
 Allows you to draw things behind this emote bubble, or to modify the way this emote bubble is drawn. Return false to stop the game from drawing the emote bubble (useful if you're manually drawing the emote bubble). Returns true by default. More...
 
virtual bool PreDrawInEmoteMenu (SpriteBatch spriteBatch, EmoteButton uiEmoteButton, Vector2 position, Rectangle frame, Vector2 origin)
 Allows you to draw things behind this emote bubble that displays in emotes menu, or to modify the way this emote bubble is drawn. Return false to stop the game from drawing the emote bubble (useful if you're manually drawing the emote bubble). Returns true by default.
Do note that you should NEVER use the EmoteBubble field in this method because it's null. More...
 
sealed override void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. More...
 
virtual bool UpdateFrame ()
 Allows you to modify the frame of this emote bubble. Return false to stop vanilla frame update code from running. Returns true by default. More...
 
virtual bool UpdateFrameInEmoteMenu (ref int frameCounter)
 Allows you to modify the frame of this emote bubble which displays in emotes menu. Return false to stop vanilla frame update code from running. Returns true by default.
Do note that you should NEVER use the EmoteBubble field in this method because it's null. More...
 
- Public Member Functions inherited from ModType< EmoteBubble, ModEmoteBubble >
virtual TModType Clone (TEntity newEntity)
 Create a copy of this instanced global. Called when an entity is cloned. More...
 
virtual bool IsLoadingEnabled (Mod mod)
 Allows you to stop Mod.AddContent from actually adding this content. Useful for items that can be disabled by a config. More...
 
virtual void Load ()
 Allows you to perform one-time loading tasks. Beware that mod content has not finished loading here, things like ModContent lookup tables or ID Sets are not fully populated. More...
 
virtual TModType NewInstance (TEntity entity)
 Create a new instance of this ModType for a specific entity More...
 
string PrettyPrintName ()
 
virtual void SetStaticDefaults ()
 Allows you to modify the properties after initial loading has completed.
 
virtual void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. More...
 
virtual void Unload ()
 Allows you to safely unload things you added in Load. More...
 
virtual bool IsLoadingEnabled (Mod mod)
 Whether or not this type should be loaded when it's told to. Returning false disables Mod.AddContent from actually loading this type. More...
 
abstract void Load (Mod mod)
 Called when loading the type. More...
 
abstract void Unload ()
 Called during unloading when needed. More...
 

Protected Member Functions

override EmoteBubble CreateTemplateEntity ()
 
sealed override void Register ()
 If you make a new ModType, seal this override. More...
 
- Protected Member Functions inherited from ModType< EmoteBubble, ModEmoteBubble >
abstract TEntity CreateTemplateEntity ()
 
virtual void InitTemplateInstance ()
 Create dummy objects for instanced mod-types
 
override void InitTemplateInstance ()
 Create dummy objects for instanced mod-types
 
abstract void Register ()
 If you make a new ModType, seal this override. More...
 
virtual void ValidateType ()
 Check for the correct overrides of different hook methods and fields and properties
 

Properties

virtual LocalizedText Command [get]
 This is the name that will show up as the emote command.
 
EmoteBubble EmoteBubble [get]
 This is the EmoteBubble instance.
 
virtual string LocalizationCategory [get]
 The category used by this modded content for use in localization keys. Localization keys follow the pattern of "Mods.{ModName}.{Category}.{ContentName}.{DataName}". The Localization wiki pageexplains how custom ModType classes can utilize this. More...
 
virtual string Texture [get]
 The file name of this emote's texture file in the mod loader's file space.
 
int Type [get, set]
 The internal ID of this EmoteBubble.
 
- Properties inherited from ModType< EmoteBubble, ModEmoteBubble >
virtual bool CloneNewInstances [get]
 Whether to create new instances of this mod type via Clone(TEntity) or via the default constructor Defaults to false (default constructor).
 
TEntity Entity [get, set]
 
string FullName [get]
 The internal name of this, including the mod it is from. More...
 
virtual bool IsCloneable [get]
 Whether or not this type is cloneable. Cloning is supported if
all reference typed fields in each sub-class which doesn't override Clone are marked with [CloneByReference]
 
Mod Mod [get, set]
 The mod this belongs to. More...
 
virtual string Name [get]
 The internal name of this. More...
 
- Properties inherited from IModType
string FullName [get]
 => $"{Mod.Name}/{Name}" More...
 
Mod Mod [get]
 The mod this belongs to. More...
 
string Name [get]
 The internal name of this instance. More...
 
- Properties inherited from ILocalizedModType
abstract string LocalizationCategory [get]
 The category used by this modded content for use in localization keys. Localization keys follow the pattern of "Mods.{ModName}.{Category}.{ContentName}.{DataName}". The Localization wiki pageexplains how custom ModType classes can utilize this. More...
 

Detailed Description

Represents an emote. Emotes are typically used by players or NPC. Players can use the emotes menu or chat commands to display an emote, while town NPC spawn emotes when talking to each other.

Member Function Documentation

◆ AddToCategory()

void ModEmoteBubble.AddToCategory ( int  categoryId)

Allows you to add this emote to a specific vanilla category.
This should only be called in ModType.SetStaticDefaults

Parameters
categoryIdThe category to which this emote will be added. Use EmoteID.Category to select the category you want.

◆ CreateTemplateEntity()

override EmoteBubble ModEmoteBubble.CreateTemplateEntity ( )
protectedvirtual

◆ GetFrame()

virtual ? Rectangle ModEmoteBubble.GetFrame ( )
virtual

Allows you to modify the frame rectangle for drawing this emote. Useful for emote bubbles that share the same texture.

Returns

◆ GetFrameInEmoteMenu()

virtual ? Rectangle ModEmoteBubble.GetFrameInEmoteMenu ( int  frame,
int  frameCounter 
)
virtual

Allows you to modify the frame rectangle for drawing this emote in emotes menu. Useful for emote bubbles that share the same texture.

Parameters
frame
frameCounter
Returns

◆ IsUnlocked()

virtual bool ModEmoteBubble.IsUnlocked ( )
virtual

Allows you to determine whether or not this emote can be seen in emotes menu. Returns true by default.
Do note that this doesn't effect emote command and NPC using.

Returns
If true, this emote will be shown in emotes menu.

◆ PostDraw()

virtual void ModEmoteBubble.PostDraw ( SpriteBatch  spriteBatch,
Texture2D  texture,
Vector2  position,
Rectangle  frame,
Vector2  origin,
SpriteEffects  spriteEffects 
)
virtual

Allows you to draw things in front of this emote bubble. This method is called even if PreDraw returns false.

Parameters
spriteBatch
texture
position
frame
origin
spriteEffects

◆ PostDrawInEmoteMenu()

virtual void ModEmoteBubble.PostDrawInEmoteMenu ( SpriteBatch  spriteBatch,
EmoteButton  uiEmoteButton,
Vector2  position,
Rectangle  frame,
Vector2  origin 
)
virtual

Allows you to draw things in front of this emote bubble. This method is called even if PreDraw returns false.
Do note that you should NEVER use the EmoteBubble field in this method because it's null.

Parameters
spriteBatch
uiEmoteButtonThe EmoteButton instance. You can get useful textures and frameCounter from it.
position
frame
origin

◆ PreDraw()

virtual bool ModEmoteBubble.PreDraw ( SpriteBatch  spriteBatch,
Texture2D  texture,
Vector2  position,
Rectangle  frame,
Vector2  origin,
SpriteEffects  spriteEffects 
)
virtual

Allows you to draw things behind this emote bubble, or to modify the way this emote bubble is drawn. Return false to stop the game from drawing the emote bubble (useful if you're manually drawing the emote bubble). Returns true by default.

Parameters
spriteBatch
texture
position
frame
origin
spriteEffects
Returns
If false, the vanilla drawing code will not run.

◆ PreDrawInEmoteMenu()

virtual bool ModEmoteBubble.PreDrawInEmoteMenu ( SpriteBatch  spriteBatch,
EmoteButton  uiEmoteButton,
Vector2  position,
Rectangle  frame,
Vector2  origin 
)
virtual

Allows you to draw things behind this emote bubble that displays in emotes menu, or to modify the way this emote bubble is drawn. Return false to stop the game from drawing the emote bubble (useful if you're manually drawing the emote bubble). Returns true by default.
Do note that you should NEVER use the EmoteBubble field in this method because it's null.

Parameters
spriteBatch
uiEmoteButtonThe EmoteButton instance. You can get useful textures and frameCounter from it.
position
frame
origin
Returns
If false, the vanilla drawing code will not run.

◆ Register()

sealed override void ModEmoteBubble.Register ( )
protectedvirtual

If you make a new ModType, seal this override.

Implements ModType< EmoteBubble, ModEmoteBubble >.

◆ SetupContent()

sealed override void ModEmoteBubble.SetupContent ( )
virtual

If you make a new ModType, seal this override, and call SetStaticDefaults in it.

Reimplemented from ModType< EmoteBubble, ModEmoteBubble >.

◆ UpdateFrame()

virtual bool ModEmoteBubble.UpdateFrame ( )
virtual

Allows you to modify the frame of this emote bubble. Return false to stop vanilla frame update code from running. Returns true by default.

Returns
If false, the vanilla frame update code will not run.

◆ UpdateFrameInEmoteMenu()

virtual bool ModEmoteBubble.UpdateFrameInEmoteMenu ( ref int  frameCounter)
virtual

Allows you to modify the frame of this emote bubble which displays in emotes menu. Return false to stop vanilla frame update code from running. Returns true by default.
Do note that you should NEVER use the EmoteBubble field in this method because it's null.

Parameters
frameCounter
Returns
If false, the vanilla frame update code will not run.

Property Documentation

◆ LocalizationCategory

virtual string ModEmoteBubble.LocalizationCategory
get

The category used by this modded content for use in localization keys. Localization keys follow the pattern of "Mods.{ModName}.{Category}.{ContentName}.{DataName}". The Localization wiki pageexplains how custom ModType classes can utilize this.

Implements ILocalizedModType.