tModLoader v2024.10
A mod to make and play Terraria mods
|
Public Types | |
enum | TileCounterType { Tree , DisplayDoll , HatRack , WindyGrass , MultiTileGrass , MultiTileVine , Vine , BiomeGrass , VoidLens , ReverseVine , TeleportationPylon , MasterTrophy , AnyDirectionalGrass , Count } |
Public Member Functions | |
TileDrawing (TilePaintSystemV2 paintSystem) | |
void | AddSpecialLegacyPoint (int x, int y) |
Registers a tile coordinate to have additional drawing code executed after all tiles are drawn. ModTile.SpecialDraw (or GlobalTile.SpecialDraw(int, int, int, SpriteBatch)) will be called with the same coordinates after all tiles have been rendered. For multitiles, make sure to only call this for the top left corner of the multitile to prevent duplicate draws by checking TileObjectData.IsTopLeft(int, int) first. This should be called in ModTile.DrawEffects(int, int, SpriteBatch, ref TileDrawInfo) (or GlobalTile.DrawEffects(int, int, int, SpriteBatch, ref TileDrawInfo)) This is useful for drawing additional visuals to a tile, especially visuals that might render outside the bounds of a single Tile. Attempting to draw outside the bounds will not work in normal tile drawing methods because the visuals will be overwritten by the next tile drawn. Some examples include how the TileID.LihzahrdAltar draws a sun texture hovering over the tile and how TileID.ItemFrame draws the contained item sprite over the tile. | |
void | AddSpecialLegacyPoint (Point p) |
void | AddSpecialPoint (int x, int y, TileCounterType type) |
Registers a tile coordinate to use custom drawing code corresponding to the TileCounterType provided. This is mostly used to apply wind and player interaction effects to tiles. For multitiles, make sure to only call this for the top left corner of the multitile to prevent duplicate draws by checking TileObjectData.IsTopLeft(int, int) first. This should be called in ModTile.PreDraw (or GlobalTile.PreDraw ) and false should be returned to prevent the default tile drawing. | |
void | ClearCachedTileDraws (bool solidLayer) |
void | CrawlToBottomOfReverseVineAndAddSpecialPoint (int j, int i) |
Finds the bottom of a tile chain of reverse vine tiles and calls AddSpecialPoint using TileCounterType.ReverseVine if not already registered for custom drawing. See TileID.Sets.ReverseVineThreads. | |
void | CrawlToTopOfVineAndAddSpecialPoint (int j, int i) |
Finds the top of a tile chain of vine tiles and calls AddSpecialPoint using TileCounterType.Vine if not already registered for custom drawing. See TileID.Sets.VineThreads. | |
void | Draw (bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride=-1) |
void | DrawLiquidBehindTiles (int waterStyleOverride=-1) |
void | EmitLivingTreeLeaf (int i, int j, int leafGoreType) |
Emits a single living tree leaf or other gore instance directly below the target tile. With a 50% chance, also emits a second leaf or other gore instance directly to the side of the target tile, dependent on wind direction. Used by vanilla's two types of Living Trees, from which this method and its two submethods get their collective name. More... | |
void | EmitLivingTreeLeaf_Below (int x, int y, int leafGoreType) |
Emits a single living tree leaf or other gore instance directly below the target tile. More... | |
void | EmitLivingTreeLeaf_Sideways (int x, int y, int leafGoreType) |
Emits a single living tree leaf or other gore instance directly to the side of the target tile, dependent on wind direction. More... | |
void | GetTileDrawData (int x, int y, Tile tileCache, ushort typeCache, ref short tileFrameX, ref short tileFrameY, out int tileWidth, out int tileHeight, out int tileTop, out int halfBrickHeight, out int addFrX, out int addFrY, out SpriteEffects tileSpriteEffect, out Texture2D glowTexture, out Rectangle glowSourceRect, out Color glowColor) |
Texture2D | GetTileDrawTexture (Tile tile, int tileX, int tileY) |
Texture2D | GetTileDrawTexture (Tile tile, int tileX, int tileY, int paintOverride) |
void | GetTileOutlineInfo (int x, int y, ushort typeCache, ref Color tileLight, ref Texture2D highlightTexture, ref Color highlightColor) |
float | GetWindCycle (int x, int y, double windCounter) |
Fetches the degree to which wind would/should affect a tile at the given location. More... | |
float | GetWindGridPush (int i, int j, int pushAnimationTimeTotal, float pushForcePerFrame) |
Determines how much wind should affect a theoretical tile at the target location on the current update tick. More... | |
float | GetWindGridPushComplex (int i, int j, int pushAnimationTimeTotal, float totalPushForce, int loops, bool flipDirectionPerLoop) |
Determines how much wind should affect a theoretical tile at the target location on the current update tick. More complex version of GetWindGridPush. More... | |
void | PostDrawTiles (bool solidLayer, bool forRenderTargets, bool intoRenderTargets) |
void | PreDrawTiles (bool solidLayer, bool forRenderTargets, bool intoRenderTargets) |
void | PrepareForAreaDrawing (int firstTileX, int lastTileX, int firstTileY, int lastTileY, bool prepareLazily) |
void | PreparePaintForTilesOnScreen () |
bool | ShouldSwayInWind (int x, int y, Tile tileCache) |
Determines whether or not the tile at the given location should be able to sway in the wind. More... | |
void | SpecificHacksForCapture () |
void | Update () |
Static Public Member Functions | |
static int | GetBigAnimalCageFrame (int x, int y, int tileFrameX, int tileFrameY) |
static int | GetSmallAnimalCageFrame (int x, int y, int tileFrameX, int tileFrameY) |
static int | GetTreeVariant (int x, int y) |
static int | GetWaterAnimalCageFrame (int x, int y, int tileFrameX, int tileFrameY) |
static bool | IsTileDangerous (int tileX, int tileY, Player player) |
Checks if a tile at the given coordinates counts towards tile coloring from the Dangersense buff. Vanilla only uses Main.LocalPlayer for player | |
static bool | IsVisible (Tile tile) |
Returns true if the tile is visible. Tiles painted with Echo Coating as well as the Echo Platform, Echo Block, and Ghostly Stinkbug Blocker tiles will all be invisible unless the player has Echo Sight (Nearby active Echo Chamber tile or wearing Spectre Goggles) More... | |
Properties | |
WindGrid | Wind [get] |
The wind grid used to exert wind effects on tiles. | |
Enumerator | |
---|---|
WindyGrass | Tile will sway as if anchored below (1x1 tile). Affected by wind and player interaction. Used automatically by tiles in TileID.Sets.SwaysInWindBasic. |
MultiTileGrass | Tile will sway as if anchored below. Affected by wind but not player interaction. Used by TileID.PlantDetritus, TileID.Sunflower. Tiles need to assign TileID.Sets.MultiTileSway and use as directed. |
MultiTileVine | Tile will sway as if anchored above. Affected by wind and player interaction. Used by TileID.Banners, TileID.Chandeliers, TileID.HangingLanterns, TileID.FireflyinaBottle. Tiles need to assign TileID.Sets.MultiTileSway and use as directed. |
Vine | Tile chain will sway as if anchored above. Affected by wind and player interaction. Used by all varieties of TileID.Vines. Tiles need to assign TileID.Sets.VineThreads and use as directed. |
ReverseVine | Tile chain will sway as if anchored below. Affected by wind and player interaction. Used by TileID.Seaweed, although seaweed grows below the wind limit so it isn't affected. Tiles need to assign TileID.Sets.ReverseVineThreads and use as directed. |
void TileDrawing.EmitLivingTreeLeaf | ( | int | i, |
int | j, | ||
int | leafGoreType | ||
) |
Emits a single living tree leaf or other gore instance directly below the target tile.
With a 50% chance, also emits a second leaf or other gore instance directly to the side of the target tile, dependent on wind direction.
Used by vanilla's two types of Living Trees, from which this method and its two submethods get their collective name.
i | The X coordinate of the target tile. |
j | The Y coordinate of the target tile. |
leafGoreType | The numerical ID of the leaf or other gore instance that should be spawned. |
void TileDrawing.EmitLivingTreeLeaf_Below | ( | int | x, |
int | y, | ||
int | leafGoreType | ||
) |
Emits a single living tree leaf or other gore instance directly below the target tile.
x | The X coordinate of the target tile. |
y | The Y coordinate of the target tile. |
leafGoreType | The numerical ID of the leaf or other gore instance that should be spawned. |
void TileDrawing.EmitLivingTreeLeaf_Sideways | ( | int | x, |
int | y, | ||
int | leafGoreType | ||
) |
Emits a single living tree leaf or other gore instance directly to the side of the target tile, dependent on wind direction.
x | The X coordinate of the target tile. |
y | The Y coordinate of the target tile. |
leafGoreType | The numerical ID of the leaf or other gore instance that should be spawned. |
float TileDrawing.GetWindCycle | ( | int | x, |
int | y, | ||
double | windCounter | ||
) |
Fetches the degree to which wind would/should affect a tile at the given location.
x | The X coordinate of the theoretical target tile. |
y | The Y coordinate of the theoretical target tile. |
windCounter |
float TileDrawing.GetWindGridPush | ( | int | i, |
int | j, | ||
int | pushAnimationTimeTotal, | ||
float | pushForcePerFrame | ||
) |
Determines how much wind should affect a theoretical tile at the target location on the current update tick.
i | The X coordinate of the theoretical target tile. |
j | The Y coordinate of the theoretical target tile. |
pushAnimationTimeTotal | The total amount of time, in ticks, that a wind push cycle for the theoretical target tile should last for. |
pushForcePerFrame | The amount which wind should affect the theoretical target tile per frame. |
float TileDrawing.GetWindGridPushComplex | ( | int | i, |
int | j, | ||
int | pushAnimationTimeTotal, | ||
float | totalPushForce, | ||
int | loops, | ||
bool | flipDirectionPerLoop | ||
) |
Determines how much wind should affect a theoretical tile at the target location on the current update tick.
More complex version of GetWindGridPush.
i | The X coordinate of the theoretical target tile. |
j | The Y coordinate of the theoretical target tile. |
pushAnimationTimeTotal | The total amount of time, in ticks, that a wind push cycle for the theoretical target tile should last for. |
totalPushForce | |
loops | |
flipDirectionPerLoop |
|
static |
Returns true if the tile is visible. Tiles painted with Echo Coating as well as the Echo Platform, Echo Block, and Ghostly Stinkbug Blocker tiles will all be invisible unless the player has Echo Sight (Nearby active Echo Chamber tile or wearing Spectre Goggles)
tile |
bool TileDrawing.ShouldSwayInWind | ( | int | x, |
int | y, | ||
Tile | tileCache | ||
) |
Determines whether or not the tile at the given location should be able to sway in the wind.
x | The X coordinate of the given tile. |
y | The Y coordinate of the given tile. |
tileCache | The tile to determine the sway-in-wind-ability of. |