tModLoader v2023.01
A mod to make and play Terraria mods
|
Inherits Terraria.Entity, and IEntityWithGlobals< GlobalProjectile >.
Classes | |
struct | HallowBossPelletStormInfo |
Public Member Functions | |
void | AI () |
bool | AI_137_CanHit (Vector2 targetPosition) |
Color | AI_156_GetColor () |
Color | AI_171_GetColor () |
HallowBossPelletStormInfo | AI_172_GetPelletStormInfo (int stormIndex) |
int | AI_172_GetPelletStormsCount () |
Color | AI_173_GetColor () |
bool | CanBeReflected () |
bool | CanExplodeTile (int x, int y) |
bool | CanHitWithMeleeWeapon (Entity ent) |
bool | CanHitWithOwnBody (Entity ent) |
void | CheckUsability (Player player, ref bool currentlyUsable) |
void | CloneDefaults (int TypeToClone) |
bool | Colliding (Rectangle myRect, Rectangle targetRect) |
bool | CountsAsClass (DamageClass damageClass) |
bool | CountsAsClass< T > () |
void | CreateImpactExplosion (int dustAmountMultiplier, Vector2 explosionOrigin, ref Point scanAreaStart, ref Point scanAreaEnd, int explosionRange, out bool causedShockwaves) |
void | CreateImpactExplosion2_FlailTileCollision (Vector2 explosionOrigin, bool causedShockwaves, Vector2 velocityBeforeCollision) |
void | Damage () |
void | DefaultToWhip () |
void | ExplodeCrackedTiles (Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ) |
void | ExplodeTiles (Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ, bool wallSplode) |
NPC | FindTargetWithinRange (float maxRange, bool checkCanHit=false) |
int | FindTargetWithLineOfSight (float maxRange=800f) |
Finds the closest NPC to this projectile which can be targeted and which it has line of sight to. More... | |
void | FishingCheck () |
Color | GetAlpha (Color newColor) |
Color | GetCeleb2Color () |
Color | GetFairyQueenWeaponsColor (float alphaChannelMultiplier=1f, float lerpToWhite=0f, float? rawHueOverride=null) |
Color | GetFirstFractalColor () |
Color | GetFloatingDaggerMinionGlowColor () |
T | GetGlobalProjectile< T > (bool exactType=true) |
Gets the instance of the specified GlobalProjectile type. This will throw exceptions on failure. More... | |
T | GetGlobalProjectile< T > (T baseInstance) |
Gets the local instance of the type of the specified GlobalProjectile instance. This will throw exceptions on failure. More... | |
float | GetLastPrismHue (float laserIndex, ref float laserLuminance, ref float laserAlphaMultiplier) |
Rectangle | getRect () |
void | ghostHeal (int dmg, Vector2 Position, Entity victim) |
void | ghostHurt (int dmg, Vector2 Position, Entity victim) |
void | Interrupt (Player player) |
bool | IsAttachedTo (NPC npc) |
bool | IsInRangeOfMeOrMyOwner (Entity entity, float maxDistance, out float myDistance, out float playerDistance, out bool closerIsMe) |
bool | IsInteractible () |
bool | IsInterruptible (Player player) |
void | Kill () |
void | Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks (Point pt, float size, Utils.TileActionAttempt plot) |
void | Minion_FindTargetInRange (int startAttackRange, ref int attackTarget, bool skipIfCannotHitWithOwnBody, Func< Entity, int, bool > customEliminationCheck=null) |
void | ProjectileFixDesperation () |
void | ProjLight () |
void | ResetLocalNPCHitImmunity () |
void | Resize (int newWidth, int newHeight) |
void | SetDefaults (int Type) |
bool | ShouldUseWindPhysics () |
bool | ShouldWallExplode (Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ) |
void | StatusNPC (int i) |
void | StatusPlayer (int i) |
void | StatusPvP (int i) |
override string | ToString () |
bool | TryGetContainerIndex (out int containerIndex) |
bool | TryGetGlobalProjectile< T > (out T result, bool exactType=true) |
Gets the instance of the specified GlobalProjectile type. More... | |
bool | TryGetGlobalProjectile< T > (T baseInstance, out T result) |
Safely attempts to get the local instance of the type of the specified GlobalProjectile instance. More... | |
bool | TurretShouldPersist () |
void | Update (int i) |
void | vampireHeal (int dmg, Vector2 Position, Entity victim) |
void | VanillaAI () |
Public Member Functions inherited from Terraria.Entity | |
float | AngleFrom (Vector2 Source) |
float | AngleTo (Vector2 Destination) |
Vector2 | DirectionFrom (Vector2 Source) |
Vector2 | DirectionTo (Vector2 Destination) |
float | Distance (Vector2 Other) |
float | DistanceSQ (Vector2 Other) |
IEntitySource | GetSource_Accessory (Item item, string? context=null) |
IEntitySource | GetSource_CatchEntity (Entity caughtEntity, string? context=null) |
IEntitySource | GetSource_Death (string? context=null) |
IEntitySource | GetSource_DropAsItem (string? context=null) |
IEntitySource | GetSource_FromAI (string? context=null) |
IEntitySource | GetSource_FromThis (string? context=null) |
IEntitySource | GetSource_GiftOrReward (string? context=null) |
IEntitySource | GetSource_ItemUse (Item item, string? context=null) |
IEntitySource | GetSource_ItemUse_WithPotentialAmmo (Item item, int ammoItemId, string? context=null) |
IEntitySource | GetSource_Loot (string? context=null) |
IEntitySource | GetSource_Misc (string context) |
IEntitySource | GetSource_OnHit (Entity victim, string? context=null) |
IEntitySource | GetSource_OnHurt (Entity attacker, string? context=null) |
IEntitySource | GetSource_OpenItem (int itemType, string? context=null) |
IEntitySource | GetSource_ReleaseEntity (string? context=null) |
IEntitySource | GetSource_TileInteraction (int tileCoordsX, int tileCoordsY, string? context=null) |
bool | WithinRange (Vector2 Target, float MaxRange) |
Static Public Member Functions | |
static Vector2 | AI_158_GetHomeLocation (Player master, int stackedIndex) |
static Vector2 | AI_164_GetHomeLocation (Player master, int stackedIndex, int totalIndexes) |
static void | EmitBlackLightningParticles (NPC targetNPC) |
static void | FillWhipControlPoints (Projectile proj, List< Vector2 > controlPoints) |
static int | FindOldestProjectile () |
static int | GetByUUID (int owner, float uuid) |
static int | GetByUUID (int owner, int uuid) |
static Color | GetGolfTrailColor (Projectile proj) |
static int | GetNextSlot () |
static void | GetWhipSettings (Projectile proj, out float timeToFlyOut, out int segments, out float rangeMultiplier) |
static void | InitializeStaticThings () |
static bool | IsNPCIndexImmuneToProjectileType (int projectileType, int npcIndex) |
static void | KillOldestJavelin (int protectedProjectileIndex, int projectileType, int targetNPCIndex, Point[] bufferForScan) |
static int | NewProjectile (IEntitySource spawnSource, float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner=255, float ai0=0f, float ai1=0f) |
Spawns a projectile into the game world with the given type. The spawn position is given in world coordinates by the X and Y parameters. SpeedX and SpeedY dictate the initial velocity. Damage and KnockBack are self explanitory. Owner is the player who spawned the projectile, almost always Main.myPlayer. ai0 and ai1 will initialize the Projectile.ai[] array with the supplied values. This can be used to pass in information to the Projectile. The Projectile AI code will have to be written to utilize those values. The return value is the index of the spawned Projectile within the Main.projectile array. Make sure that this method is called only by the client in charge of the source causing this projectile to spawn. Failure to do this will result in the projectile spawning once for each player in the world. For example, if Player code uses this method, make sure to first check More... | |
static int | NewProjectile (IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=255, float ai0=0f, float ai1=0f) |
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and a Vector2 to dictate the initial velocity. | |
static Projectile | NewProjectileDirect (IEntitySource spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback, int owner=255, float ai0=0f, float ai1=0f) |
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and a Vector2 to dictate the initial velocity. The return value is the actual Projectile instance rather than the index of the spawned Projectile within the Main.projectile array. A short-hand for More... | |
static void | RandomizeInsanityShadowFor (Entity targetEntity, bool isHostile, out Vector2 spawnposition, out Vector2 spawnvelocity, out float ai0, out float ai1) |
static void | ResetImmunity () |
Static Public Member Functions inherited from Terraria.Entity | |
static IEntitySource | GetSource_NaturalSpawn () |
static ? IEntitySource | GetSource_None () |
static IEntitySource | GetSource_TownSpawn () |
static ? IEntitySource | InheritSource (Entity entity) |
Public Attributes | |
float[] | ai = new float[maxAI] |
int | aiStyle |
int | alpha |
bool | arrow |
int | bannerIdToRespondTo |
bool | bobber |
bool | coldDamage |
bool | counterweight |
int | damage |
bool | decidesManualFallThrough |
int | extraUpdates |
int | frame |
int | frameCounter |
bool | friendly |
float | gfxOffY |
short | glowMask |
bool | hide |
bool | hostile |
int | identity |
int | idStaticNPCHitCooldown = -1 |
bool | ignoreWater |
float | knockBack |
float | light |
float[] | localAI = new float[maxAI] |
int | localNPCHitCooldown = -2 |
int[] | localNPCImmunity = new int[200] |
bool | manualDirectionChange |
int | maxPenetrate = 1 |
bool | minion |
int | minionPos |
float | minionSlots |
string | miscText = "" |
bool | netImportant |
int | netSpam |
bool | netUpdate |
bool | netUpdate2 |
bool | noDropItem |
bool | noEnchantments |
bool | noEnchantmentVisuals |
bool | npcProj |
int | numHits |
int | numUpdates |
Vector2[] | oldPos = new Vector2[10] |
Holds the value of Entity.position from previous updates from newest to oldest. Use for drawing trails. Must be used with ProjectileID.Sets.TrailCacheLength and ProjectileID.Sets.TrailingMode to be used properly. | |
float[] | oldRot = new float[10] |
Holds the value of Projectile.rotation from previous updates from newest to oldest. Use for drawing trails. Must be used with ProjectileID.Sets.TrailCacheLength and ProjectileID.Sets.TrailingMode to be used properly. | |
int[] | oldSpriteDirection = new int[10] |
Holds the value of Projectile.spriteDirection from previous updates from newest to oldest. Use for drawing trails. Must be used with ProjectileID.Sets.TrailCacheLength and ProjectileID.Sets.TrailingMode to be used properly. | |
int | originalDamage |
bool | originatedFromActivableTile |
int | owner = 255 |
bool | ownerHitCheck |
float | ownerHitCheckDistance = 1000f |
int | penetrate = 1 |
int[] | playerImmune = new int[255] |
int | projUUID = -1 |
int | restrikeDelay |
float | rotation |
float | scale = 1f |
bool | sentry |
bool | shouldFallThrough |
int | soundDelay |
int | spriteDirection = 1 |
float | stepSpeed = 1f |
bool | tileCollide |
int | timeLeft |
bool | trap |
int | type |
bool | usesIDStaticNPCImmunity |
bool | usesLocalNPCImmunity |
List< Vector2 > | WhipPointsForCollision = new List<Vector2>() |
WhipSettings | WhipSettings |
Public Attributes inherited from Terraria.Entity | |
bool | active |
int | direction = 1 |
int | height |
bool | honeyWet |
bool | lavaWet |
int | oldDirection |
Vector2 | oldPosition |
Vector2 | oldVelocity |
Vector2 | position |
Vector2 | velocity |
bool | wet |
byte | wetCount |
int | whoAmI |
int | width |
Static Public Attributes | |
const int | ArrowLifeTime = 1200 |
static int | maxAI = 2 |
static uint[][] | perIDStaticNPCImmunity = new uint[972][] |
const int | SentryLifeTime = 7200 |
Properties | |
int | ArmorPenetration [get, set] |
The number of defense points that this projectile can ignore on its own. Cannot be set to negative values. Defaults to 0. On spawn, if this projectile was fired from a weapon, this value has the total armor penetration of the weapon that made the projectile added to itself. | |
bool | ContinuouslyUpdateDamage [get, set] |
If set, Projectile.damage will be recalculated based on Projectile.originalDamage, Projectile.DamageType and the owning player, just like minions and sentries. This has no effect if Projectile.minion or Projectile.sentry is set. | |
int | CritChance [get, set] |
The critical strike chance modifier of this projectile. Cannot be set to negative values. Defaults to 0. On spawn, if this projectile was fired from a weapon, this value has the total critical strike chance of the weapon that made the projectile added to itself. | |
DamageClass | DamageType [get, set] |
The damage type assigned to this projectile, represented as a DamageClass. Leave blank or use DamageClass.Default to prevent damage type scaling of any kind for this projectile. Use DamageClass.Generic/Melee/Ranged/Magic/Summon/Throwing for vanilla damage types. Refer to ExampleMod for more information on how to create and use your own damage types. | |
RefReadOnlyArray< Instanced< GlobalProjectile > > | Globals [get] |
int | MaxUpdates [get, set] |
ModProjectile | ModProjectile [get, set] |
string | Name [get, set] |
float | Opacity [get, set] |
NPC | OwnerMinionAttackTargetNPC [get] |
bool | WipableTurret [get] |
Properties inherited from Terraria.Entity | |
Vector2 | Bottom [get, set] |
Vector2 | BottomLeft [get, set] |
Vector2 | BottomRight [get, set] |
Vector2 | Center [get, set] |
Rectangle | Hitbox [get, set] |
Vector2 | Left [get, set] |
Vector2 | Right [get, set] |
Vector2 | Size [get, set] |
Vector2 | Top [get, set] |
Vector2 | TopLeft [get, set] |
Vector2 | TopRight [get, set] |
virtual Vector2 | VisualPosition [get] |
bool Terraria.Projectile.CountsAsClass< T > | ( | ) |
T | : | DamageClass | |
T | : | CountsAsClass | |
T | : | ModContent.GetInstance<T>() |
int Terraria.Projectile.FindTargetWithLineOfSight | ( | float | maxRange = 800f | ) |
Finds the closest NPC to this projectile which can be targeted and which it has line of sight to.
maxRange | The maximum range at which this projectile should search out a target, measured in pixels. Defaults to 800 (50 tiles). Each tile, for reference, measures out to be 16x16 pixels. |
T Terraria.Projectile.GetGlobalProjectile< T > | ( | bool | exactType = true | ) |
Gets the instance of the specified GlobalProjectile type. This will throw exceptions on failure.
KeyNotFoundException |
|
T | : | GlobalProjectile | |
T | : | GlobalType.GetGlobal | |
T | : | Projectile | |
T | : | GlobalProjectile | |
T | : | T | |
T | : | globalProjectiles | |
T | : | exactType |
T Terraria.Projectile.GetGlobalProjectile< T > | ( | T | baseInstance | ) |
Gets the local instance of the type of the specified GlobalProjectile instance. This will throw exceptions on failure.
KeyNotFoundException |
|
T | : | GlobalProjectile | |
T | : | GlobalType.GetGlobal | |
T | : | Projectile | |
T | : | GlobalProjectile | |
T | : | T | |
T | : | globalProjectiles | |
T | : | baseInstance |
|
static |
Spawns a projectile into the game world with the given type. The spawn position is given in world coordinates by the X and Y parameters. SpeedX and SpeedY dictate the initial velocity. Damage and KnockBack are self explanitory. Owner is the player who spawned the projectile, almost always Main.myPlayer. ai0 and ai1 will initialize the Projectile.ai[] array with the supplied values. This can be used to pass in information to the Projectile. The Projectile AI code will have to be written to utilize those values. The return value is the index of the spawned Projectile within the Main.projectile array.
Make sure that this method is called only by the client in charge of the source causing this projectile to spawn. Failure to do this will result in the projectile spawning once for each player in the world. For example, if Player code uses this method, make sure to first check
if(Main.myPlayer == Player.whoAmI)
to ensure that only the local player spawns the projectile.
Projectiles spawning other projectiles should check if(Main.myPlayer == Projectile.owner)
If the source is an NPC or non-player owned projectile, checking if (Main.netMode != NetmodeID.MultiplayerClient)
will ensure that clients don't attempt to spawn the projectile.
spawnSource | |
X | |
Y | |
SpeedX | |
SpeedY | |
Type | Either an ProjectileID entry or ModContent.ProjectileType<T>, for example ProjectileID.FireArrow or ModContent.ProjectileType<MyModProjectile>() |
Damage | |
KnockBack | |
Owner | |
ai0 | |
ai1 |
|
static |
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and a Vector2 to dictate the initial velocity. The return value is the actual Projectile instance rather than the index of the spawned Projectile within the Main.projectile array.
A short-hand for
Main.projectile[Projectile.NewProjectile(...)]
bool Terraria.Projectile.TryGetGlobalProjectile< T > | ( | out T | result, |
bool | exactType = true |
||
) |
Gets the instance of the specified GlobalProjectile type.
T | : | GlobalProjectile | |
T | : | GlobalType.TryGetGlobal | |
T | : | GlobalProjectile | |
T | : | T | |
T | : | globalProjectiles | |
T | : | exactType | |
T | : | out | |
T | : | result |
bool Terraria.Projectile.TryGetGlobalProjectile< T > | ( | T | baseInstance, |
out T | result | ||
) |
Safely attempts to get the local instance of the type of the specified GlobalProjectile instance.
T | : | GlobalProjectile | |
T | : | GlobalType.TryGetGlobal | |
T | : | GlobalProjectile | |
T | : | T | |
T | : | globalProjectiles | |
T | : | baseInstance | |
T | : | out | |
T | : | result |