tModLoader v2024.09
A mod to make and play Terraria mods
EmoteBubble Class Reference

Inherits IEntityWithGlobals< GlobalEmoteBubble >.

Public Member Functions

 EmoteBubble (int emotion, WorldUIAnchor bubbleAnchor, int time=180)
 
void PickNPCEmote (WorldUIAnchor other=null)
 

Static Public Member Functions

static int AssignNewID ()
 
static void CheckForNPCsToReactToEmoteBubble (int emoteID, Player player)
 Try to find a NPC close enough (less than 200 pixels) to react to the emote sent by the player. More...
 
static WorldUIAnchor DeserializeNetAnchor (int type, int meta)
 
static void DrawAll (SpriteBatch sb)
 
static EmoteBubble GetExistingEmoteBubble (int whoAmI)
 Gets the emote bubble that exists in the world by WhoAmI. Returns null if there is no corresponding emote More...
 
static void MakeLocalPlayerEmote (int emoteId)
 Send a emote from Main.LocalPlayer. Should never be called on server. More...
 
static void MakePlayerEmote (Player player, int emoteId, bool syncBetweenClients=true)
 Send a emote from the player More...
 
static int NewBubble (int emoticon, WorldUIAnchor bubbleAnchor, int time)
 Use this method to spawn a emote bubble More...
 
static int NewBubbleNPC (WorldUIAnchor bubbleAnchor, int time, WorldUIAnchor other=null)
 Use this method to make NPCs use a random emote based on the pick emote table. More...
 
static void OnBubbleChange (int bubbleID)
 
static Tuple< int, int > SerializeNetAnchor (WorldUIAnchor anch)
 
static void UpdateAll ()
 

Public Attributes

WorldUIAnchor anchor
 
int emote
 This is the internal ID of this EmoteBubble.
 
int frame
 
int frameCounter
 
int frameSpeed = 8
 
int lifeTime
 
int lifeTimeStart
 
int metadata
 

Static Public Attributes

const int EMOTE_SHEET_EMOTES_PER_ROW = 4
 
const int EMOTE_SHEET_HORIZONTAL_FRAMES = 8
 
static readonly int EMOTE_SHEET_VERTICAL_FRAMES = 2 + (EmoteID.Count - 1) / 4
 

Properties

RefReadOnlyArray< GlobalEmoteBubbleEntityGlobals [get]
 
bool IsFullyDisplayed [get]
 Whether or not this emote is fully displayed
The first and the last 6 frames are for bubble-popping animation. The emote content is displayed after the animation
 
ModEmoteBubble ModEmoteBubble [get, set]
 
int WhoAmI [get]
 The whoAmI indicator that indicates this EmoteBubble, can be used in GetExistingEmoteBubble
 
- Properties inherited from IEntityWithGlobals< GlobalEmoteBubble >
RefReadOnlyArray< TGlobal > EntityGlobals [get]
 
int Type [get]
 

Member Function Documentation

◆ CheckForNPCsToReactToEmoteBubble()

static void EmoteBubble.CheckForNPCsToReactToEmoteBubble ( int  emoteID,
Player  player 
)
static

Try to find a NPC close enough (less than 200 pixels) to react to the emote sent by the player.

Parameters
emoteID
player

◆ GetExistingEmoteBubble()

static EmoteBubble EmoteBubble.GetExistingEmoteBubble ( int  whoAmI)
static

Gets the emote bubble that exists in the world by WhoAmI. Returns null if there is no corresponding emote

Parameters
whoAmI
Returns

◆ MakeLocalPlayerEmote()

static void EmoteBubble.MakeLocalPlayerEmote ( int  emoteId)
static

Send a emote from Main.LocalPlayer. Should never be called on server.

Parameters
emoteId

◆ MakePlayerEmote()

static void EmoteBubble.MakePlayerEmote ( Player  player,
int  emoteId,
bool  syncBetweenClients = true 
)
static

Send a emote from the player

Parameters
player
emoteId
syncBetweenClientsIf true, this emote will be automatically synchronized between clients

◆ NewBubble()

static int EmoteBubble.NewBubble ( int  emoticon,
WorldUIAnchor  bubbleAnchor,
int  time 
)
static

Use this method to spawn a emote bubble

Parameters
emoticonThe emote ID of the emote that will spawn.
bubbleAnchorThe WorldUIAnchor instance for the emote. You can use
Definition: Entity.cs:7
Definition: WorldUIAnchor.cs:7
to get the instance.
timeHow long this emote remains.
Returns
The WhoAmI of this emote

◆ NewBubbleNPC()

static int EmoteBubble.NewBubbleNPC ( WorldUIAnchor  bubbleAnchor,
int  time,
WorldUIAnchor  other = null 
)
static

Use this method to make NPCs use a random emote based on the pick emote table.

Parameters
bubbleAnchorThe WorldUIAnchor instance for the emote. You can use
Definition: NPC.cs:32
to get the instance.
timeHow long this emote remains.
otherThe WorldUIAnchor instance from the other side of the conversation.
Returns
The WhoAmI of this emote