tModLoader  0.12 Alpha
A mod to make and play 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...

Inherits Terraria.ModLoader.GlobalType< Projectile >.

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 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. Return true if you want the projectile to do damage regardless of the default blacklist. Return null to let the projectile follow vanilla can-damage-anything rules. This is what happens 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 > behindNPCsAndTiles, List< int > behindNPCs, List< int > behindProjectiles, List< int > overPlayers, List< int > overWiresUI)
 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...
 
virtual void GrappleTargetPoint (Projectile projectile, Player player, ref float grappleX, ref float grappleY)
 The location that the grappling hook pulls the player to. Defaults to the center of the hook projectile. 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. This method is only called for the owner of the projectile, meaning that in multi-player, projectiles owned by a player call this method on that client, and projectiles owned by the server such as enemy projectiles call this method on the server. 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). This method is only called for the owner of the projectile, meaning that in multi-player, projectiles owned by a player call this method on that client, and projectiles owned by the server such as enemy projectiles call this method on the server. 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, Color lightColor)
 Allows you to draw things in front of a projectile. Use the Main.EntitySpriteDraw method for drawing. 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, ref Color lightColor)
 Allows you to draw things behind a projectile, or to modify the way the projectile is drawn. Use the Main.EntitySpriteDraw method for drawing. Return false to stop the vanilla projectile drawing code (useful if you're manually drawing the projectile). Returns true by default. More...
 
virtual bool PreDrawExtras (Projectile projectile)
 Allows you to draw things behind a projectile. Use the Main.EntitySpriteDraw method for drawing. 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...
 
sealed override void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. 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, ref Vector2 hitboxCenterFrac)
 Allows you to determine how a projectile interacts with tiles. Return false if you completely override or cancel a projectile's tile collision behavior. Returns true by default. 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 Member Functions inherited from Terraria.ModLoader.GlobalType< Projectile >
virtual bool AppliesToEntity (TEntity entity, bool lateInstantiation)
 Use this to control whether or not this global should be associated with the provided entity instance. More...
 
- Public Member Functions inherited from Terraria.ModLoader.ModType
virtual bool IsLoadingEnabled (Mod mod)
 Allows you to stop Mod.AddContent from actually adding this content. Useful for items that can be disabled by a config. More...
 
virtual void Load ()
 Allows you to perform one-time loading tasks. Beware that mod content has not finished loading here, things like ModContent lookup tables or ID Sets are not fully populated. More...
 
virtual void SetStaticDefaults ()
 Allows you to modify the properties after initial loading has completed. More...
 
virtual void Unload ()
 Allows you to safely unload things you added in Load. More...
 

Protected Member Functions

sealed override void Register ()
 If you make a new ModType, seal this override. More...
 

Properties

virtual bool CloneNewInstances [get]
 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...
 
- Properties inherited from Terraria.ModLoader.GlobalType< Projectile >
virtual bool InstancePerEntity [get]
 Whether to create a new instance of this Global for every entity that exists. Useful for storing information on an entity. Defaults to false. Return true if you need to store information (have non-static fields). More...
 
- Properties inherited from Terraria.ModLoader.ModType
string FullName [get]
 The internal name of this, including the mod it is from. More...
 
Mod Mod [get, set]
 The mod this belongs to. More...
 
virtual string Name [get]
 The internal name of this. More...
 
- Properties inherited from Terraria.ModLoader.IModType
string FullName [get]
 => $"{Mod.Name}/{Name}" More...
 
Mod Mod [get]
 The mod this belongs to. More...
 
string Name [get]
 The internal name of this instance. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Terraria.ModLoader.GlobalType< Projectile >
static TResult GetGlobal< TEntity, TGlobal, TResult > (Instanced< TGlobal >[] globals, bool exactType)
 
static TResult GetGlobal< TEntity, TGlobal, TResult > (Instanced< TGlobal >[] globals, TResult baseInstance)
 
static T Instance< T > (Instanced< T >[] globals, ushort index)
 
static bool TryGetGlobal< TGlobal, TResult > (Instanced< TGlobal >[] globals, bool exactType, out TResult result)
 
static bool TryGetGlobal< TGlobal, TResult > (Instanced< TGlobal >[] globals, TResult baseInstance, out TResult result)
 

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.

Member Function Documentation

◆ AI()

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

◆ CanCutTiles()

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

◆ CanDamage()

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. Return true if you want the projectile to do damage regardless of the default blacklist. Return null to let the projectile follow vanilla can-damage-anything rules. This is what happens by default.

