Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.GlobalProjectile Class Reference

This class allows you to modify and use hooks for all projectiles, including vanilla projectiles. Create an instance of an overriding class then call Mod.AddGlobalProjectile to use this. More...

+ Collaboration diagram for Terraria.ModLoader.GlobalProjectile:

Public Member Functions

virtual void AI (Projectile projectile)
 Allows you to determine how any projectile behaves. This will only be called if PreAI returns true. More...
 
virtual bool Autoload (ref string name)
 Allows you to automatically load a GlobalProjectile instead of using Mod.AddGlobalProjectile. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload or to control the internal name. More...
 
virtual bool CanCutTiles (Projectile projectile)
 Return true or false to specify if the projectile can cut tiles, like vines. Return null for vanilla decision. More...
 
virtual bool CanDamage (Projectile projectile)
 Whether or not the given projectile is capable of killing tiles (such as grass) and damaging NPCs/players. Return false to prevent it from doing any sort of damage. Returns true by default. More...
 
virtual bool CanHitNPC (Projectile projectile, NPC target)
 Allows you to determine whether a projectile can hit the given NPC. Return true to allow hitting the target, return false to block the projectile from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default. More...
 
virtual bool CanHitPlayer (Projectile projectile, Player target)
 Allows you to determine whether a hostile projectile can hit the given player. Return false to block the projectile from hitting the target. Returns true by default. More...
 
virtual bool CanHitPvp (Projectile projectile, Player target)
 Allows you to determine whether a projectile can hit the given opponent player. Return false to block the projectile from hitting the target. Returns true by default. More...
 
virtual bool CanUseGrapple (int type, Player player)
 Whether or not a grappling hook that shoots this type of projectile can be used by the given player. Return null to use the default code (whether or not the player is in the middle of firing the grappling hook). Returns null by default. More...
 
virtual GlobalProjectile Clone ()
 Returns a clone of this GlobalProjectile. By default this will return a memberwise clone; you will want to override this if your GlobalProjectile contains object references. Only called if CloneNewInstances && InstancePerEntity More...
 
virtual bool Colliding (Projectile projectile, Rectangle projHitbox, Rectangle targetHitbox)
 Allows you to use custom collision detection between a projectile and a player or NPC that the projectile can damage. Useful for things like diagonal lasers, projectiles that leave a trail behind them, etc. More...
 
virtual void CutTiles (Projectile projectile)
 Code ran when the projectile cuts tiles. Only runs if CanCutTiles() returns true. Useful when programming lasers and such. More...
 
virtual void DrawBehind (Projectile projectile, int index, List< int > drawCacheProjsBehindNPCsAndTiles, List< int > drawCacheProjsBehindNPCs, List< int > drawCacheProjsBehindProjectiles, List< int > drawCacheProjsOverWiresUI)
 When used in conjunction with "projectile.hide = true", allows you to specify that this projectile should be drawn behind certain elements. Add the index to one and only one of the lists. For example, the Nebula Arcanum projectile draws behind NPCs and tiles. More...
 
virtual Color GetAlpha (Projectile projectile, Color lightColor)
 Allows you to determine the color and transparency in which a projectile is drawn. Return null to use the default color (normally light and buff color). Returns null by default. More...
 
virtual void GrapplePullSpeed (Projectile projectile, Player player, ref float speed)
 The speed at which the grapple pulls the player after hitting something. Defaults to 11, but the Bat Hook uses 16. More...
 
virtual void GrappleRetreatSpeed (Projectile projectile, Player player, ref float speed)
 The speed at which the grapple retreats back to the player after not hitting anything. Defaults to 11, but vanilla hooks go up to 24. More...
 
GlobalProjectile Instance (Projectile projectile)
 
virtual void Kill (Projectile projectile, int timeLeft)
 Allows you to control what happens when a projectile is killed (for example, creating dust or making sounds). More...
 
virtual bool MinionContactDamage (Projectile projectile)
 Whether or not a minion can damage NPCs by touching them. Returns false by default. Note that this will only be used if the projectile is considered a pet. More...
 
virtual void ModifyDamageHitbox (Projectile projectile, ref Rectangle hitbox)
 Allows you to change the hitbox used by a projectile for damaging players and NPCs. More...
 
