![]() |
tModLoader v2025.01
A mod to make and play Terraria mods
|
Represents an in-world floating text object.
More...
Public Member Functions | |
void | Update (int whoAmI) |
Updates this PopupText. More... | |
Static Public Member Functions | |
static void | AssignAsSonarText (int sonarTextIndex) |
Marks the PopupText in Main.popupText at sonarTextIndex as sonar text, assigning sonarText and setting sonar to true . More... | |
static void | ClearAll () |
Sets all PopupTexts in Main.popupText to a new instance and assigns numActive to 0 . | |
static void | ClearSonarText () |
Destroys the PopupText in Main.popupText at the index sonarText if that text has sonar set to true . Note that multiple fishing lures is a common feature of many popular mods, so this method won't clear all PopupText in that situation because only 1 index is tracked. The Projectile.localAI[2] of a bobber projectile is used to store the index of its sonar PopupText. That stored value is offset by +1. | |
static int | NewText (AdvancedPopupRequest request, Vector2 position) |
Creates a new PopupText in Main.popupText at position using the settings from request . The new PopupText is not bound to a specific Item or NPCID. All PopupTexts created using this method have context == PopupTextContext.Advanced and freeAdvanced set to true . More... | |
static int | NewText (PopupTextContext context, int npcNetID, Vector2 position, bool stay5TimesLonger) |
Creates a new PopupText in Main.popupText at position bound to a given npcNetID . More... | |
static int | NewText (PopupTextContext context, Item newItem, int stack, bool noStack=false, bool longText=false) |
Creates a new PopupText in Main.popupText at the center of the picked-up newItem . If a PopupText already exists with the Item.AffixName of newItem , that text will instead be modified unless noStack is true . More... | |
static void | ResetText (PopupText text) |
Resets a PopupText to its default values. More... | |
static void | UpdateItemText () |
Calls Update(int) on all active PopupTexts in Main.popupText and assigns numActive. | |
static string | ValueToName (long coinValue) |
Converts a value in copper coins to a formatted string. More... | |
Public Attributes | |
bool | active |
If true , this PopupText is visible in the world. | |
float | alpha |
The opacity of this PopupText in the range [0f, 1f], where 0f is transparent and 1f is opaque. | |
int | alphaDir = 1 |
The direction this PopupText's alpha changes in. | |
bool | coinText |
If true , this PopupText is specifically for coins. | |
long | coinValue |
The value of coins this PopupText represents in the range [0, 999999999]. | |
Color | color |
The color of this PopupText's text. | |
PopupTextContext | context |
The context in which this PopupText was created. | |
bool | expert |
If true , this PopupText will draw in the Expert Mode rarity color. | |
bool | freeAdvanced |
If true , this PopupText is not bound to an item or NPC. | |
int | lifeTime |
The time in ticks this PopupText will remain for until it starts to disappear. | |
bool | master |
If true , this PopupText will draw in the Master Mode rarity color. | |
string | name |
The text displayed by this PopupText. | |
bool | NoStack |
If true , this PopupText can't be modified when creating a new item PopupText. | |
int | npcNetID |
The NPC type (NPC.type) this PopupText is bound to, or 0 if not bound to an NPC. | |
Vector2 | position |
The position of this PopupText in world coordinates. | |
int | rarity |
The ItemRarityID this PopupText uses for its main color. | |
float | rotation |
The clockwise rotation of this PopupText in radians. | |
float | scale = 1f |
The scale this PopupText draws at. | |
bool | sonar |
Marks this PopupText as this player's Sonar Potion text. | |
long | stack |
The optional stack size appended to name. Will only be displayed is stack > 1 . | |
Vector2 | velocity |
The velocity of this PopupText in world coordinates per tick. | |
Static Public Attributes | |
static int | activeTime = 60 |
The default lifeTime of a PopupText. | |
static int | numActive |
The number of active PopupTexts in Main.popupText. Assigned after UpdateItemText runs. | |
static int | sonarText = -1 |
The index in Main.popupText of the last known sonar text. Assign and clear using AssignAsSonarText(int) and ClearSonarText. | |
Properties | |
bool | notActuallyAnItem [get] |
If true , this PopupText is not for an item. | |
static float | TargetScale [get] |
Represents an in-world floating text object.
|
static |
|
static |
Creates a new PopupText in Main.popupText at position using the settings from request .
The new PopupText is not bound to a specific Item or NPCID.
All PopupTexts created using this method have context == PopupTextContext.Advanced
and freeAdvanced set to true
.
request | The settings for the new PopupText. |
position | The position of the new PopupText in world coordinates. |
-1
if a new PopupText could not be made, if Main.netMode == NetmodeID.Server
, or if the current player has item text disabled (Main.showItemText).
|
static |
Creates a new PopupText in Main.popupText at position bound to a given npcNetID .
context | The PopupTextContext in which this PopupText was created. If context == PopupTextContext.SonarAlert , then color will be a shade of red. |
npcNetID | The NPCID this PopupText represents. |
position | |
stay5TimesLonger | If true , then this PopupText will spawn with lifeTime == 5 * 60 . |
-1
if npcNetID == 0
.
|
static |
Creates a new PopupText in Main.popupText at the center of the picked-up newItem .
If a PopupText already exists with the Item.AffixName of newItem , that text will instead be modified unless noStack is true
.
context | The PopupTextContext in which this PopupText was created. |
newItem | The Item to create the new text from. |
stack | The stack of newItem . |
noStack | If true , always create a new PopupText instead of modifying an existing one. |
longText | If true , then this PopupText will spawn with lifeTime == 5 * 60 . |
-1
if Item.Name is null
.
|
static |
void PopupText.Update | ( | int | whoAmI | ) |
|
static |
Converts a value in copper coins to a formatted string.
coinValue | The value to format in copper coins. |