Parameters
projectile
Returns

◆ CanHitNPC()

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

◆ CanHitPlayer()

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

◆ CanHitPvp()

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

◆ CanUseGrapple()

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.

◆ Clone()

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

◆ Colliding()

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

◆ CutTiles()

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

◆ DrawBehind()

virtual void Terraria.ModLoader.GlobalProjectile.DrawBehind ( Projectile  projectile,
int  index,
List< int >  behindNPCsAndTiles,
List< int >  behindNPCs,
List< int >  behindProjectiles,
List< int >  overPlayers,
List< int >  overWiresUI 
)
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
behindNPCsAndTiles
behindNPCs
behindProjectiles
overPlayers
overWiresUI

◆ GetAlpha()

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

◆ GrapplePullSpeed()

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.

◆ GrappleRetreatSpeed()

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.

◆ GrappleTargetPoint()

virtual void Terraria.ModLoader.GlobalProjectile.GrappleTargetPoint ( Projectile  projectile,
Player  player,
ref float  grappleX,
ref float  grappleY 
)
virtual

The location that the grappling hook pulls the player to. Defaults to the center of the hook projectile.

◆ Kill()

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

◆ MinionContactDamage()

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

◆ ModifyDamageHitbox()

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

◆ ModifyHitNPC()

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. This method is only called for the owner of the projectile, meaning that in multi-player, projectiles owned by a player call this method on that client, and projectiles owned by the server such as enemy projectiles call this method on the server.

Parameters
projectile
target
damage
knockback
crit
hitDirection

◆ ModifyHitPlayer()

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

◆ ModifyHitPvp()

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

◆ NewInstance()

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

◆ NumGrappleHooks()

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.

◆ OnHitNPC()

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). This method is only called for the owner of the projectile, meaning that in multi-player, projectiles owned by a player call this method on that client, and projectiles owned by the server such as enemy projectiles call this method on the server.

Parameters
projectile
target
damage
knockback
crit

◆ OnHitPlayer()

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

◆ OnHitPvp()

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

◆ OnTileCollide()

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

◆ PostAI()

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

◆ PostDraw()

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

Allows you to draw things in front of a projectile. Use the Main.EntitySpriteDraw method for drawing. This method is called even if PreDraw returns false.

Parameters
projectileThe projectile.
lightColorThe color of the light at the projectile's center, after being modified by vanilla and other mods.

◆ PreAI()

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

◆ PreDraw()

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

Allows you to draw things behind a projectile, or to modify the way the projectile is drawn. Use the Main.EntitySpriteDraw method for drawing. Return false to stop the vanilla projectile drawing code (useful if you're manually drawing the projectile). Returns true by default.

Parameters
projectileThe projectile.
lightColorThe color of the light at the projectile's center.

◆ PreDrawExtras()

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

Allows you to draw things behind a projectile. Use the Main.EntitySpriteDraw method for drawing. 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
projectileThe projectile.

◆ PreKill()

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

◆ Register()

sealed override void Terraria.ModLoader.GlobalProjectile.Register ( )
protectedvirtual

If you make a new ModType, seal this override.

Implements Terraria.ModLoader.ModType.

◆ SetDefaults()

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

◆ SetupContent()

sealed override void Terraria.ModLoader.GlobalProjectile.SetupContent ( )
virtual

If you make a new ModType, seal this override, and call SetStaticDefaults in it.

Reimplemented from Terraria.ModLoader.ModType.

◆ ShouldUpdatePosition()

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

◆ SingleGrappleHook()

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.

◆ TileCollideStyle()

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

Allows you to determine how a projectile interacts with tiles. Return false if you completely override or cancel a projectile's tile collision behavior. Returns true by default.

Parameters
projectileThe projectile.
widthThe width of the hitbox the projectile will use for tile collision. If vanilla or a mod don't modify it, defaults to projectile.width.
heightThe height of the hitbox the projectile will use for tile collision. If vanilla or a mod don't modify it, defaults to projectile.height.
fallThroughWhether or not the projectile falls through platforms and similar tiles.
hitboxCenterFracDetermines by how much the tile collision hitbox's position (top left corner) will be offset from the projectile's real center. If vanilla or a mod don't modify it, defaults to half the hitbox size (new Vector2(0.5f, 0.5f)).
Returns

◆ UseGrapple()

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.

Property Documentation

◆ CloneNewInstances

virtual bool Terraria.ModLoader.GlobalProjectile.CloneNewInstances
get

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