virtual void ModifyHitNPC (Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 Allows you to modify the damage, knockback, etc., that a projectile does to an NPC. More...
 
virtual void ModifyHitPlayer (Projectile projectile, Player target, ref int damage, ref bool crit)
 Allows you to modify the damage, etc., that a hostile projectile does to a player. More...
 
virtual void ModifyHitPvp (Projectile projectile, Player target, ref int damage, ref bool crit)
 Allows you to modify the damage, etc., that a projectile does to an opponent player. More...
 
virtual GlobalProjectile NewInstance (Projectile projectile)
 Create a new instance of this GlobalProjectile for a Projectile instance. Called at the end of Projectile.SetDefaults. If CloneNewInstances is true, just calls Clone() Otherwise calls the default constructor and copies fields More...
 
virtual void NumGrappleHooks (Projectile projectile, Player player, ref int numHooks)
 How many of this type of grappling hook the given player can latch onto blocks before the hooks start disappearing. Change the numHooks parameter to determine this; by default it will be 3. More...
 
virtual void OnHitNPC (Projectile projectile, NPC target, int damage, float knockback, bool crit)
 Allows you to create special effects when a projectile hits an NPC (for example, inflicting debuffs). More...
 
virtual void OnHitPlayer (Projectile projectile, Player target, int damage, bool crit)
 Allows you to create special effects when a hostile projectile hits a player. More...
 
virtual void OnHitPvp (Projectile projectile, Player target, int damage, bool crit)
 Allows you to create special effects when a projectile hits an opponent player. More...
 
virtual bool OnTileCollide (Projectile projectile, Vector2 oldVelocity)
 Allows you to determine what happens when a projectile collides with a tile. OldVelocity is the velocity before tile collision. The velocity that takes tile collision into account can be found with projectile.velocity. Return true to allow the vanilla tile collision code to take place (which normally kills the projectile). Returns true by default. More...
 
virtual void PostAI (Projectile projectile)
 Allows you to determine how any projectile behaves. This will be called regardless of what PreAI returns. More...
 
virtual void PostDraw (Projectile projectile, SpriteBatch spriteBatch, Color lightColor)
 Allows you to draw things in front of a projectile. This method is called even if PreDraw returns false. More...
 
virtual bool PreAI (Projectile projectile)
 Allows you to determine how any projectile behaves. Return false to stop the vanilla AI and the AI hook from being run. Returns true by default. More...
 
virtual bool PreDraw (Projectile projectile, SpriteBatch spriteBatch, Color lightColor)
 Allows you to draw things behind a projectile, or to modify the way the projectile is drawn. Return false to stop the game from drawing the projectile (useful if you're manually drawing the projectile). Returns true by default. More...
 
virtual bool PreDrawExtras (Projectile projectile, SpriteBatch spriteBatch)
 Allows you to draw things behind a projectile. Returns false to stop the game from drawing extras textures related to the projectile (for example, the chains for grappling hooks), useful if you're manually drawing the extras. Returns true by default. More...
 
virtual bool PreKill (Projectile projectile, int timeLeft)
 Allows you to determine whether the vanilla code for Kill and the Kill hook will be called. Return false to stop them from being called. Returns true by default. Note that this does not stop the projectile from dying. More...
 
virtual void SetDefaults (Projectile projectile)
 Allows you to set the properties of any and every projectile that gets created. More...
 
virtual bool ShouldUpdatePosition (Projectile projectile)
 Whether or not the given projectile should update its position based on factors such as its velocity, whether it is in liquid, etc. Return false to make its velocity have no effect on its position. Returns true by default. More...
 
virtual bool SingleGrappleHook (int type, Player player)
 Whether or not a grappling hook can only have one hook per player in the world at a time. Return null to use the vanilla code. Returns null by default. More...
 
virtual bool TileCollideStyle (Projectile projectile, ref int width, ref int height, ref bool fallThrough)
 Allows you to determine how a projectile interacts with tiles. Width and height determine the projectile's hitbox for tile collision, and default to -1. Leave them as -1 to use the projectile's real size. Fallthrough determines whether the projectile can fall through platforms, etc., and defaults to true. More...
 
virtual void UseGrapple (Player player, ref int type)
 This code is called whenever the player uses a grappling hook that shoots this type of projectile. Use it to change what kind of hook is fired (for example, the Dual Hook does this), to kill old hook projectiles, etc. More...
 

Public Attributes

virtual bool CloneNewInstances => false
 Whether instances of this GlobalProjectile are created through Clone or constructor (by default implementations of NewInstance and Clone()). Defaults to false (using default constructor). More...
 
virtual bool InstancePerEntity => false
 Whether to create a new GlobalProjectile instance for every Projectile that exists. Useful for storing information on a projectile. Defaults to false. Return true if you need to store information (have non-static fields). More...
 

Properties

Mod mod [get, set]
 The mod to which this GlobalProjectile belongs. More...
 
string Name [get, set]
 The name of this GlobalProjectile instance. More...
 

Detailed Description

This class allows you to modify and use hooks for all projectiles, including vanilla projectiles. Create an instance of an overriding class then call Mod.AddGlobalProjectile to use this.

Definition at line 11 of file GlobalProjectile.cs.

Member Function Documentation

virtual void Terraria.ModLoader.GlobalProjectile.AI ( Projectile  projectile)
virtual

Allows you to determine how any projectile behaves. This will only be called if PreAI returns true.

Parameters
projectile

Definition at line 101 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.AI().

101  {
102  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.Autoload ( ref string  name)
virtual

Allows you to automatically load a GlobalProjectile instead of using Mod.AddGlobalProjectile. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload or to control the internal name.

Parameters
name
Returns

Definition at line 37 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.Mod.AutoloadGlobalProjectile().

37  {
38  return mod.Properties.Autoload;
39  }
ModProperties Properties
Definition: Mod.cs:49
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...
Mod mod
The mod to which this GlobalProjectile belongs.

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.CanCutTiles ( Projectile  projectile)
virtual

Return true or false to specify if the projectile can cut tiles, like vines. Return null for vanilla decision.

Parameters
projectile
Returns

Definition at line 165 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.CanCutTiles().

165  {
166  return null;
167  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.CanDamage ( Projectile  projectile)
virtual

Whether or not the given projectile is capable of killing tiles (such as grass) and damaging NPCs/players. Return false to prevent it from doing any sort of damage. Returns true by default.

Parameters
projectile
Returns

Definition at line 181 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.CanDamage().

181  {
182  return true;
183  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.CanHitNPC ( Projectile  projectile,
NPC  target 
)
virtual

Allows you to determine whether a projectile can hit the given NPC. Return true to allow hitting the target, return false to block the projectile from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default.

Parameters
projectile
target
Returns

Definition at line 208 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.CanHitNPC().

208  {
209  return null;
210  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.CanHitPlayer ( Projectile  projectile,
Player  target 
)
virtual

Allows you to determine whether a hostile projectile can hit the given player. Return false to block the projectile from hitting the target. Returns true by default.

Parameters
projectile
target
Returns

Definition at line 271 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.CanHitPlayer().

271  {
272  return true;
273  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.CanHitPvp ( Projectile  projectile,
Player  target 
)
virtual

Allows you to determine whether a projectile can hit the given opponent player. Return false to block the projectile from hitting the target. Returns true by default.

Parameters
projectile
target
Returns

Definition at line 241 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.CanHitPvp().

241  {
242  return true;
243  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.CanUseGrapple ( int  type,
Player  player 
)
virtual

Whether or not a grappling hook that shoots this type of projectile can be used by the given player. Return null to use the default code (whether or not the player is in the middle of firing the grappling hook). Returns null by default.

Definition at line 361 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.CanUseGrapple().

361  {
362  return null;
363  }

+ Here is the caller graph for this function:

virtual GlobalProjectile Terraria.ModLoader.GlobalProjectile.Clone ( )
virtual

Returns a clone of this GlobalProjectile. By default this will return a memberwise clone; you will want to override this if your GlobalProjectile contains object references. Only called if CloneNewInstances && InstancePerEntity

virtual bool Terraria.ModLoader.GlobalProjectile.Colliding ( Projectile  projectile,
Rectangle  projHitbox,
Rectangle  targetHitbox 
)
virtual

Allows you to use custom collision detection between a projectile and a player or NPC that the projectile can damage. Useful for things like diagonal lasers, projectiles that leave a trail behind them, etc.

Parameters
projectile
projHitbox
targetHitbox
Returns

Definition at line 302 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.Colliding().

302  {
303  return null;
304  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.CutTiles ( Projectile  projectile)
virtual

Code ran when the projectile cuts tiles. Only runs if CanCutTiles() returns true. Useful when programming lasers and such.

Parameters
projectile

Definition at line 173 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.CutTiles().

173  {
174  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.DrawBehind ( Projectile  projectile,
int  index,
List< int >  drawCacheProjsBehindNPCsAndTiles,
List< int >  drawCacheProjsBehindNPCs,
List< int >  drawCacheProjsBehindProjectiles,
List< int >  drawCacheProjsOverWiresUI 
)
virtual

When used in conjunction with "projectile.hide = true", allows you to specify that this projectile should be drawn behind certain elements. Add the index to one and only one of the lists. For example, the Nebula Arcanum projectile draws behind NPCs and tiles.

Parameters
projectile
index
drawCacheProjsBehindNPCsAndTiles
drawCacheProjsBehindNPCs
drawCacheProjsBehindProjectiles
drawCacheProjsOverWiresUI

Definition at line 355 of file GlobalProjectile.cs.

355  {
356  }
virtual Color Terraria.ModLoader.GlobalProjectile.GetAlpha ( Projectile  projectile,
Color  lightColor 
)
virtual

Allows you to determine the color and transparency in which a projectile is drawn. Return null to use the default color (normally light and buff color). Returns null by default.

Parameters
projectile
lightColor
Returns

Definition at line 312 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.GetAlpha().

312  {
313  return null;
314  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.GrapplePullSpeed ( Projectile  projectile,
Player  player,
ref float  speed 
)
virtual

The speed at which the grapple pulls the player after hitting something. Defaults to 11, but the Bat Hook uses 16.

Definition at line 393 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.GrapplePullSpeed().

393  {
394  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.GrappleRetreatSpeed ( Projectile  projectile,
Player  player,
ref float  speed 
)
virtual

The speed at which the grapple retreats back to the player after not hitting anything. Defaults to 11, but vanilla hooks go up to 24.

Definition at line 387 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.GrappleRetreatSpeed().

387  {
388  }

+ Here is the caller graph for this function:

GlobalProjectile Terraria.ModLoader.GlobalProjectile.Instance ( Projectile  projectile)

Referenced by Terraria.ModLoader.ProjectileLoader.AI(), Terraria.ModLoader.ProjectileLoader.CanCutTiles(), Terraria.ModLoader.ProjectileLoader.CanDamage(), Terraria.ModLoader.ProjectileLoader.CanHitNPC(), Terraria.ModLoader.ProjectileLoader.CanHitPlayer(), Terraria.ModLoader.ProjectileLoader.CanHitPvp(), Terraria.ModLoader.ProjectileLoader.Colliding(), Terraria.ModLoader.ProjectileLoader.CutTiles(), Terraria.ModLoader.ProjectileLoader.GetAlpha(), Terraria.ModLoader.ProjectileLoader.GrapplePullSpeed(), Terraria.ModLoader.ProjectileLoader.GrappleRetreatSpeed(), Terraria.ModLoader.ProjectileLoader.Kill(), Terraria.ModLoader.ProjectileLoader.MinionContactDamage(), Terraria.ModLoader.ProjectileLoader.ModifyDamageHitbox(), Terraria.ModLoader.ProjectileLoader.ModifyHitNPC(), Terraria.ModLoader.ProjectileLoader.ModifyHitPlayer(), Terraria.ModLoader.ProjectileLoader.ModifyHitPvp(), Terraria.ModLoader.ProjectileLoader.NumGrappleHooks(), Terraria.ModLoader.ProjectileLoader.OnHitNPC(), Terraria.ModLoader.ProjectileLoader.OnHitPlayer(), Terraria.ModLoader.ProjectileLoader.OnHitPvp(), Terraria.ModLoader.ProjectileLoader.OnTileCollide(), Terraria.ModLoader.ProjectileLoader.PostAI(), Terraria.ModLoader.ProjectileLoader.PostDraw(), Terraria.ModLoader.ProjectileLoader.PreAI(), Terraria.ModLoader.ProjectileLoader.PreDraw(), Terraria.ModLoader.ProjectileLoader.PreDrawExtras(), Terraria.ModLoader.ProjectileLoader.PreKill(), Terraria.ModLoader.ProjectileLoader.ShouldUpdatePosition(), and Terraria.ModLoader.ProjectileLoader.TileCollideStyle().

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.Kill ( Projectile  projectile,
int  timeLeft 
)
virtual

Allows you to control what happens when a projectile is killed (for example, creating dust or making sounds).

Parameters
projectile
timeLeft

Definition at line 157 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.Kill().

157  {
158  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.MinionContactDamage ( Projectile  projectile)
virtual

Whether or not a minion can damage NPCs by touching them. Returns false by default. Note that this will only be used if the projectile is considered a pet.

Parameters
projectile
Returns

Definition at line 190 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.MinionContactDamage().

190  {
191  return false;
192  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.ModifyDamageHitbox ( Projectile  projectile,
ref Rectangle  hitbox 
)
virtual

Allows you to change the hitbox used by a projectile for damaging players and NPCs.

Parameters
projectile
hitbox

Definition at line 199 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.ModifyDamageHitbox().

199  {
200  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.ModifyHitNPC ( Projectile  projectile,
NPC  target,
ref int  damage,
ref float  knockback,
ref bool  crit,
ref int  hitDirection 
)
virtual

Allows you to modify the damage, knockback, etc., that a projectile does to an NPC.

Parameters
projectile
target
damage
knockback
crit
hitDirection

Definition at line 221 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.ModifyHitNPC().

221  {
222  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.ModifyHitPlayer ( Projectile  projectile,
Player  target,
ref int  damage,
ref bool  crit 
)
virtual

Allows you to modify the damage, etc., that a hostile projectile does to a player.

Parameters
projectile
target
damage
crit

Definition at line 282 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.ModifyHitPlayer().

282  {
283  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.ModifyHitPvp ( Projectile  projectile,
Player  target,
ref int  damage,
ref bool  crit 
)
virtual

Allows you to modify the damage, etc., that a projectile does to an opponent player.

Parameters
projectile
target
damage
crit

Definition at line 252 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.ModifyHitPvp().

252  {
253  }

+ Here is the caller graph for this function:

virtual GlobalProjectile Terraria.ModLoader.GlobalProjectile.NewInstance ( Projectile  projectile)
virtual

Create a new instance of this GlobalProjectile for a Projectile instance. Called at the end of Projectile.SetDefaults. If CloneNewInstances is true, just calls Clone() Otherwise calls the default constructor and copies fields

Definition at line 69 of file GlobalProjectile.cs.

References Terraria.ModLoader.GlobalProjectile.mod, and Terraria.ModLoader.GlobalProjectile.Name.

69  {
70  if (CloneNewInstances) {
71  return Clone();
72  }
73  GlobalProjectile copy = (GlobalProjectile)Activator.CreateInstance(GetType());
74  copy.mod = mod;
75  copy.Name = Name;
76  copy.index = index;
77  copy.instanceIndex = instanceIndex;
78  return copy;
79  }
string Name
The name of this GlobalProjectile instance.
virtual bool CloneNewInstances
Whether instances of this GlobalProjectile are created through Clone or constructor (by default imple...
virtual GlobalProjectile Clone()
Returns a clone of this GlobalProjectile. By default this will return a memberwise clone; you will wa...
virtual string Name
Stores the name of the mod. This name serves as the mod&#39;s identification, and also helps with saving ...
Definition: Mod.cs:39
Mod mod
The mod to which this GlobalProjectile belongs.
virtual void Terraria.ModLoader.GlobalProjectile.NumGrappleHooks ( Projectile  projectile,
Player  player,
ref int  numHooks 
)
virtual

How many of this type of grappling hook the given player can latch onto blocks before the hooks start disappearing. Change the numHooks parameter to determine this; by default it will be 3.

Definition at line 381 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.NumGrappleHooks().

381  {
382  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.OnHitNPC ( Projectile  projectile,
NPC  target,
int  damage,
float  knockback,
bool  crit 
)
virtual

Allows you to create special effects when a projectile hits an NPC (for example, inflicting debuffs).

Parameters
projectile
target
damage
knockback
crit

Definition at line 232 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.OnHitNPC().

232  {
233  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.OnHitPlayer ( Projectile  projectile,
Player  target,
int  damage,
bool  crit 
)
virtual

Allows you to create special effects when a hostile projectile hits a player.

Parameters
projectile
target
damage
crit

Definition at line 292 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.OnHitPlayer().

292  {
293  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.OnHitPvp ( Projectile  projectile,
Player  target,
int  damage,
bool  crit 
)
virtual

Allows you to create special effects when a projectile hits an opponent player.

Parameters
projectile
target
damage
crit

Definition at line 262 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.OnHitPvp().

262  {
263  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.OnTileCollide ( Projectile  projectile,
Vector2  oldVelocity 
)
virtual

Allows you to determine what happens when a projectile collides with a tile. OldVelocity is the velocity before tile collision. The velocity that takes tile collision into account can be found with projectile.velocity. Return true to allow the vanilla tile collision code to take place (which normally kills the projectile). Returns true by default.

Parameters
projectile
oldVelocity
Returns

Definition at line 138 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.OnTileCollide().

138  {
139  return true;
140  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.PostAI ( Projectile  projectile)
virtual

Allows you to determine how any projectile behaves. This will be called regardless of what PreAI returns.

Parameters
projectile

Definition at line 108 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.PostAI().

108  {
109  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.PostDraw ( Projectile  projectile,
SpriteBatch  spriteBatch,
Color  lightColor 
)
virtual

Allows you to draw things in front of a projectile. This method is called even if PreDraw returns false.

Parameters
projectile
spriteBatch
lightColor

Definition at line 343 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.PostDraw().

343  {
344  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.PreAI ( Projectile  projectile)
virtual

Allows you to determine how any projectile behaves. Return false to stop the vanilla AI and the AI hook from being run. Returns true by default.

Parameters
projectile
Returns

Definition at line 93 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.PreAI().

93  {
94  return true;
95  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.PreDraw ( Projectile  projectile,
SpriteBatch  spriteBatch,
Color  lightColor 
)
virtual

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

Parameters
projectile
spriteBatch
lightColor
Returns

Definition at line 333 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.PreDraw().

333  {
334  return true;
335  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.PreDrawExtras ( Projectile  projectile,
SpriteBatch  spriteBatch 
)
virtual

Allows you to draw things behind a projectile. Returns false to stop the game from drawing extras textures related to the projectile (for example, the chains for grappling hooks), useful if you're manually drawing the extras. Returns true by default.

Parameters
projectile
spriteBatch
Returns

Definition at line 322 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.PreDrawExtras().

322  {
323  return true;
324  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.PreKill ( Projectile  projectile,
int  timeLeft 
)
virtual

Allows you to determine whether the vanilla code for Kill and the Kill hook will be called. Return false to stop them from being called. Returns true by default. Note that this does not stop the projectile from dying.

Parameters
projectile
timeLeft
Returns

Definition at line 148 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.PreKill().

148  {
149  return true;
150  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.SetDefaults ( Projectile  projectile)
virtual

Allows you to set the properties of any and every projectile that gets created.

Parameters
projectile

Definition at line 85 of file GlobalProjectile.cs.

85  {
86  }
virtual bool Terraria.ModLoader.GlobalProjectile.ShouldUpdatePosition ( Projectile  projectile)
virtual

Whether or not the given projectile should update its position based on factors such as its velocity, whether it is in liquid, etc. Return false to make its velocity have no effect on its position. Returns true by default.

Parameters
projectile
Returns

Definition at line 116 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.ShouldUpdatePosition().

116  {
117  return true;
118  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.SingleGrappleHook ( int  type,
Player  player 
)
virtual

Whether or not a grappling hook can only have one hook per player in the world at a time. Return null to use the vanilla code. Returns null by default.

Definition at line 368 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.SingleGrappleHook().

368  {
369  return null;
370  }

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.GlobalProjectile.TileCollideStyle ( Projectile  projectile,
ref int  width,
ref int  height,
ref bool  fallThrough 
)
virtual

Allows you to determine how a projectile interacts with tiles. Width and height determine the projectile's hitbox for tile collision, and default to -1. Leave them as -1 to use the projectile's real size. Fallthrough determines whether the projectile can fall through platforms, etc., and defaults to true.

Parameters
projectile
width
height
fallThrough
Returns

Definition at line 128 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.TileCollideStyle().

128  {
129  return true;
130  }

+ Here is the caller graph for this function:

virtual void Terraria.ModLoader.GlobalProjectile.UseGrapple ( Player  player,
ref int  type 
)
virtual

This code is called whenever the player uses a grappling hook that shoots this type of projectile. Use it to change what kind of hook is fired (for example, the Dual Hook does this), to kill old hook projectiles, etc.

Definition at line 375 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.UseGrapple().

375  {
376  }

+ Here is the caller graph for this function:

Member Data Documentation

virtual bool Terraria.ModLoader.GlobalProjectile.CloneNewInstances => false

Whether instances of this GlobalProjectile are created through Clone or constructor (by default implementations of NewInstance and Clone()). Defaults to false (using default constructor).

Definition at line 54 of file GlobalProjectile.cs.

virtual bool Terraria.ModLoader.GlobalProjectile.InstancePerEntity => false

Whether to create a new GlobalProjectile instance for every Projectile that exists. Useful for storing information on a projectile. Defaults to false. Return true if you need to store information (have non-static fields).

Definition at line 46 of file GlobalProjectile.cs.

Referenced by Terraria.ModLoader.ProjectileLoader.HasMethod().

Property Documentation

Mod Terraria.ModLoader.GlobalProjectile.mod
getset
string Terraria.ModLoader.GlobalProjectile.Name
getset